コード例 #1
0
def test_https_h1(https_test_server_fixture):
    """
  Runs the CLI configured to use HTTP/1 over https against our test server, and sanity
  checks statistics from both client and server.
  """
    parsed_json, _ = https_test_server_fixture.runNighthawkClient([
        https_test_server_fixture.getTestServerRootUri(), "--connections", "1",
        "--rps", "100", "--duration", "100", "--termination-predicate",
        "benchmark.http_2xx:24"
    ])
    counters = https_test_server_fixture.getNighthawkCounterMapFromJson(
        parsed_json)
    assertCounterEqual(counters, "benchmark.http_2xx", 25)
    assertCounterEqual(counters, "upstream_cx_http1_total", 1)
    assertCounterEqual(counters, "upstream_cx_rx_bytes_total", 3400)
    assertCounterEqual(counters, "upstream_cx_total", 1)
    assertCounterEqual(
        counters, "upstream_cx_tx_bytes_total", 1400
        if https_test_server_fixture.ip_version == IpVersion.IPV6 else 1500)
    assertCounterEqual(counters, "upstream_rq_pending_total", 1)
    assertCounterEqual(counters, "upstream_rq_total", 25)
    assertCounterEqual(counters, "ssl.ciphers.ECDHE-RSA-AES128-GCM-SHA256", 1)
    assertCounterEqual(counters, "ssl.curves.X25519", 1)
    assertCounterEqual(counters, "ssl.handshake", 1)
    assertCounterEqual(counters, "ssl.sigalgs.rsa_pss_rsae_sha256", 1)
    assertCounterEqual(counters, "ssl.versions.TLSv1.2", 1)
    assertCounterEqual(counters, "default.total_match_count", 1)
    assertEqual(len(counters), 17)

    server_stats = https_test_server_fixture.getTestServerStatisticsJson()
    assertEqual(
        https_test_server_fixture.getServerStatFromJson(
            server_stats, "http.ingress_http.downstream_rq_2xx"), 25)
コード例 #2
0
def test_https_h1(https_test_server_fixture):
  """Test h1 over https.

  Runs the CLI configured to use HTTP/1 over https against our test server, and sanity
  checks statistics from both client and server.
  """
  parsed_json, _ = https_test_server_fixture.runNighthawkClient([
      https_test_server_fixture.getTestServerRootUri(), "--connections", "1", "--rps", "100",
      "--duration", "100", "--termination-predicate", "benchmark.http_2xx:24"
  ])
  counters = https_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.
  asserts.assertCounterGreaterEqual(counters, "upstream_cx_http1_total", 1)
  asserts.assertCounterGreaterEqual(counters, "upstream_cx_total", 1)
  asserts.assertCounterGreaterEqual(counters, "upstream_cx_tx_bytes_total", 500)
  asserts.assertCounterGreaterEqual(counters, "upstream_rq_pending_total", 1)
  asserts.assertCounterEqual(counters, "upstream_rq_total", 25)
  asserts.assertCounterEqual(counters, "ssl.ciphers.ECDHE-RSA-AES128-GCM-SHA256", 1)
  asserts.assertCounterEqual(counters, "ssl.curves.X25519", 1)
  asserts.assertCounterEqual(counters, "ssl.handshake", 1)
  asserts.assertCounterEqual(counters, "ssl.sigalgs.rsa_pss_rsae_sha256", 1)
  asserts.assertCounterEqual(counters, "ssl.versions.TLSv1.2", 1)
  asserts.assertCounterEqual(counters, "default.total_match_count", 1)
  asserts.assertEqual(len(counters), 17)

  server_stats = https_test_server_fixture.getTestServerStatisticsJson()
  asserts.assertEqual(
      https_test_server_fixture.getServerStatFromJson(server_stats,
                                                      "http.ingress_http.downstream_rq_2xx"), 25)