def test_launch_benchmark_validate_bad_model(mock_platform_util): """ Verifies that a bad model name fails """ launch_benchmark = LaunchBenchmark() args, _ = launch_benchmark.parse_args(example_req_args) args.model_name = "foo" with pytest.raises(ValueError) as e: launch_benchmark.run_docker_container(args) assert "No model was found for" in str(e)
def test_launch_benchmark_validate_model(mock_popen, mock_platform_util): """ Verifies that a valid model name passes validation and starts a docker container. """ launch_benchmark = LaunchBenchmark() args, _ = launch_benchmark.parse_args(example_req_args) args.model_name = "resnet50" launch_benchmark.run_docker_container(args) assert mock_popen.called args, kwargs = mock_popen.call_args assert "docker" == args[0][0] assert "run" == args[0][1]