예제 #1
0
                                      10)


def test_http_h2_mini_stress_test_without_client_side_queueing(
        http_test_server_fixture):
    """Run a max rps test with the h2 pool against our test server, with no client-side queueing."""
    counters = _mini_stress_test(http_test_server_fixture, [
        http_test_server_fixture.getTestServerRootUri(), "--rps", "999999",
        "--h2", "--max-active-requests", "1", "--connections", "1",
        "--duration", "100", "--termination-predicate", "benchmark.http_2xx:99"
    ])
    asserts.assertCounterEqual(counters, "upstream_rq_pending_total", 1)
    asserts.assertNotIn("upstream_rq_pending_overflow", counters)


@pytest.mark.skipif(utility.isSanitizerRun(),
                    reason="Unstable and very slow in sanitizer runs")
def test_http_h1_mini_stress_test_open_loop(http_test_server_fixture):
    """Run an H1 open loop stress test. We expect higher pending and overflow counts."""
    counters = _mini_stress_test(http_test_server_fixture, [
        http_test_server_fixture.getTestServerRootUri(), "--rps", "10000",
        "--max-pending-requests", "1", "--open-loop", "--max-active-requests",
        "1", "--connections", "1", "--duration", "100",
        "--termination-predicate", "benchmark.http_2xx:99", "--simple-warmup"
    ])
    # we expect pool overflows
    asserts.assertCounterGreater(counters, "benchmark.pool_overflow", 10)


@pytest.mark.skipif(utility.isSanitizerRun(),
                    reason="Unstable and very slow in sanitizer runs")
예제 #2
0
#!/usr/bin/env python3
"""Entry point for our integration testing."""
import logging
import os
import sys
import pytest

from test.integration import utility

if __name__ == '__main__':
    path = os.path.dirname(os.path.realpath(__file__))
    test_selection_arg = sys.argv[1] if len(sys.argv) > 1 else ""
    r = pytest.main(
        [
            "--rootdir=" + path,
            "-vvvv",
            "--showlocals",  # Don't abbreviate/truncate long values in asserts.
            "-p",
            "no:cacheprovider",  # Avoid a bunch of warnings on readonly filesystems
            "-k",
            test_selection_arg,  # Passed in via BUILD/py_test()
            "-x",
            path,
            "-n",
            "4" if utility.isSanitizerRun() else
            "20"  # Number of tests to run in parallel
        ],
        plugins=["xdist"])
    exit(r)
예제 #3
0
import os
import sys
import pytest

from test.integration import utility

if __name__ == '__main__':
  path = os.path.dirname(os.path.realpath(__file__))
  test_selection_arg = sys.argv[1] if len(sys.argv) > 1 else ""
  r = pytest.main(
      [
          "--assert=plain",
          "--rootdir=" + path,
          "-vvvv",
          "--showlocals",  # Don't abbreviate/truncate long values in asserts.
          "-p",
          "no:cacheprovider",  # Avoid a bunch of warnings on readonly filesystems
          "-k",
          test_selection_arg,  # Passed in via BUILD/py_test()
          "-x",
          path,
          "-n",
          "4" if utility.isSanitizerRun() else "20",  # Number of tests to run in parallel
          "--log-level",
          "INFO",
          "--log-cli-level",
          "INFO",
      ],
      plugins=["xdist"])
  exit(r)
예제 #4
0
def test_grpc_service_down(http_test_server_fixture):
    parsed_json, _ = http_test_server_fixture.runNighthawkClient(
        [
            "--rps 100",
            "--request-source %s:%s" %
            (http_test_server_fixture.server_ip, "34589"),
            http_test_server_fixture.getTestServerRootUri()
        ],
        expect_failure=True)
    counters = http_test_server_fixture.getNighthawkCounterMapFromJson(
        parsed_json)
    utility.assertEqual(
        counters["requestsource.upstream_rq_pending_failure_eject"], 1)


@pytest.mark.skipif(utility.isSanitizerRun(), reason="Slow in sanitizer runs")
def test_grpc_service_stress(http_test_server_fixture):
    http_test_server_fixture.startNighthawkGrpcService("dummy-request-source")
    parsed_json, _ = http_test_server_fixture.runNighthawkClient([
        "--duration 100", "--rps 10000", "--concurrency 4",
        "--termination-predicate", "benchmark.http_2xx:5000",
        "--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)
    utility.assertGreaterEqual(counters["benchmark.http_2xx"], 5000)
    utility.assertEqual(counters["requestsource.internal.upstream_rq_200"], 4)
import time
from threading import Thread

from test.integration.common import IpVersion
from test.integration.integration_test_fixtures import (
    http_test_server_fixture, https_test_server_fixture, https_test_server_fixture,
    multi_http_test_server_fixture, multi_https_test_server_fixture, quic_test_server_fixture,
    server_config, server_config_quic)
from test.integration import asserts
from test.integration import utility

# TODO(oschaaf): we mostly verify stats observed from the client-side. Add expectations
# for the server side as well.


@pytest.mark.skipif(utility.isSanitizerRun(), reason="Unstable and very slow in sanitizer runs")
def test_http_h1(http_test_server_fixture):
  """Test http1 over plain http.

  Runs the CLI configured to use plain HTTP/1 against our test server, and sanity
  checks statistics from both client and server.
  """
  parsed_json, _ = http_test_server_fixture.runNighthawkClient([
      http_test_server_fixture.getTestServerRootUri(), "--duration", "100",
      "--termination-predicate", "benchmark.http_2xx:24"
  ])
  counters = http_test_server_fixture.getNighthawkCounterMapFromJson(parsed_json)
  asserts.assertCounterEqual(counters, "benchmark.http_2xx", 25)
  asserts.assertCounterEqual(counters, "upstream_cx_rx_bytes_total", 3400)
  # It is possible that the # of upstream_cx > # of backend connections for H1
  # as new connections will spawn if the existing clients cannot keep up with the RPS.
예제 #6
0
import time
from threading import Thread

from test.integration.common import IpVersion
from test.integration.integration_test_fixtures import (
    http_test_server_fixture, https_test_server_fixture, https_test_server_fixture,
    multi_http_test_server_fixture, multi_https_test_server_fixture, quic_test_server_fixture,
    server_config, server_config_quic)
from test.integration import asserts
from test.integration import utility

# TODO(oschaaf): we mostly verify stats observed from the client-side. Add expectations
# for the server side as well.


@pytest.mark.skipif(utility.isSanitizerRun(), reason="Unstable and very slow in sanitizer runs")
def test_http_h1(http_test_server_fixture):
  """Test http1 over plain http.

  Runs the CLI configured to use plain HTTP/1 against our test server, and sanity
  checks statistics from both client and server.
  """
  parsed_json, _ = http_test_server_fixture.runNighthawkClient([
      http_test_server_fixture.getTestServerRootUri(), "--duration", "100",
      "--termination-predicate", "benchmark.http_2xx:24"
  ])
  counters = http_test_server_fixture.getNighthawkCounterMapFromJson(parsed_json)
  asserts.assertCounterEqual(counters, "benchmark.http_2xx", 25)
  asserts.assertCounterEqual(counters, "upstream_cx_http1_total", 1)
  asserts.assertCounterEqual(counters, "upstream_cx_rx_bytes_total", 3400)
  asserts.assertCounterEqual(counters, "upstream_cx_total", 1)