From 6bc6e71b0de64f3e6ff763a3f2a815b52a4587a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20L=C3=A9aut=C3=A9?= Date: Thu, 15 Jan 2015 13:53:17 -0800 Subject: [PATCH] Add messages to catch spurious test failures --- .../curator/announcement/AnnouncerTest.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/server/src/test/java/io/druid/curator/announcement/AnnouncerTest.java b/server/src/test/java/io/druid/curator/announcement/AnnouncerTest.java index 528b0fd77f4..58c01f5e252 100644 --- a/server/src/test/java/io/druid/curator/announcement/AnnouncerTest.java +++ b/server/src/test/java/io/druid/curator/announcement/AnnouncerTest.java @@ -69,18 +69,18 @@ public class AnnouncerTest extends CuratorTestBase final String testPath2 = "/somewhere/test2"; announcer.announce(testPath1, billy); - Assert.assertNull(curator.checkExists().forPath(testPath1)); - Assert.assertNull(curator.checkExists().forPath(testPath2)); + Assert.assertNull("/test1 does not exists", curator.checkExists().forPath(testPath1)); + Assert.assertNull("/somewhere/test2 does not exists", curator.checkExists().forPath(testPath2)); announcer.start(); - Assert.assertArrayEquals(billy, curator.getData().decompressed().forPath(testPath1)); - Assert.assertNull(curator.checkExists().forPath(testPath2)); + Assert.assertArrayEquals("/test1 has data", billy, curator.getData().decompressed().forPath(testPath1)); + Assert.assertNull("/somewhere/test2 still does not exist", curator.checkExists().forPath(testPath2)); announcer.announce(testPath2, billy); - Assert.assertArrayEquals(billy, curator.getData().decompressed().forPath(testPath1)); - Assert.assertArrayEquals(billy, curator.getData().decompressed().forPath(testPath2)); + Assert.assertArrayEquals("/test1 still has data", billy, curator.getData().decompressed().forPath(testPath1)); + Assert.assertArrayEquals("/somewhere/test2 has data", billy, curator.getData().decompressed().forPath(testPath2)); final CountDownLatch latch = new CountDownLatch(1); curator.getCuratorListenable().addListener( @@ -96,19 +96,19 @@ public class AnnouncerTest extends CuratorTestBase } ); curator.delete().forPath(testPath1); - Assert.assertTrue(timing.awaitLatch(latch)); + Assert.assertTrue("Wait for /test1 to be created", timing.awaitLatch(latch)); - Assert.assertArrayEquals(billy, curator.getData().decompressed().forPath(testPath1)); - Assert.assertArrayEquals(billy, curator.getData().decompressed().forPath(testPath2)); + Assert.assertArrayEquals("expect /test1 data is restored", billy, curator.getData().decompressed().forPath(testPath1)); + Assert.assertArrayEquals("expect /somewhere/test2 is still there", billy, curator.getData().decompressed().forPath(testPath2)); announcer.unannounce(testPath1); - Assert.assertNull(curator.checkExists().forPath(testPath1)); - Assert.assertArrayEquals(billy, curator.getData().decompressed().forPath(testPath2)); + Assert.assertNull("expect /test1 unannounced", curator.checkExists().forPath(testPath1)); + Assert.assertArrayEquals("expect /somewhere/test2 is still still there", billy, curator.getData().decompressed().forPath(testPath2)); announcer.stop(); - Assert.assertNull(curator.checkExists().forPath(testPath1)); - Assert.assertNull(curator.checkExists().forPath(testPath2)); + Assert.assertNull("expect /test1 remains unannounced", curator.checkExists().forPath(testPath1)); + Assert.assertNull("expect /somewhere/test2 unannounced", curator.checkExists().forPath(testPath2)); } @Test