summaryrefslogtreecommitdiff
path: root/tests/unittests/cmd
diff options
context:
space:
mode:
authorBrett Holman <bholman.devel@gmail.com>2021-12-06 15:27:12 -0700
committerGitHub <noreply@github.com>2021-12-06 15:27:12 -0700
commitbedac77e9348e7a54c0ec364fb61df90cd893972 (patch)
tree73a0ddaada5ceb256e22c053fec50db82671d14c /tests/unittests/cmd
parentf428ed1611bdb685598832dd42495f0bcda40ec4 (diff)
downloadvyos-cloud-init-bedac77e9348e7a54c0ec364fb61df90cd893972.tar.gz
vyos-cloud-init-bedac77e9348e7a54c0ec364fb61df90cd893972.zip
Add Strict Metaschema Validation (#1101)
Improve schema validation. This adds strict validation of config module definitions at testing time, with plumbing included for future runtime validation. This eliminates a class of bugs resulting from schemas that have definitions that are incorrect, but get interpreted by jsonschema as "additionalProperties" that are therefore ignored. - Add strict meta-schema for jsonschema unit test validation - Separate schema from module metadata structure - Improve type annotations for various functions and data types Cleanup: - Remove unused jsonschema "required" elements - Eliminate manual memoization in schema.py:get_schema(), reference module.__doc__ directly
Diffstat (limited to 'tests/unittests/cmd')
-rw-r--r--tests/unittests/cmd/test_clean.py2
-rw-r--r--tests/unittests/cmd/test_cloud_id.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/unittests/cmd/test_clean.py b/tests/unittests/cmd/test_clean.py
index 81fc930e..3bb0ee9b 100644
--- a/tests/unittests/cmd/test_clean.py
+++ b/tests/unittests/cmd/test_clean.py
@@ -137,7 +137,7 @@ class TestClean(CiTestCase):
clean.remove_artifacts, remove_logs=False)
self.assertEqual(1, retcode)
self.assertEqual(
- 'ERROR: Could not remove %s/dir1: oops\n' % self.artifact_dir,
+ 'Error:\nCould not remove %s/dir1: oops\n' % self.artifact_dir,
m_stderr.getvalue())
def test_handle_clean_args_reboots(self):
diff --git a/tests/unittests/cmd/test_cloud_id.py b/tests/unittests/cmd/test_cloud_id.py
index 12fc80e8..9a010402 100644
--- a/tests/unittests/cmd/test_cloud_id.py
+++ b/tests/unittests/cmd/test_cloud_id.py
@@ -51,7 +51,7 @@ class TestCloudId(CiTestCase):
cloud_id.main()
self.assertEqual(1, context_manager.exception.code)
self.assertIn(
- "ERROR: File not found '%s'" % self.instance_data,
+ "Error:\nFile not found '%s'" % self.instance_data,
m_stderr.getvalue())
def test_cloud_id_non_json_instance_data(self):
@@ -64,7 +64,7 @@ class TestCloudId(CiTestCase):
cloud_id.main()
self.assertEqual(1, context_manager.exception.code)
self.assertIn(
- "ERROR: File '%s' is not valid json." % self.instance_data,
+ "Error:\nFile '%s' is not valid json." % self.instance_data,
m_stderr.getvalue())
def test_cloud_id_from_cloud_name_in_instance_data(self):