Merge ~smoser/cloud-init:bug/1645916-cloudsigma-local-ds into cloud-init:master

Proposed by Scott Moser
Status: Merged
Merged at revision: a9d41de47a58d967ae3fd6a7749f8143a14424d3
Proposed branch: ~smoser/cloud-init:bug/1645916-cloudsigma-local-ds
Merge into: cloud-init:master
Diff against target: 43 lines (+16/-1)
2 files modified
cloudinit/sources/DataSourceCloudSigma.py (+1/-1)
tests/unittests/test_datasource/test_cloudsigma.py (+15/-0)
Reviewer Review Type Date Requested Status
Louis Bouchard (community) Approve
cloud-init Commiters Pending
Review via email: mp+312732@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

Should we update the unittest to test this listing for each of our Datasources?

Revision history for this message
Louis Bouchard (louis) wrote :

lgtm. Local tests show that list_sources() now return the proper value. I do agree that the tests would benefit to be done on all datasources

review: Approve

Diff calculation failed

Calculating the branch diff failed. You can manually schedule an update if required.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/sources/DataSourceCloudSigma.py b/cloudinit/sources/DataSourceCloudSigma.py
2index be74503..448e2a4 100644
3--- a/cloudinit/sources/DataSourceCloudSigma.py
4+++ b/cloudinit/sources/DataSourceCloudSigma.py
5@@ -115,7 +115,7 @@ DataSourceCloudSigmaNet = DataSourceCloudSigma
6 # Used to match classes to dependencies. Since this datasource uses the serial
7 # port network is not really required, so it's okay to load without it, too.
8 datasources = [
9- (DataSourceCloudSigma, (sources.DEP_FILESYSTEM)),
10+ (DataSourceCloudSigma, (sources.DEP_FILESYSTEM, )),
11 ]
12
13
14diff --git a/tests/unittests/test_datasource/test_cloudsigma.py b/tests/unittests/test_datasource/test_cloudsigma.py
15index 2a42ce0..a1d59c6 100644
16--- a/tests/unittests/test_datasource/test_cloudsigma.py
17+++ b/tests/unittests/test_datasource/test_cloudsigma.py
18@@ -3,6 +3,7 @@
19 import copy
20
21 from cloudinit.cs_utils import Cepko
22+from cloudinit import sources
23 from cloudinit.sources import DataSourceCloudSigma
24
25 from .. import helpers as test_helpers
26@@ -97,3 +98,17 @@ class DataSourceCloudSigmaTest(test_helpers.TestCase):
27 self.datasource.get_data()
28
29 self.assertIsNone(self.datasource.vendordata_raw)
30+
31+
32+class DsLoads(test_helpers.TestCase):
33+ def test_get_datasource_list_returns_in_local(self):
34+ deps = (sources.DEP_FILESYSTEM,)
35+ ds_list = DataSourceCloudSigma.get_datasource_list(deps)
36+ self.assertEqual(ds_list,
37+ [DataSourceCloudSigma.DataSourceCloudSigma])
38+
39+ def test_list_sources_finds_ds(self):
40+ found = sources.list_sources(
41+ ['CloudSigma'], (sources.DEP_FILESYSTEM,), ['cloudinit.sources'])
42+ self.assertEqual([DataSourceCloudSigma.DataSourceCloudSigma],
43+ found)

Subscribers

People subscribed via source and target branches