Exemple #1
0
 def test_bastion(self):
     vpc_cfg = deepcopy(vpc_0_0_1_cfg)
     vpc_cfg["bastion"] = bastion
     vpc_obj_bastion = deepcopy(vpc_object)
     vpc_obj_bastion.bastion = deepcopy(bastion_object)
     with patch("domino_cdk.config.util.log.warning") as warn:
         VPC.from_0_0_1(vpc_cfg)
         warn.assert_not_called()
Exemple #2
0
 def test_bastion_user_data_no_ami(self):
     vpc_cfg = deepcopy(vpc_0_0_1_cfg)
     vpc_cfg["bastion"]["enabled"] = True
     vpc_cfg["bastion"]["machine_image"] = {
         "ami_id": None,
         "user_data": "some-user-data"
     }
     with self.assertRaisesRegex(
             ValueError,
             "Bastion instance with user_data requires an ami_id!"):
         VPC.from_0_0_1(vpc_cfg)
Exemple #3
0
 def test_too_few_azs(self):
     vpc_cfg = deepcopy(vpc_0_0_1_cfg)
     vpc_cfg["max_azs"] = 1
     with self.assertRaisesRegex(
             ValueError, "Must use at least two availability zones"):
         VPC.from_0_0_1(vpc_cfg)
Exemple #4
0
 def test_no_create_no_existing_vpc(self):
     vpc_cfg = deepcopy(vpc_0_0_1_cfg)
     vpc_cfg["create"] = False
     with self.assertRaisesRegex(ValueError, "Cannot provision into a VPC"):
         VPC.from_0_0_1(vpc_cfg)
Exemple #5
0
 def test_oldest_newest_loaders_identical_result(self):
     vpc_old = VPC.from_0_0_0(deepcopy(vpc_0_0_0_cfg))
     vpc_new = VPC.from_0_0_1(deepcopy(vpc_0_0_1_cfg))
     self.assertEqual(vpc_old, vpc_new)
Exemple #6
0
 def test_from_0_0_1_wrong_schema(self):
     with self.assertRaisesRegex(KeyError, "bastion"):
         VPC.from_0_0_1(deepcopy(vpc_0_0_0_cfg))
Exemple #7
0
 def test_from_0_0_1(self):
     with patch("domino_cdk.config.util.log.warning") as warn:
         vpc = VPC.from_0_0_1(deepcopy(vpc_0_0_1_cfg))
         warn.assert_not_called()
         self.assertEqual(vpc, vpc_object)