def test_managed_nodegroup_extra_args(self): test_group = { "disk_size": 20, "min_size": 1, "max_size": 1, "instance_types": ["t2.micro"], "labels": {}, "tags": {}, "spot": False, "desired_size": 1, } with patch("domino_cdk.config.util.log.warning") as warn: c = config_template().render() c["eks"]["managed_nodegroups"] = {"test_group": dict(test_group)} config_loader(dict(c)) warn.assert_not_called() with patch("domino_cdk.config.util.log.warning") as warn: c = config_template().render() c["eks"]["managed_nodegroups"] = {"test_group": dict(test_group)} c["eks"]["managed_nodegroups"]["test_group"]["extra_arg"] = "boing" config_loader(dict(c)) warn.assert_called_with( "Warning: Unused/unsupported managed nodegroup attribute in config.eks.unmanaged_nodegroups: ['extra_arg']" )
def test_invalid_version_syntax(self): c = config_template().render() suffixed_schema = f"{Version(c['schema']).truncate()}mysuffix0" c["schema"] = suffixed_schema with self.assertRaisesRegex( ValueError, f"Invalid version string: '{suffixed_schema}'"): config_loader(c)
env=core.Environment(region=cfg.aws_region, account=cfg.aws_account_id), cfg=cfg, nest=nest, ) app.synth() if __name__ == "__main__": if len(argv) > 1: if argv[1] == "generate_asset_parameters": print( json_dumps(DominoCdkUtil.generate_asset_parameters(*argv[2:]), indent=4)) elif argv[1] == "generate_terraform_bootstrap": print( json_dumps( DominoCdkUtil.generate_terraform_bootstrap(*argv[2:]), indent=4)) elif argv[1] == "generate_config_template": YAML().dump(config_template().render(*argv[2:]), stdout) # an arg disable comments else: print( "Valid utility commands are 'generate_asset_parameters', 'generate_terraform_bootstrap' and 'generate_config_template'. Otherwise, use cdk." ) exit(1) exit(0) main()
def test_version_with_suffix(self): c = config_template().render() suffixed_schema = f"{Version(__version__).truncate()}-mysuffix0" c["schema"] = suffixed_schema d = config_loader(c) self.assertEqual(d.schema, __version__)
def test_round_trip_template(self): c = config_template() d = config_loader(c.render()) self.assertEqual(c, d)
def test_default_template(self): c = config_template() self.assertEqual(c, default_config)