def test_create_userdata_without_spotinst(self, **kwargs): """ create_userdata doesn't set 'spotinst' key """ config_dict = get_default_config_dict() aws = DiscoAWS(config=get_mock_config(config_dict), environment_name=TEST_ENV_NAME) user_data = aws.create_userdata(hostclass="mhcunittest", owner="unittestuser", is_spotinst=False) self.assertEqual(user_data["is_spotinst"], "0")
def test_create_userdata_without_spotinst(self, **kwargs): """ create_userdata doesn't set 'spotinst' key """ config_dict = get_default_config_dict() aws = DiscoAWS(config=get_mock_config(config_dict), environment_name=TEST_ENV_NAME) user_data = aws.create_userdata(hostclass="mhcunittest", owner="unittestuser", is_spotinst=False) self.assertEqual(user_data["is_spotinst"], "0")
def test_create_userdata_with_zookeeper(self, **kwargs): """ create_userdata sets 'zookeepers' key """ config_dict = get_default_config_dict() aws = DiscoAWS(config=get_mock_config(config_dict), environment_name=TEST_ENV_NAME) user_data = aws.create_userdata(hostclass="mhcunittest", owner="unittestuser") self.assertEqual(user_data["zookeepers"], "[\\\"mhczookeeper-{}.example.com:2181\\\"]".format( aws.vpc.environment_name))
def test_create_userdata_with_zookeeper(self, **kwargs): """ create_userdata sets 'zookeepers' key """ config_dict = get_default_config_dict() aws = DiscoAWS(config=get_mock_config(config_dict), environment_name=TEST_ENV_NAME) user_data = aws.create_userdata(hostclass="mhcunittest", owner="unittestuser") self.assertEqual(user_data["zookeepers"], "[\\\"mhczookeeper-{}.example.com:2181\\\"]".format( aws.vpc.environment_name))
def test_create_userdata_with_eip(self, **kwargs): """ create_userdata sets 'eip' key when an EIP is required """ config_dict = get_default_config_dict() eip = "54.201.250.76" config_dict["mhcunittest"]["eip"] = eip aws = DiscoAWS(config=get_mock_config(config_dict), environment_name=TEST_ENV_NAME) user_data = aws.create_userdata(hostclass="mhcunittest", owner="unittestuser") self.assertEqual(user_data["eip"], eip)
def test_create_userdata_with_eip(self, **kwargs): """ create_userdata sets 'eip' key when an EIP is required """ config_dict = get_default_config_dict() eip = "54.201.250.76" config_dict["mhcunittest"]["eip"] = eip aws = DiscoAWS(config=get_mock_config(config_dict), environment_name=TEST_ENV_NAME) user_data = aws.create_userdata(hostclass="mhcunittest", owner="unittestuser") self.assertEqual(user_data["eip"], eip)