def test_can_list_running_nodes_for_specified_env(self): provider = FileBackedNodeProvider() provider.start(None, 'dev', 'some_def') node_to_terminate = provider.start(None, 'dev', 'some_def') provider.shutdown(node_to_terminate.id()) provider.start(None, 'prod', 'some_def') dev_env = EnvironmentDefinition('dev', provider, service_definitions, None, all_credentials, 'some_def') nodes = dev_env.list_nodes() self.assertEqual(nodes.__len__(), 1)
def test_should_apply_settings_to_node(self): provider = FileBackedNodeProvider() node = provider.start(node_definition, 'dev', 'some_def') service_definition.apply_on(node, { 'settings' : { 'apache' : node.id() } }) fake_env = self.load_fake_env() assert fake_env[node.id()]['settings'] == { 'apache' : node.id() }
def test_should_list_created_nodes(self): fake_node_provider = FileBackedNodeProvider() node1 = fake_node_provider.start(NODE_DEFINITIONS['web_node'], 'dev', 'some_def') node2 = fake_node_provider.start(NODE_DEFINITIONS['web_node'], 'dev', 'some_def') self.assertIn(node1, fake_node_provider.list(None, lambda x: True)) self.assertIn(node2, fake_node_provider.list(None, lambda x: True))
def test_should_list_service_and_include_ports(self): fake_node_provider = FileBackedNodeProvider() node = fake_node_provider.start(NODE_DEFINITIONS['web_node'], 'dev', 'some_def') node.add_service_to_tags("test", [DynamicDictionary({'ports':[ 8080, 8081 ]})]) fake_env = self.load_fake_env() self.assertDictEqual(fake_env[node.id()]['services']['test'], {8080:8080, 8081:8081})
def test_should_terminate_node(self): provider = FileBackedNodeProvider() node = provider.start(NODE_DEFINITIONS['web_node'], 'dev', 'some_def') provider.shutdown(node.id()) fake_env = self.load_fake_env() assert fake_env[node.id()]['state'] == 'terminated'