示例#1
0
def test_output_transform_101():
  """
  Runs an arbitrary load test, which outputs to json.
  This json output is then transformed to human readable output.
  """

  test_rundir = os.path.join(os.environ["TEST_SRCDIR"], os.environ["TEST_WORKSPACE"])
  process = subprocess.run([
      os.path.join(test_rundir, "nighthawk_client"), "--duration", "1", "--rps", "1", "127.0.0.1",
      "--output-format", "json"
  ],
                           stdout=subprocess.PIPE)
  output = process.stdout
  process = subprocess.run(
      [os.path.join(test_rundir, "nighthawk_output_transform"), "--output-format", "human"],
      stdout=subprocess.PIPE,
      input=output)
  utility.assertEqual(process.returncode, 0)
  utility.assertIn("Nighthawk - A layer 7 protocol benchmarking tool",
                   process.stdout.decode("utf-8"))
示例#2
0
def test_grpc_service_nonexisting_listener_address():
    (exit_code, output) = _run_service_with_args("--listen 1.1.1.1:1")
    utility.assertEqual(exit_code, 1)
    utility.assertIn("Failure: Could not start the grpc service", output)
示例#3
0
def test_grpc_service_bad_arguments():
    (exit_code, output) = _run_service_with_args("--foo")
    utility.assertEqual(exit_code, 1)
    utility.assertIn("PARSE ERROR: Argument: --foo", output)
示例#4
0
def test_grpc_service_help():
    (exit_code, output) = _run_service_with_args("--help")
    utility.assertEqual(exit_code, 0)
    utility.assertIn("USAGE", output)
示例#5
0
def test_output_transform_bad_arguments():
  (exit_code, output) = _run_output_transform_with_args("--foo")
  utility.assertEqual(exit_code, 1)
  utility.assertIn("PARSE ERROR: Argument: --foo", output)
示例#6
0
def test_output_transform_help():
  (exit_code, output) = _run_output_transform_with_args("--help")
  utility.assertEqual(exit_code, 0)
  utility.assertIn("USAGE", output)