aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-feed-client
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-11-22 18:39:50 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-11-22 18:39:50 +0100
commitf5fdac09fc7498b2eb7c03ce2fbdf9b83bcbf253 (patch)
treeca95a5e1fe0d310221ae39b2cca1d3b791464f6f /vespa-feed-client
parentad0c8802a45afc1a9c6c52864fa298ee6fc2282f (diff)
Stabilise unit test
Diffstat (limited to 'vespa-feed-client')
-rw-r--r--vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java b/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java
index 11b844f2c69..0f840201ca8 100644
--- a/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java
+++ b/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java
@@ -208,16 +208,16 @@ class HttpRequestStrategyTest {
// Enqueue some operations to the same id, which are serialised, and then shut down while operations are in flight.
Phaser phaser = new Phaser(2);
Phaser blocker = new Phaser(2);
- AtomicReference<CompletableFuture<HttpResponse>> completion = new AtomicReference<>();
cluster.expect((req, vessel) -> {
if (req == blocking) {
- phaser.arriveAndAwaitAdvance(); // Synchronise with tst main thread, and then ...
+ phaser.arriveAndAwaitAdvance(); // Synchronise with test main thread, and then ...
blocker.arriveAndAwaitAdvance(); // ... block dispatch thread, so we get something in the queue.
throw new RuntimeException("armageddon"); // Dispatch thread should die, tearing down everything.
}
else if (req == failing) {
phaser.arriveAndAwaitAdvance(); // Let test thread enqueue more ops before failing (and retrying) this.
vessel.completeExceptionally(new IOException("failed"));
+ phaser.arriveAndAwaitAdvance(); // Ensure a retry is scheduled before test thread is allowed to continue.
}
else phaser.arriveAndAwaitAdvance(); // Don't complete from mock cluster, but require destruction to do this.
});
@@ -228,7 +228,8 @@ class HttpRequestStrategyTest {
CompletableFuture<HttpResponse> blocked = strategy.enqueue(id3, blocking);
CompletableFuture<HttpResponse> delayed = strategy.enqueue(id4, request);
phaser.arriveAndAwaitAdvance(); // inflight completes dispatch, but causes no response.
- phaser.arriveAndAwaitAdvance(); // failed completes dispatch, and a retry is enqueued.
+ phaser.arriveAndAwaitAdvance(); // failed is allowed to dispatch ...
+ phaser.arriveAndAwaitAdvance(); // ... and a retry is enqueued.
phaser.arriveAndAwaitAdvance(); // blocked starts dispatch, and hangs, blocking dispatch thread.
// Current state: inflight is "inflight to cluster", serialised1/2 are waiting completion of it;