aboutsummaryrefslogtreecommitdiffstats
path: root/logserver
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahoo-inc.com>2017-05-17 22:28:36 +0200
committerHåkon Hallingstad <hakon@yahoo-inc.com>2017-05-17 22:28:36 +0200
commitb452d1f132c984806abd9dd0f0ee77b3ed6d92ec (patch)
treed27b9280d4ac9cf861fa9f859bdf6b2813c8489b /logserver
parent940e6f1c75d448ca6de0ae888fe119a16432ea5e (diff)
Make logserver tests work with VPN
Also, ignore directory made by test.
Diffstat (limited to 'logserver')
-rw-r--r--logserver/src/test/java/com/yahoo/logserver/handlers/lasterrorsholder/LastErrorsHolderTestCase.java3
-rw-r--r--logserver/src/test/java/com/yahoo/logserver/handlers/replicator/ReplicatorTestCase.java28
2 files changed, 16 insertions, 15 deletions
diff --git a/logserver/src/test/java/com/yahoo/logserver/handlers/lasterrorsholder/LastErrorsHolderTestCase.java b/logserver/src/test/java/com/yahoo/logserver/handlers/lasterrorsholder/LastErrorsHolderTestCase.java
index a0e97c28f76..ba857c51f5c 100644
--- a/logserver/src/test/java/com/yahoo/logserver/handlers/lasterrorsholder/LastErrorsHolderTestCase.java
+++ b/logserver/src/test/java/com/yahoo/logserver/handlers/lasterrorsholder/LastErrorsHolderTestCase.java
@@ -53,7 +53,8 @@ public class LastErrorsHolderTestCase {
Instant start = Instant.now();
while (Instant.now().isBefore(start.plus(Duration.ofMinutes(1)))) {
try {
- socket = SocketChannel.open(new InetSocketAddress(lastErrorsHolderPort));
+ InetSocketAddress address = new InetSocketAddress("localhost", lastErrorsHolderPort);
+ socket = SocketChannel.open(address);
break;
} catch (Exception e) {
Thread.sleep(100);
diff --git a/logserver/src/test/java/com/yahoo/logserver/handlers/replicator/ReplicatorTestCase.java b/logserver/src/test/java/com/yahoo/logserver/handlers/replicator/ReplicatorTestCase.java
index 37f25e47a1c..3f8ed840273 100644
--- a/logserver/src/test/java/com/yahoo/logserver/handlers/replicator/ReplicatorTestCase.java
+++ b/logserver/src/test/java/com/yahoo/logserver/handlers/replicator/ReplicatorTestCase.java
@@ -1,18 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.logserver.handlers.replicator;
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.nio.ByteBuffer;
-import java.nio.channels.SocketChannel;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
import com.yahoo.io.Listener;
import com.yahoo.log.InvalidLogFormatException;
import com.yahoo.log.LogLevel;
@@ -21,6 +9,18 @@ import com.yahoo.logserver.Server;
import com.yahoo.logserver.filter.LogFilter;
import com.yahoo.logserver.filter.LogFilterManager;
import com.yahoo.logserver.formatter.LogFormatterManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
public class ReplicatorTestCase {
Server server;
@@ -40,7 +40,7 @@ public class ReplicatorTestCase {
long timeout = 60000;
while (System.currentTimeMillis() < (start + timeout)) {
try {
- socket = SocketChannel.open(new InetSocketAddress(18321));
+ socket = SocketChannel.open(new InetSocketAddress("localhost", 18321));
break;
} catch (Exception e) {
Thread.sleep(100);
@@ -122,7 +122,7 @@ public class ReplicatorTestCase {
assertTrue(conn.isLoggable(LogMessage.
parseNativeFormat("1343996283.239582\texample.yahoo.com\t27301/7637\tconfig-sentinel\trunserver\terror\tbar")));
assertEquals(conn.description(), "No filter defined");
- assertEquals(conn.getRemoteHost(), "0.0.0.0");
+ assertEquals(conn.getRemoteHost(), "localhost");
conn.onFormatter("nonexistant");
assertEquals(conn.formatter, LogFormatterManager.getLogFormatter("system.nullformatter")); // unchanged
conn.onUse("nonexistant");