diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-04-26 09:54:15 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-04-26 09:54:15 +0200 |
commit | 423577501f67690d5f055a5f0443412bfacb2153 (patch) | |
tree | ba0c0a850c151956527c9af16355c0ee124c691c /configserver | |
parent | 4d0b89c13bbcbb8306a96d771f91de4d8cad8a14 (diff) |
Expect (re)deployment race
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionStateWatcher.java | 3 | ||||
-rw-r--r-- | configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java | 15 |
2 files changed, 10 insertions, 8 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionStateWatcher.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionStateWatcher.java index 7c1c30d8d67..ed1eba58dfb 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionStateWatcher.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionStateWatcher.java @@ -70,7 +70,7 @@ public class SessionStateWatcher implements NodeCacheListener { } @Override - public void nodeChanged() throws Exception { + public void nodeChanged() { executor.execute(() -> { try { ChildData data = fileCache.getCurrentData(); @@ -83,4 +83,5 @@ public class SessionStateWatcher implements NodeCacheListener { } }); } + } diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java index 24e9d32a00e..9b40784018a 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.Optional; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -72,7 +73,6 @@ public class HostedDeployTest { /** Test that unused versions are skipped in dev */ @Test - @Ignore // TODO Fix this test and re-enable public void testDeployMultipleVersionsInDev() { List<Host> hosts = new ArrayList<>(); hosts.add(createHost("host1", "6.0.0")); @@ -100,12 +100,13 @@ public class HostedDeployTest { ApplicationId app = tester.deployApp("myApp", Instant.now()); assertEquals(3, tester.getAllocatedHostsOf(app).getHosts().size()); - assertEquals(1, factory600.creationCount()); - assertEquals(0, factory610.creationCount()); - assertEquals(1, factory620.creationCount()); - assertEquals(0, factory700.creationCount()); - assertEquals(1, factory710.creationCount()); - assertEquals("Newest is always included", 1, factory720.creationCount()); + // Check >0 not ==0 as the session watcher thread is running and will redeploy models in the background + assertTrue(factory600.creationCount() > 0); + assertFalse(factory610.creationCount() > 0); + assertTrue(factory620.creationCount() > 0); + assertFalse(factory700.creationCount() > 0); + assertTrue(factory710.creationCount() > 0); + assertTrue("Newest is always included", factory720.creationCount() > 0); } @Test |