def test(self, mock_srv, mock_get_clusternames_from_deploy_stanza): service_stanza = {"foo": "bar"} smartstack_stanza = {"stack": "smrt"} monitoring_stanza = {"team": "homer"} deploy_stanza = {"otto": "dude"} marathon_stanza = {"springfield": "2015-04-20"} clusternames = set([ "flanders", "van-houten", "wiggum", ]) mock_get_clusternames_from_deploy_stanza.return_value = clusternames fsm.write_paasta_config( mock_srv, service_stanza, smartstack_stanza, monitoring_stanza, deploy_stanza, marathon_stanza, ) mock_srv.io.write_file.assert_any_call( "smartstack.yaml", _yamlize(smartstack_stanza), ) mock_srv.io.write_file.assert_any_call( "service.yaml", _yamlize(service_stanza), ) mock_srv.io.write_file.assert_any_call( "monitoring.yaml", _yamlize(monitoring_stanza), ) mock_srv.io.write_file.assert_any_call( "deploy.yaml", _yamlize(deploy_stanza), ) mock_srv.io.write_file.assert_any_call( "marathon-SHARED.yaml", _yamlize(marathon_stanza), ) for clustername in clusternames: mock_srv.io.symlink_file_relative.assert_any_call( "marathon-SHARED.yaml", "marathon-%s.yaml" % clustername, )
def test(self, mock_srv, test_paasta_config): service_stanza = {'foo': 'bar'} smartstack_stanza = {'stack': 'smrt'} monitoring_stanza = {'team': 'homer'} deploy_stanza = {'otto': 'dude'} marathon_stanza = ( (('DEV', '2015-04-20')), (('STAGE', '2015-04-20')), (('PROD', '2015-04-20')), ) fsm.write_paasta_config( mock_srv, service_stanza, smartstack_stanza, monitoring_stanza, deploy_stanza, marathon_stanza, test_paasta_config.get_fsm_cluster_map(), ) mock_srv.io.write_file.assert_any_call( 'smartstack.yaml', _yamlize(smartstack_stanza), ) mock_srv.io.write_file.assert_any_call( 'service.yaml', _yamlize(service_stanza), ) mock_srv.io.write_file.assert_any_call( 'monitoring.yaml', _yamlize(monitoring_stanza), ) mock_srv.io.write_file.assert_any_call( 'deploy.yaml', _yamlize(deploy_stanza), ) for (filename, stanza) in marathon_stanza: mock_srv.io.write_file.assert_any_call( 'marathon-%s.yaml' % filename, _yamlize(stanza), ) for (clustername, filename) in test_paasta_config.get_fsm_cluster_map().items(): mock_srv.io.symlink_file_relative.assert_any_call( 'marathon-%s.yaml' % filename, 'marathon-%s.yaml' % clustername, )
def write_paasta_config( srv, service_stanza, smartstack_stanza, monitoring_stanza, deploy_stanza, marathon_stanza, ): srv.io.write_file("service.yaml", _yamlize(service_stanza)) srv.io.write_file("smartstack.yaml", _yamlize(smartstack_stanza)) srv.io.write_file("monitoring.yaml", _yamlize(monitoring_stanza)) srv.io.write_file("deploy.yaml", _yamlize(deploy_stanza)) srv.io.write_file("marathon-SHARED.yaml", _yamlize(marathon_stanza)) for clustername in get_clusternames_from_deploy_stanza(deploy_stanza): srv.io.symlink_file_relative("marathon-SHARED.yaml", "marathon-%s.yaml" % clustername)
def write_paasta_config( srv, service_stanza, smartstack_stanza, monitoring_stanza, deploy_stanza, marathon_stanza, cluster_map, ): srv.io.write_file("service.yaml", _yamlize(service_stanza)) srv.io.write_file("smartstack.yaml", _yamlize(smartstack_stanza)) srv.io.write_file("monitoring.yaml", _yamlize(monitoring_stanza)) srv.io.write_file("deploy.yaml", _yamlize(deploy_stanza)) for (filename, marathon_config_stanza) in marathon_stanza: srv.io.write_file("marathon-%s.yaml" % filename, _yamlize(marathon_config_stanza)) for (clustername, filename) in cluster_map.items(): srv.io.symlink_file_relative("marathon-%s.yaml" % filename, "marathon-%s.yaml" % clustername)