summaryrefslogtreecommitdiff
path: root/tests/unittests/config/test_schema.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2022-01-31 20:45:29 -0700
committerGitHub <noreply@github.com>2022-01-31 20:45:29 -0700
commitaf7eb1deab12c7208853c5d18b55228e0ba29c4d (patch)
treedb4f4b836a972f72aa4fdddf3840c136bc1abb57 /tests/unittests/config/test_schema.py
parent46a0126e874927353e83b385b58ab054e58667cc (diff)
downloadvyos-cloud-init-af7eb1deab12c7208853c5d18b55228e0ba29c4d.tar.gz
vyos-cloud-init-af7eb1deab12c7208853c5d18b55228e0ba29c4d.zip
Schema a d (#1211)
Migrate from legacy schema or define new schema in cloud-init-schema.json, adding extensive schema tests for: - cc_apt_configure - cc_bootcmd - cc_byobu - cc_ca_certs - cc_chef - cc_debug - cc_disable_ec2_metadata - cc_disk_setup Deprecate config hyphenated schema keys in favor of underscores: - ca_certs and ca_certs.remove_defaults instead of ca-certs and ca-certs.remove-defaults - Continue to honor deprecated config keys but emit DEPRECATION warnings in logs for continued use of the deprecated keys: - apt_sources key - any apt v1 or v2 keys - use or ca-certs or ca_certs.remove-defaults - Extend apt_configure schema - Define more strict schema below object opaque keys using patternProperties - create common $def apt_configure.mirror for reuse in 'primary' and 'security' schema definitions within cc_apt_configure Co-Authored-by: James Falcon <james.falcon@canonical.com>
Diffstat (limited to 'tests/unittests/config/test_schema.py')
-rw-r--r--tests/unittests/config/test_schema.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/tests/unittests/config/test_schema.py b/tests/unittests/config/test_schema.py
index 1647f6e5..2f43d9e7 100644
--- a/tests/unittests/config/test_schema.py
+++ b/tests/unittests/config/test_schema.py
@@ -91,6 +91,13 @@ class TestGetSchema:
"cc_apt_configure",
"cc_apt_pipelining",
"cc_bootcmd",
+ "cc_byobu",
+ "cc_ca_certs",
+ "cc_chef",
+ "cc_debug",
+ "cc_disable_ec2_metadata",
+ "cc_disk_setup",
+ "cc_install_hotplug",
"cc_keyboard",
"cc_locale",
"cc_ntp",
@@ -101,8 +108,6 @@ class TestGetSchema:
"cc_ubuntu_drivers",
"cc_write_files",
"cc_zypper_add_repo",
- "cc_chef",
- "cc_install_hotplug",
]
) == sorted(
[meta["id"] for meta in get_metas().values() if meta is not None]
@@ -112,7 +117,15 @@ class TestGetSchema:
# New style schema should be defined in static schema file in $defs
expected_subschema_defs = [
{"$ref": "#/$defs/cc_apk_configure"},
+ {"$ref": "#/$defs/cc_apt_configure"},
{"$ref": "#/$defs/cc_apt_pipelining"},
+ {"$ref": "#/$defs/cc_bootcmd"},
+ {"$ref": "#/$defs/cc_byobu"},
+ {"$ref": "#/$defs/cc_ca_certs"},
+ {"$ref": "#/$defs/cc_chef"},
+ {"$ref": "#/$defs/cc_debug"},
+ {"$ref": "#/$defs/cc_disable_ec2_metadata"},
+ {"$ref": "#/$defs/cc_disk_setup"},
]
found_subschema_defs = []
legacy_schema_keys = []
@@ -125,9 +138,6 @@ class TestGetSchema:
assert expected_subschema_defs == found_subschema_defs
# This list will dwindle as we move legacy schema to new $defs
assert [
- "apt",
- "bootcmd",
- "chef",
"drivers",
"keyboard",
"locale",
@@ -153,7 +163,7 @@ class TestLoadDoc:
"module_name",
(
"cc_apt_pipelining", # new style composite schema file
- "cc_bootcmd", # legacy sub-schema defined in module
+ "cc_zypper_add_repo", # legacy sub-schema defined in module
),
)
def test_report_docs_for_legacy_and_consolidated_schema(self, module_name):