def test_report_status_obeys_cluster_whitelist( mock_stdout, mock_report_invalid_whitelist_values, mock_report_status_for_cluster, ): service = 'fake_service' cluster_whitelist = ['cluster1'] instance_whitelist = [] deploy_pipeline = actual_deployments = [ 'cluster1.main', 'cluster2.main', 'cluster3.main' ] report_status( service=service, deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, cluster_whitelist=cluster_whitelist, instance_whitelist=instance_whitelist, ) mock_report_invalid_whitelist_values.assert_called_once_with( cluster_whitelist, ['cluster1', 'cluster2', 'cluster3'], 'cluster') mock_report_status_for_cluster.assert_called_once_with( service=service, cluster='cluster1', deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, verbose=0)
def test_report_status_obeys_cluster_whitelist( mock_stdout, mock_report_invalid_whitelist_values, mock_report_status_for_cluster ): service = "fake_service" cluster_whitelist = ["cluster1"] instance_whitelist = [] deploy_pipeline = actual_deployments = ["cluster1.main", "cluster2.main", "cluster3.main"] report_status( service=service, deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, cluster_whitelist=cluster_whitelist, instance_whitelist=instance_whitelist, ) mock_report_invalid_whitelist_values.assert_called_once_with( cluster_whitelist, ["cluster1", "cluster2", "cluster3"], "cluster" ) mock_report_status_for_cluster.assert_called_once_with( service=service, cluster="cluster1", deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, verbose=0, )
def test_report_status_obeys_cluster_whitelist( mock_stdout, mock_report_invalid_whitelist_values, mock_report_status_for_cluster, ): service = 'fake_service' cluster_whitelist = ['cluster1'] instance_whitelist = [] deploy_pipeline = actual_deployments = [ 'cluster1.main', 'cluster2.main', 'cluster3.main'] report_status( service=service, deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, cluster_whitelist=cluster_whitelist, instance_whitelist=instance_whitelist, ) mock_report_invalid_whitelist_values.assert_called_once_with( cluster_whitelist, ['cluster1', 'cluster2', 'cluster3'], 'cluster') mock_report_status_for_cluster.assert_called_once_with( service=service, cluster='cluster1', deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, verbose=False )
def test_report_status_obeys_cluster_whitelist( mock_stdout, mock_report_invalid_whitelist_values, mock_report_status_for_cluster, ): service = 'fake_service' cluster_whitelist = ['cluster1'] instance_whitelist = [] deploy_pipeline = actual_deployments = [ 'cluster1.main', 'cluster2.main', 'cluster3.main'] fake_system_paasta_config = utils.SystemPaastaConfig({}, '/fake/config') report_status( service=service, deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, cluster_whitelist=cluster_whitelist, instance_whitelist=instance_whitelist, system_paasta_config=fake_system_paasta_config, ) mock_report_invalid_whitelist_values.assert_called_once_with( cluster_whitelist, ['cluster1', 'cluster2', 'cluster3'], 'cluster') mock_report_status_for_cluster.assert_called_once_with( service=service, cluster='cluster1', deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, system_paasta_config=fake_system_paasta_config, verbose=0 )
def test_report_status_obeys_cluster_whitelist( mock_stdout, mock_report_invalid_whitelist_values, mock_report_status_for_cluster, ): service = 'fake_service' cluster_whitelist = ['cluster1'] instance_whitelist = [] deploy_pipeline = actual_deployments = [ 'cluster1.main', 'cluster2.main', 'cluster3.main' ] fake_system_paasta_config = utils.SystemPaastaConfig({}, '/fake/config') report_status( service=service, deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, cluster_whitelist=cluster_whitelist, instance_whitelist=instance_whitelist, system_paasta_config=fake_system_paasta_config, ) mock_report_invalid_whitelist_values.assert_called_once_with( cluster_whitelist, ['cluster1', 'cluster2', 'cluster3'], 'cluster') mock_report_status_for_cluster.assert_called_once_with( service=service, cluster='cluster1', deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, system_paasta_config=fake_system_paasta_config, verbose=0)
def test_report_status_handle_none_whitelist( mock_stdout, mock_report_invalid_whitelist_values, mock_report_status_for_cluster, ): service = 'fake_service' cluster_whitelist = [] instance_whitelist = [] deploy_pipeline = actual_deployments = [ 'cluster1.main', 'cluster2.main', 'cluster3.main'] fake_system_paasta_config = utils.SystemPaastaConfig({}, '/fake/config') report_status( service=service, deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, cluster_whitelist=cluster_whitelist, instance_whitelist=instance_whitelist, system_paasta_config=fake_system_paasta_config, ) mock_report_status_for_cluster.assert_any_call( service=service, cluster='cluster1', deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, system_paasta_config=fake_system_paasta_config, verbose=0, use_api_endpoint=False ) mock_report_status_for_cluster.assert_any_call( service=service, cluster='cluster2', deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, system_paasta_config=fake_system_paasta_config, verbose=0, use_api_endpoint=False ) mock_report_status_for_cluster.assert_any_call( service=service, cluster='cluster3', deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, system_paasta_config=fake_system_paasta_config, verbose=0, use_api_endpoint=False )
def test_report_status_returns_one_when_clusters_pass( mock_report_invalid_whitelist_values, mock_report_status_for_cluster, capfd, ): service = 'fake_service' cluster_whitelist = [] instance_whitelist = [] deploy_pipeline = actual_deployments = [ 'cluster1.main', 'cluster2.main', 'cluster3.main' ] fake_system_paasta_config = utils.SystemPaastaConfig({}, '/fake/config') mock_report_status_for_cluster.side_effect = [0, 0, 255] return_value = report_status( service=service, deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, cluster_whitelist=cluster_whitelist, instance_whitelist=instance_whitelist, system_paasta_config=fake_system_paasta_config, ) assert return_value == 1 assert mock_report_status_for_cluster.call_count == 3
def test_report_status_handle_none_whitelist( mock_stdout, mock_report_invalid_whitelist_values, mock_report_status_for_cluster, ): service = 'fake_service' cluster_whitelist = [] instance_whitelist = [] deploy_pipeline = actual_deployments = [ 'cluster1.main', 'cluster2.main', 'cluster3.main'] report_status( service=service, deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, cluster_whitelist=cluster_whitelist, instance_whitelist=instance_whitelist, ) mock_report_status_for_cluster.assert_any_call( service=service, cluster='cluster1', deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, verbose=False ) mock_report_status_for_cluster.assert_any_call( service=service, cluster='cluster2', deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, verbose=False ) mock_report_status_for_cluster.assert_any_call( service=service, cluster='cluster3', deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, verbose=False )
def test_report_status_handle_none_whitelist( mock_stdout, mock_report_invalid_whitelist_values, mock_report_status_for_cluster ): service = "fake_service" cluster_whitelist = [] instance_whitelist = [] deploy_pipeline = actual_deployments = ["cluster1.main", "cluster2.main", "cluster3.main"] report_status( service=service, deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, cluster_whitelist=cluster_whitelist, instance_whitelist=instance_whitelist, ) mock_report_status_for_cluster.assert_any_call( service=service, cluster="cluster1", deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, verbose=0, ) mock_report_status_for_cluster.assert_any_call( service=service, cluster="cluster2", deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, verbose=0, ) mock_report_status_for_cluster.assert_any_call( service=service, cluster="cluster3", deploy_pipeline=deploy_pipeline, actual_deployments=actual_deployments, instance_whitelist=instance_whitelist, verbose=0, )