def test_no_resource_dir_specified(monkeypatch): mock_create = Mock() monkeypatch.setattr(kubernetes_tools, 'create', mock_create) flow = Flow(name='test-flow', port_expose=8080, infrastructure='K8S', protocol='http').add(name='test_executor') flow.start() for call in mock_create.call_args_list: assert ('custom_resource_dir' not in call[1] or call[1]['custom_resource_dir'] is None)
def test_custom_resource_dir(monkeypatch): mock_create = Mock() monkeypatch.setattr(kubernetes_tools, 'create', mock_create) custom_resource_dir = '/test' flow = Flow(name='test-flow', port_expose=8080, infrastructure='K8S', protocol='http').add( name='test_executor', k8s_custom_resource_dir=custom_resource_dir) flow.start() # first three calls are for the executor the rest are calls for the gateway for call in mock_create.call_args_list[:3]: assert call[1]['custom_resource_dir'] == custom_resource_dir