Exemple #1
0
 def test_get_current_cluster_lb_ip(self):
     pipeline_data = {data_defs.APPLICATION_CLUSTER: 'stage'}
     cluster_data = mock_test_data.get_cluster_ip_response()
     step = GetDockerHostIp()
     lb_ip = step.get_current_cluster_lb_ip(cluster_data, pipeline_data)
     self.assertEqual(lb_ip, '10.28.21.30:2376')
     pipeline_data = {data_defs.APPLICATION_CLUSTER: 'doesnt-exist'}
     self.assertRaises(exceptions.DeploymentError, step.get_current_cluster_lb_ip,
                       cluster_data, pipeline_data)
 def test_verify_no_cluster_ip_env(self):
     step = LoadDockerHostIps()
     cluster_data = mock_test_data.get_cluster_ip_response()
     try:
         if os.environ[environment.CLUSTERS_TO_DEPLOY]:
             del os.environ[environment.CLUSTERS_TO_DEPLOY]
         result = step.verify_cluster_to_deploy_has_ip(cluster_data)
         self.assertEqual(result, [])
     except Exception:
         self.fail('Shouldnt happen')        
Exemple #3
0
 def test_get_current_cluster_status(self):
     pipeline_data = {data_defs.APPLICATION_CLUSTER: 'stage'}
     cluster_data = mock_test_data.get_cluster_ip_response()
     step = GetDockerHostIp()
     lb_status = step.get_current_cluster_status(cluster_data, pipeline_data)
     self.assertEqual(lb_status, 'stage')
     pipeline_data = {data_defs.APPLICATION_CLUSTER: 'test'}
     lb_status = step.get_current_cluster_status(cluster_data, pipeline_data)
     self.assertEqual(lb_status, 'preparing-test')
     pipeline_data = {data_defs.APPLICATION_CLUSTER: 'nope'}
     lb_status = step.get_current_cluster_status(cluster_data, pipeline_data)
     self.assertIsNone(lb_status)
Exemple #4
0
def mock_clusters():
    return jsonify(mock_test_data.get_cluster_ip_response())
 def test_verify_cluster_has_ip(self):
     step = LoadDockerHostIps()
     cluster_data = mock_test_data.get_cluster_ip_response()
     os.environ[environment.CLUSTERS_TO_DEPLOY] = 'stage'
     result = step.verify_cluster_to_deploy_has_ip(cluster_data)
     self.assertEqual(result, ['stage'])