aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/test/java/com/yahoo/config/subscription
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2022-01-03 14:37:16 +0100
committerHarald Musum <musum@yahooinc.com>2022-01-03 14:37:16 +0100
commit3369f835bcb2434a6d54db34b0345f196aa2506d (patch)
treec1105d0b9bdbe102dd8b6f7919863a9669511c84 /config/src/test/java/com/yahoo/config/subscription
parent4528efcd87b9c078f91ecfc4f53dfee8632881e1 (diff)
Avoid clearing config response queue
There have been races due to the fact that we used to clear the queue when receiving a response, thus missing some of the responses. This stops clearing the queue and handles several items on the queue by polling until the queue is empty when a new item is found on the queue.
Diffstat (limited to 'config/src/test/java/com/yahoo/config/subscription')
-rw-r--r--config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java b/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java
index fc922cc3b07..61573fd19be 100644
--- a/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java
+++ b/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java
@@ -33,7 +33,7 @@ public class GenericConfigSubscriberTest {
public void testSubscribeGeneric() throws InterruptedException {
JRTConfigRequester requester = new JRTConfigRequester(new MockConnection(), tv);
GenericConfigSubscriber sub = new GenericConfigSubscriber(requester);
- final List<String> defContent = List.of("myVal int");
+ List<String> defContent = List.of("myVal int");
GenericConfigHandle handle = sub.subscribe(new ConfigKey<>("simpletypes", "id", "config"),
defContent,
tv);
@@ -46,9 +46,9 @@ public class GenericConfigSubscriberTest {
assertFalse(handle.isChanged());
// Wait some time, config should be the same, but generation should be higher
- Thread.sleep(tv.getFixedDelay() * 2);
+ Thread.sleep(tv.getFixedDelay() * 3);
assertEquals("{}", getConfig(handle));
- assertTrue(handle.getRawConfig().getGeneration() > 1);
+ assertTrue("Unexpected generation (not > 1): " + handle.getRawConfig().getGeneration(), handle.getRawConfig().getGeneration() > 1);
assertFalse(sub.nextConfig(false));
assertFalse(handle.isChanged());
}