Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration-tests: tweaks to stabilize sanitizer runs #357

Merged
merged 8 commits into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/integration/nighthawk_grpc_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _serverThreadRunner(self):
self._address_file = None

def _waitUntilServerListening(self):
tries = 30
tries = 90
while tries > 0:
contents = ""
if not self._address_file is None:
Expand Down
2 changes: 1 addition & 1 deletion test/integration/nighthawk_test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def enableCpuProfiler(self):
def waitUntilServerListening(self):
# we allow 30 seconds for the server to have its listeners up.
# (It seems that in sanitizer-enabled runs this can take a little while)
timeout = time.time() + 30
timeout = time.time() + 60
while time.time() < timeout:
if self.tryUpdateFromAdminInterface():
return True
Expand Down
17 changes: 8 additions & 9 deletions test/integration/test_connection_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,25 @@ def countLogLinesWithSubstring(logs, substring):
return len([line for line in logs.split(os.linesep) if substring in line])

_, logs = http_test_server_fixture.runNighthawkClient([
"--rps 20", "-v", "trace", "--connections", "2", "--prefetch-connections",
"--rps 5", "-v", "trace", "--connections", "2", "--prefetch-connections",
"--experimental-h1-connection-reuse-strategy", "mru", "--termination-predicate",
"benchmark.http_2xx:10", "--simple-warmup",
"benchmark.http_2xx:4",
http_test_server_fixture.getTestServerRootUri()
])

requests = 60
connections = 3
assertNotIn("[C1] message complete", logs)
assertEqual(countLogLinesWithSubstring(logs, "[C0] message complete"), 22)
assertEqual(countLogLinesWithSubstring(logs, "[C0] message complete"), 10)

requests = 12
connections = 3
_, logs = http_test_server_fixture.runNighthawkClient([
"--rps", "20", "-v trace", "--connections",
"--rps", "5", "-v trace", "--connections",
str(connections), "--prefetch-connections", "--experimental-h1-connection-reuse-strategy",
"lru", "--termination-predicate",
"benchmark.http_2xx:%d" % requests,
"benchmark.http_2xx:%d" % (requests - 1),
http_test_server_fixture.getTestServerRootUri()
])
for i in range(1, connections):
line_count = countLogLinesWithSubstring(logs, "[C%d] message complete" % i)
strict_count = (requests / connections) * 2
# We need to mind a single warmup call
assertBetweenInclusive(line_count, strict_count, strict_count + 2)
assertBetweenInclusive(line_count, strict_count, strict_count)
4 changes: 2 additions & 2 deletions test/integration/test_grpc_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
def test_grpc_service_happy_flow(http_test_server_fixture):
http_test_server_fixture.startNighthawkGrpcService("dummy-request-source")
parsed_json, _ = http_test_server_fixture.runNighthawkClient([
"--termination-predicate", "benchmark.http_2xx:10", "--rps 100",
"--termination-predicate", "benchmark.http_2xx:5", "--rps 10",
"--request-source %s:%s" % (http_test_server_fixture.grpc_service.server_ip,
http_test_server_fixture.grpc_service.server_port),
http_test_server_fixture.getTestServerRootUri()
])
counters = http_test_server_fixture.getNighthawkCounterMapFromJson(parsed_json)
assertGreaterEqual(counters["benchmark.http_2xx"], 10)
assertGreaterEqual(counters["benchmark.http_2xx"], 5)
assertEqual(counters["requestsource.internal.upstream_rq_200"], 1)


Expand Down
10 changes: 5 additions & 5 deletions test/integration/test_integration_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def test_http_h1_mini_stress_test_with_client_side_queueing(http_test_server_fix
"10", "--connections", "1", "--duration", "100", "--termination-predicate",
"benchmark.http_2xx:99", "--simple-warmup"
])
assertCounterEqual(counters, "upstream_rq_pending_total", 11)
assertCounterEqual(counters, "upstream_cx_overflow", 10)
assertCounterGreaterEqual(counters, "upstream_rq_pending_total", 11)
assertCounterGreaterEqual(counters, "upstream_cx_overflow", 10)


def test_http_h1_mini_stress_test_without_client_side_queueing(http_test_server_fixture):
Expand All @@ -115,7 +115,7 @@ def test_http_h2_mini_stress_test_with_client_side_queueing(http_test_server_fix
"--termination-predicate", "benchmark.http_2xx:99", "--simple-warmup"
])
assertCounterEqual(counters, "upstream_rq_pending_total", 1)
assertCounterEqual(counters, "upstream_rq_pending_overflow", 10)
assertCounterGreaterEqual(counters, "upstream_rq_pending_overflow", 10)


def test_http_h2_mini_stress_test_without_client_side_queueing(http_test_server_fixture):
Expand Down Expand Up @@ -276,7 +276,7 @@ def test_https_h2_multiple_connections(https_test_server_fixture):
"10"
])
counters = https_test_server_fixture.getNighthawkCounterMapFromJson(parsed_json)
assertCounterEqual(counters, "benchmark.http_2xx", 100)
assertCounterGreaterEqual(counters, "benchmark.http_2xx", 100)
# Empirical observation shows we may end up creating more then 10 connections.
# This is stock Envoy h/2 pool behavior.
assertCounterGreaterEqual(counters, "upstream_cx_http2_total", 10)
Expand Down Expand Up @@ -310,7 +310,7 @@ def _do_tls_configuration_test(https_test_server_fixture, cli_parameter, use_h2)
https_test_server_fixture.getTestServerRootUri()
])
counters = https_test_server_fixture.getNighthawkCounterMapFromJson(parsed_json)
assertCounterEqual(counters, "ssl.ciphers.%s" % cipher, 1)
assertCounterGreaterEqual(counters, "ssl.ciphers.%s" % cipher, 1)


def test_https_h1_tls_context_configuration(https_test_server_fixture):
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_remote_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_remote_execution_basics(http_test_server_fixture):
]
parsed_json, _ = http_test_server_fixture.runNighthawkClient(args)
counters = http_test_server_fixture.getNighthawkCounterMapFromJson(parsed_json)
assertCounterEqual(counters, "benchmark.http_2xx", 25)
assertCounterGreaterEqual(counters, "benchmark.http_2xx", 25)

# As a control step, prove we are actually performing remote execution: re-run the command without an
# operational gRPC service. That ought to fail.
Expand Down