diff options
author | Haakon Dybdahl <dybdahl@yahoo-inc.com> | 2016-11-02 11:38:49 +0100 |
---|---|---|
committer | Haakon Dybdahl <dybdahl@yahoo-inc.com> | 2016-11-02 11:38:49 +0100 |
commit | 3740c91d1d69d2b3421ca0feaf689563e761e46e (patch) | |
tree | f91596dbb728e4e5442897fec9bc533aab838ac3 /vespaclient-container-plugin | |
parent | 8160443e8b62895c64bcf1e34380c609461e8ea9 (diff) |
Fix test
Diffstat (limited to 'vespaclient-container-plugin')
-rw-r--r-- | vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ExternalFeedTestCase.java | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ExternalFeedTestCase.java b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ExternalFeedTestCase.java index 74ed844d69f..7f52d91cc61 100644 --- a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ExternalFeedTestCase.java +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/V2ExternalFeedTestCase.java @@ -44,7 +44,9 @@ import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; +import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; @@ -250,12 +252,8 @@ public class V2ExternalFeedTestCase { HttpResponse r = handler.handle(nalle); r.render(out); - String expectedErrorMsg = "Got request from client with id 'something', but found no session for this client. " + - "Most probably this server is in VIP rotation, and a client session was rotated from one " + - "server to another. This must not happen. Configure VIP with persistence=enabled, or " + - "(preferably) do not use a VIP at all."; - assertEquals(expectedErrorMsg, - Utf8.toString(out.toByteArray())); + String expectedErrorMsg = "Got request from client with id 'something', but found no session for this client."; + assertThat(Utf8.toString(out.toByteArray()), containsString(expectedErrorMsg)); assertEquals("text/plain", r.getContentType()); assertEquals(StandardCharsets.UTF_8.name(), r.getCharacterEncoding()); } @@ -277,11 +275,8 @@ public class V2ExternalFeedTestCase { nalle.getJDiscRequest().headers().add(Headers.TRACE_LEVEL, "4"); HttpResponse r = handler.handle(nalle); r.render(out); - String expectedErrorMsg = "Got request from client with id 'something#', but found no session for this " + - "client. Possible session timeout due to inactivity, server restart or " + - "reconfig, or bad VIP usage."; - assertEquals(expectedErrorMsg, - Utf8.toString(out.toByteArray())); + String expectedErrorMsg = "Got request from client with id 'something#', but found no session for this client."; + assertThat(Utf8.toString(out.toByteArray()), containsString(expectedErrorMsg)); assertEquals("text/plain", r.getContentType()); assertEquals(StandardCharsets.UTF_8.name(), r.getCharacterEncoding()); } @@ -306,11 +301,8 @@ public class V2ExternalFeedTestCase { String expectedErrorMsg = "Got request from client with id 'something#thisHostnameDoesNotExistAnywhere', " + "but found no session for this client. Session was originally established " + "towards host thisHostnameDoesNotExistAnywhere, but our hostname is " + - "ourHostname. Most probably this server is in VIP rotation, and a session " + - "was rotated from one server to another. This should not happen. Configure VIP " + - "with persistence=enabled, or (preferably) do not use a VIP at all."; - assertEquals(expectedErrorMsg, - Utf8.toString(out.toByteArray())); + "ourHostname."; + assertThat(Utf8.toString(out.toByteArray()), containsString(expectedErrorMsg)); assertEquals("text/plain", r.getContentType()); assertEquals(StandardCharsets.UTF_8.name(), r.getCharacterEncoding()); } |