def test_kubernetes_client( k8s_dispatcher: KubernetesDispatcher, benchmark_event_dummy_payload: BenchmarkEvent, k8s_test_client: KubernetesTestUtilsClient, fetcher_job_config: FetcherJobConfig, size_info: ContentSizeInfo, ): data_set = DownloadableContent(src=SOMEDATA_BIG, path="/mount/path", dst=S3_DST, md5=None, size_info=size_info) k8s_dispatcher.dispatch_fetch(data_set, benchmark_event_dummy_payload, "/data/sets/fake") _wait_for_k8s_objects_exist(benchmark_event_dummy_payload, fetcher_job_config, k8s_test_client, size_info)
def test_call_dispatcher( k8s_dispatcher: KubernetesDispatcher, mock_batch_api_instance: kubernetes.client.BatchV1Api, mock_core_api_instance: kubernetes.client.CoreV1Api, mock_k8s_config, data_set: DownloadableContent, size_info: ContentSizeInfo, ): data_set_with_size = dataclasses.replace(data_set, size_info=size_info) k8s_dispatcher.dispatch_fetch(data_set_with_size, BENCHMARK_EVENT, ZK_NODE_PATH) mock_batch_api_instance.create_namespaced_job.assert_called_once() job_args, _ = mock_batch_api_instance.create_namespaced_job.call_args namespace, job = job_args validate_namespaced_job(namespace, job, data_set)
def test_call_dispatcher_no_size_infodef(k8s_dispatcher: KubernetesDispatcher): with pytest.raises(ValueError): k8s_dispatcher.dispatch_fetch(DATA_SET, BENCHMARK_EVENT, ZK_NODE_PATH)