@@ -142,7 +142,7 @@ public void validateTestRequestToEchoServerViaEnvoy() throws InterruptedExceptio
142
142
snapshot
143
143
);
144
144
145
- await ().atMost (3 , TimeUnit .SECONDS ).untilAsserted (
145
+ await ().atMost (5 , TimeUnit . SECONDS ). pollDelay ( 2 , TimeUnit .SECONDS ).untilAsserted (
146
146
() -> {
147
147
assertThat (nonce .toString ()).isEqualTo ("01234" );
148
148
assertThat (errorDetails .toString ()).isEqualTo ("" );
@@ -152,59 +152,34 @@ public void validateTestRequestToEchoServerViaEnvoy() throws InterruptedExceptio
152
152
assertThat (resourceToNonceMap .get (V3 .LISTENER_TYPE_URL ).toString ()).contains ("4" );
153
153
}
154
154
);
155
- }
156
-
157
- @ Test
158
- public void validateNewSnapshotVersionButSameUnderlyingResourcesDoesNotTriggerUpdate ()
159
- throws InterruptedException {
160
- assertThat (onStreamOpenLatch .await (15 , TimeUnit .SECONDS )).isTrue ()
161
- .overridingErrorMessage ("failed to open ADS stream" );
162
-
163
- assertThat (onStreamRequestLatch .await (15 , TimeUnit .SECONDS )).isTrue ()
164
- .overridingErrorMessage ("failed to receive ADS request" );
165
-
166
- // there is no onStreamResponseLatch because V3DiscoveryServer doesn't call the callbacks
167
- // when responding to a delta request
168
-
169
- String baseUri = String
170
- .format ("http://%s:%d" , ENVOY .getContainerIpAddress (), ENVOY .getMappedPort (LISTENER_PORT ));
171
-
172
- await ().atMost (5 , TimeUnit .SECONDS ).ignoreExceptions ().untilAsserted (
173
- () -> given ().baseUri (baseUri ).contentType (ContentType .TEXT )
174
- .when ().get ("/" )
175
- .then ().statusCode (200 )
176
- .and ().body (containsString (UPSTREAM .response )));
177
-
178
- // basically the nonces will count up from 0 to 3 as envoy receives more resources
179
- // and check that no messages have been sent to errorDetails
180
- assertThat (nonce .toString ()).isEqualTo ("0123" );
181
- assertThat (resourceToNonceMap .containsKey (V3 .CLUSTER_TYPE_URL )).isTrue ();
182
- assertThat (resourceToNonceMap .containsKey (V3 .LISTENER_TYPE_URL )).isTrue ();
183
- assertThat (resourceToNonceMap .containsKey (V3 .ROUTE_TYPE_URL )).isTrue ();
184
- assertThat (errorDetails .toString ()).isEqualTo ("" );
185
155
186
- // now write a new snapshot, with the only change being an update
187
- // to the version, wait for a few seconds for envoy to pick it up, and
188
- // check that the nonce doesn't change
189
- Snapshot snapshot = V3TestSnapshots .createSnapshot (true ,
156
+ // now increment the version but keep all the underlying resources the same. This should not
157
+ // trigger any updates, so the nonces should remain constant to above.
158
+ snapshot = V3TestSnapshots .createSnapshot (true ,
190
159
true ,
191
160
"upstream" ,
192
161
UPSTREAM .ipAddress (),
193
162
EchoContainer .PORT ,
194
- "listener0 " ,
163
+ "listener1 " ,
195
164
LISTENER_PORT ,
196
165
"route0" ,
197
- "2 " );
166
+ "3 " );
198
167
LOGGER .info ("snapshot={}" , snapshot );
199
168
cache .setSnapshot (
200
169
GROUP ,
201
170
snapshot
202
171
);
203
172
204
- await ().atMost (3 , TimeUnit .SECONDS ).untilAsserted (
173
+ await ().atMost (5 , TimeUnit . SECONDS ). pollDelay ( 2 , TimeUnit .SECONDS ).untilAsserted (
205
174
() -> {
206
- assertThat (nonce .toString ()).isEqualTo ("0123" );
175
+
176
+ LOGGER .info ("lastWatchRequestTime={}" , cache .statusInfo (GROUP ));
177
+ assertThat (nonce .toString ()).isEqualTo ("01234" );
207
178
assertThat (errorDetails .toString ()).isEqualTo ("" );
179
+ assertThat (resourceToNonceMap .containsKey (V3 .LISTENER_TYPE_URL )).isTrue ();
180
+ // we know that the most recent update was to the listener, so check
181
+ // that it received the most recent nonce
182
+ assertThat (resourceToNonceMap .get (V3 .LISTENER_TYPE_URL ).toString ()).contains ("4" );
208
183
}
209
184
);
210
185
}
0 commit comments