Skip to content

Commit

Permalink
Fix flaky integration test (#33604)
Browse files Browse the repository at this point in the history
Signed-off-by: antoniovleonti <leonti@google.com>
Signed-off-by: Ryan Northey <ryan@synca.io>
  • Loading branch information
antoniovleonti authored and phlax committed Apr 17, 2024
1 parent 863e60a commit fe18929
Showing 1 changed file with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ TEST_P(ExtAuthzGrpcIntegrationTest, DownstreamHeadersOnSuccess) {
TEST_P(ExtAuthzGrpcIntegrationTest, TimeoutFailClosed) {
GrpcInitializeConfigOpts opts;
opts.failure_mode_allow = false;
opts.timeout_ms = 10;
opts.timeout_ms = 1;
initializeConfig(opts);

// Use h1, set up the test.
Expand All @@ -1028,9 +1028,6 @@ TEST_P(ExtAuthzGrpcIntegrationTest, TimeoutFailClosed) {
// Start a client connection and request.
initiateClientConnection(0);

// Wait for the ext_authz request as a result of the client request.
waitForExtAuthzRequest(expectedCheckRequest(Http::CodecType::HTTP1));

// Do not sendExtAuthzResponse(). Envoy should reject the request after 1 second.
ASSERT_TRUE(response_->waitForEndStream());
EXPECT_TRUE(response_->complete());
Expand All @@ -1042,7 +1039,7 @@ TEST_P(ExtAuthzGrpcIntegrationTest, TimeoutFailClosed) {
TEST_P(ExtAuthzGrpcIntegrationTest, TimeoutFailOpen) {
GrpcInitializeConfigOpts init_opts;
init_opts.failure_mode_allow = true;
init_opts.timeout_ms = 10;
init_opts.timeout_ms = 1;
initializeConfig(init_opts);

// Use h1, set up the test.
Expand All @@ -1052,9 +1049,6 @@ TEST_P(ExtAuthzGrpcIntegrationTest, TimeoutFailOpen) {
// Start a client connection and request.
initiateClientConnection(0);

// Wait for the ext_authz request as a result of the client request.
waitForExtAuthzRequest(expectedCheckRequest(Http::CodecType::HTTP1));

// Do not sendExtAuthzResponse(). Envoy should eventually proxy the request upstream as if the
// authz service approved the request.
WaitForSuccessfulUpstreamResponseOpts upstream_opts;
Expand Down Expand Up @@ -1273,10 +1267,9 @@ TEST_P(ExtAuthzHttpIntegrationTest, RedirectResponse) {
}

TEST_P(ExtAuthzHttpIntegrationTest, TimeoutFailClosed) {
initializeConfig(false, /*failure_mode_allow=*/false, /*timeout_ms=*/10);
initializeConfig(false, /*failure_mode_allow=*/false, /*timeout_ms=*/1);
HttpIntegrationTest::initialize();
initiateClientConnection();
waitForExtAuthzRequest();

// Do not sendExtAuthzResponse(). Envoy should reject the request after 1 second.
ASSERT_TRUE(response_->waitForEndStream(Envoy::Seconds(10)));
Expand All @@ -1287,10 +1280,9 @@ TEST_P(ExtAuthzHttpIntegrationTest, TimeoutFailClosed) {
}

TEST_P(ExtAuthzHttpIntegrationTest, TimeoutFailOpen) {
initializeConfig(false, /*failure_mode_allow=*/true, /*timeout_ms=*/10);
initializeConfig(false, /*failure_mode_allow=*/true, /*timeout_ms=*/1);
HttpIntegrationTest::initialize();
initiateClientConnection();
waitForExtAuthzRequest();

// Do not sendExtAuthzResponse(). Envoy should eventually proxy the request upstream as if the
// authz service approved the request.
Expand Down

0 comments on commit fe18929

Please sign in to comment.