Skip to content

Commit

Permalink
test: fix flake in ssl_integration_test and future-proof (envoyproxy#…
Browse files Browse the repository at this point in the history
…3313)

Fixes envoyproxy#3309, and generally makes sendRequestAndWaitForResponse into a function which isn't test flakes waiting to happen

Risk Level: Low
Testing: bazel test test/integration:ssl_integration_test --runs_per_test=200 ; bazel test test/integration:all --runs_per_test=10

Signed-off-by: Alyssa Wilk <[email protected]>
  • Loading branch information
alyssawilk authored May 8, 2018
1 parent 08712e9 commit 1e336bc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/integration/http_integration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void IntegrationCodecClient::flushWrite() {

void IntegrationCodecClient::makeHeaderOnlyRequest(const Http::HeaderMap& headers,
IntegrationStreamDecoder& response) {
RELEASE_ASSERT(!response.complete()); // Make sure this is cleared between uses.
Http::StreamEncoder& encoder = newStream(response);
encoder.getStream().addCallbacks(response);
encoder.encodeHeaders(headers, true);
Expand All @@ -97,6 +98,7 @@ void IntegrationCodecClient::makeHeaderOnlyRequest(const Http::HeaderMap& header

void IntegrationCodecClient::makeRequestWithBody(const Http::HeaderMap& headers, uint64_t body_size,
IntegrationStreamDecoder& response) {
RELEASE_ASSERT(!response.complete()); // Make sure this is cleared between uses.
Http::StreamEncoder& encoder = newStream(response);
encoder.getStream().addCallbacks(response);
encoder.encodeHeaders(headers, false);
Expand Down Expand Up @@ -189,6 +191,7 @@ void HttpIntegrationTest::sendRequestAndWaitForResponse(Http::TestHeaderMapImpl&
uint32_t request_body_size,
Http::TestHeaderMapImpl& response_headers,
uint32_t response_size) {
response_.reset(new IntegrationStreamDecoder(*dispatcher_));
// Send the request to Envoy.
if (request_body_size) {
codec_client_->makeRequestWithBody(request_headers, request_body_size, *response_);
Expand Down

0 comments on commit 1e336bc

Please sign in to comment.