Skip to content

Commit 464c1ea

Browse files
authored
Fix flakiness in integration test: a connect timeout value of 0 (envoyproxy#213)
will cause Envoy to return a proto validation error. The connect timeout value for this specific set is picked at random (with an upper bound only), so to fix we also set a lower bound. Signed-off-by: rulex123 <[email protected]>
1 parent c3368c6 commit 464c1ea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@
2929
import java.util.Collections;
3030
import java.util.concurrent.CountDownLatch;
3131
import java.util.concurrent.TimeUnit;
32+
33+
import org.apache.commons.lang3.RandomUtils;
3234
import org.junit.ClassRule;
3335
import org.junit.Test;
3436
import org.junit.rules.RuleChain;
3537
import org.testcontainers.containers.Network;
3638
import org.testcontainers.shaded.com.google.common.collect.ImmutableList;
37-
import org.testcontainers.shaded.org.apache.commons.lang.math.RandomUtils;
3839

3940
public class V3DiscoveryServerAdsWarmingClusterIT {
4041

@@ -176,7 +177,7 @@ private static Snapshot createSnapshotWithNotWorkingCluster(boolean ads,
176177

177178
Cluster cluster = Cluster.newBuilder()
178179
.setName(clusterName)
179-
.setConnectTimeout(Durations.fromSeconds(RandomUtils.nextInt(5)))
180+
.setConnectTimeout(Durations.fromSeconds(RandomUtils.nextInt(1, 5)))
180181
// we are enabling HTTP2 - communication with cluster won't work
181182
.putAllTypedExtensionProtocolOptions(Collections.singletonMap(
182183
"envoy.extensions.upstreams.http.v3.HttpProtocolOptions",

0 commit comments

Comments
 (0)