Merge ~smoser/cloud-init:fix/fix-schematests-without-json-schema into cloud-init:master

Proposed by Scott Moser
Status: Merged
Approved by: Scott Moser
Approved revision: dbe58456efca025f9bfba4f6b1d8a5450e2afdec
Merge reported by: Scott Moser
Merged at revision: 0c2f1ea29abc88957d21f56d432649989a8e4dfd
Proposed branch: ~smoser/cloud-init:fix/fix-schematests-without-json-schema
Merge into: cloud-init:master
Diff against target: 51 lines (+6/-2)
2 files modified
cloudinit/config/tests/test_snap.py (+4/-1)
cloudinit/config/tests/test_ubuntu_advantage.py (+2/-1)
Reviewer Review Type Date Requested Status
Chad Smith Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+341997@code.launchpad.net

Commit message

tests: Fix newly added schema unit tests to skip if no jsonschema.

The recently added snap and ubuntu_advantage modules had unit tests
that exercised jsonschema. Those throw error if jsonschema is
not present. Fix to skip in that scenario.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:ba3f6283a4e882516d8ef5dea793979a7629d00b
https://jenkins.ubuntu.com/server/job/cloud-init-ci/916/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/916/rebuild

review: Approve (continuous-integration)
Revision history for this message
Chad Smith (chad.smith) wrote :

Minor nit. thanks for fixing my breaks.

review: Approve
Revision history for this message
Scott Moser (smoser) wrote :

addressed and pushed.

Revision history for this message
Scott Moser (smoser) wrote :

An upstream commit landed for this bug.

To view that commit see the following URL:
https://git.launchpad.net/cloud-init/commit/?id=0c2f1ea2

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Update scan failed

At least one of the branches involved have failed to scan. You can manually schedule a rescan if required.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/config/tests/test_snap.py b/cloudinit/config/tests/test_snap.py
2index 988e7f7..c5b4a9d 100644
3--- a/cloudinit/config/tests/test_snap.py
4+++ b/cloudinit/config/tests/test_snap.py
5@@ -8,7 +8,8 @@ from cloudinit.config.cc_snap import (
6 run_commands, schema)
7 from cloudinit.config.schema import validate_cloudconfig_schema
8 from cloudinit import util
9-from cloudinit.tests.helpers import CiTestCase, mock, wrap_and_call
10+from cloudinit.tests.helpers import (
11+ CiTestCase, mock, wrap_and_call, skipUnlessJsonSchema)
12
13
14 SYSTEM_USER_ASSERTION = """\
15@@ -243,6 +244,7 @@ class TestRunCommands(CiTestCase):
16 self.assertEqual('MOM\nHI\n', util.load_file(outfile))
17
18
19+@skipUnlessJsonSchema()
20 class TestSchema(CiTestCase):
21
22 with_logs = True
23@@ -418,6 +420,7 @@ class TestHandle(CiTestCase):
24 util.load_file(compare_file), util.load_file(assert_file))
25
26 @mock.patch('cloudinit.config.cc_snap.util.subp')
27+ @skipUnlessJsonSchema()
28 def test_handle_validates_schema(self, m_subp):
29 """Any provided configuration is runs validate_cloudconfig_schema."""
30 assert_file = self.tmp_path('snapd.assertions', dir=self.tmp)
31diff --git a/cloudinit/config/tests/test_ubuntu_advantage.py b/cloudinit/config/tests/test_ubuntu_advantage.py
32index 0eeadd4..f2a59fa 100644
33--- a/cloudinit/config/tests/test_ubuntu_advantage.py
34+++ b/cloudinit/config/tests/test_ubuntu_advantage.py
35@@ -7,7 +7,7 @@ from cloudinit.config.cc_ubuntu_advantage import (
36 handle, maybe_install_ua_tools, run_commands, schema)
37 from cloudinit.config.schema import validate_cloudconfig_schema
38 from cloudinit import util
39-from cloudinit.tests.helpers import CiTestCase, mock
40+from cloudinit.tests.helpers import CiTestCase, mock, skipUnlessJsonSchema
41
42
43 # Module path used in mocks
44@@ -104,6 +104,7 @@ class TestRunCommands(CiTestCase):
45 self.assertEqual('MOM\nHI\n', util.load_file(outfile))
46
47
48+@skipUnlessJsonSchema()
49 class TestSchema(CiTestCase):
50
51 with_logs = True

Subscribers

People subscribed via source and target branches