Skip to content

Commit c0e371b

Browse files
author
mgajda
committed
Get V3DiscoveryServerXdsDeltaResourcesIT passing
1 parent 96f293b commit c0e371b

File tree

1 file changed

+5
-35
lines changed

1 file changed

+5
-35
lines changed

server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerXdsDeltaResourcesIT.java

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -156,48 +156,17 @@ public void validateTestRequestToEchoServerViaEnvoy() throws InterruptedExceptio
156156
assertThat(errorDetails.toString()).isEqualTo("");
157157
}
158158
);
159-
}
160-
161-
@Test
162-
public void validateNewSnapshotVersionButSameUnderlyingResourcesDoesNotTriggerUpdate()
163-
throws InterruptedException {
164-
assertThat(onStreamOpenLatch.await(15, TimeUnit.SECONDS)).isTrue()
165-
.overridingErrorMessage("failed to open ADS stream");
166-
167-
assertThat(onStreamRequestLatch.await(15, TimeUnit.SECONDS)).isTrue()
168-
.overridingErrorMessage("failed to receive ADS request");
169-
170-
// there is no onStreamResponseLatch because V3DiscoveryServer doesn't call the callbacks
171-
// when responding to a delta request
172-
173-
String baseUri = String
174-
.format("http://%s:%d", ENVOY.getContainerIpAddress(), ENVOY.getMappedPort(LISTENER_PORT));
175-
176-
await().atMost(5, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
177-
() -> given().baseUri(baseUri).contentType(ContentType.TEXT)
178-
.when().get("/")
179-
.then().statusCode(200)
180-
.and().body(containsString(UPSTREAM.response)));
181-
182-
// we'll count three nonces of "0" and make sure we've gotten no errors
183-
assertThat(errorDetails.toString()).isEqualTo("");
184-
assertThat(resourceToNonceMap.containsKey(V3.CLUSTER_TYPE_URL)).isTrue();
185-
assertThat(resourceToNonceMap.get(V3.CLUSTER_TYPE_URL).toString()).isEqualTo("0");
186-
assertThat(resourceToNonceMap.containsKey(V3.LISTENER_TYPE_URL)).isTrue();
187-
assertThat(resourceToNonceMap.get(V3.LISTENER_TYPE_URL).toString()).isEqualTo("0");
188-
assertThat(resourceToNonceMap.containsKey(V3.ROUTE_TYPE_URL)).isTrue();
189-
assertThat(resourceToNonceMap.get(V3.ROUTE_TYPE_URL).toString()).isEqualTo("0");
190159

191160
// now write a new snapshot, with no changes to the params we pass in
192161
// but update version. This being a Delta request, this version doesn't
193162
// really matter, and Envoy should not receive a spontaneous update
194163
// because the hash of the resources will be the same
195-
Snapshot snapshot = V3TestSnapshots.createSnapshotNoEds(false,
164+
snapshot = V3TestSnapshots.createSnapshotNoEds(false,
196165
true,
197166
"upstream",
198167
UPSTREAM.ipAddress(),
199168
EchoContainer.PORT,
200-
"listener0",
169+
"listener1",
201170
LISTENER_PORT,
202171
"route0",
203172
"2");
@@ -207,12 +176,13 @@ public void validateNewSnapshotVersionButSameUnderlyingResourcesDoesNotTriggerUp
207176
snapshot
208177
);
209178

210-
await().atMost(3, TimeUnit.SECONDS).untilAsserted(
179+
// delay polling by 2 seconds to check that no upsates are received
180+
await().pollDelay(2, TimeUnit.SECONDS).atMost(5, TimeUnit.SECONDS).untilAsserted(
211181
() -> {
212182
assertThat(resourceToNonceMap.containsKey(V3.CLUSTER_TYPE_URL)).isTrue();
213183
assertThat(resourceToNonceMap.get(V3.CLUSTER_TYPE_URL).toString()).isEqualTo("0");
214184
assertThat(resourceToNonceMap.containsKey(V3.LISTENER_TYPE_URL)).isTrue();
215-
assertThat(resourceToNonceMap.get(V3.LISTENER_TYPE_URL).toString()).isEqualTo("0");
185+
assertThat(resourceToNonceMap.get(V3.LISTENER_TYPE_URL).toString()).isEqualTo("01");
216186
assertThat(resourceToNonceMap.containsKey(V3.ROUTE_TYPE_URL)).isTrue();
217187
assertThat(resourceToNonceMap.get(V3.ROUTE_TYPE_URL).toString()).isEqualTo("0");
218188
assertThat(errorDetails.toString()).isEqualTo("");

0 commit comments

Comments
 (0)