summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Dobrawy <naczelnik@jawnosc.tk>2019-12-17 17:09:22 +0100
committerDaniel Watkins <daniel@daniel-watkins.co.uk>2019-12-18 09:53:49 -0500
commite03c71aed91cbcbfb37cfadbf63b21a2d7e61a52 (patch)
tree92c94439f0a7d6eccbf444d27f2bba0caadaf860
parent6cb2f73146aa911f77171ad2108701ea969fde54 (diff)
downloadvyos-cloud-init-e03c71aed91cbcbfb37cfadbf63b21a2d7e61a52.tar.gz
vyos-cloud-init-e03c71aed91cbcbfb37cfadbf63b21a2d7e61a52.zip
tests: Add tests for value of dsname in datasources
-rw-r--r--tests/unittests/test_datasource/test_common.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/unittests/test_datasource/test_common.py b/tests/unittests/test_datasource/test_common.py
index 61a7a762..4ab5d471 100644
--- a/tests/unittests/test_datasource/test_common.py
+++ b/tests/unittests/test_datasource/test_common.py
@@ -4,6 +4,7 @@ from cloudinit import settings
from cloudinit import sources
from cloudinit import type_utils
from cloudinit.sources import (
+ DataSource,
DataSourceAliYun as AliYun,
DataSourceAltCloud as AltCloud,
DataSourceAzure as Azure,
@@ -23,6 +24,7 @@ from cloudinit.sources import (
DataSourceOpenStack as OpenStack,
DataSourceOracle as Oracle,
DataSourceOVF as OVF,
+ DataSourceRbxCloud as RbxCloud,
DataSourceScaleway as Scaleway,
DataSourceSmartOS as SmartOS,
)
@@ -44,6 +46,7 @@ DEFAULT_LOCAL = [
SmartOS.DataSourceSmartOS,
Ec2.DataSourceEc2Local,
OpenStack.DataSourceOpenStackLocal,
+ RbxCloud.DataSourceRbxCloud,
Scaleway.DataSourceScaleway,
]
@@ -86,7 +89,6 @@ class ExpectedDataSources(test_helpers.TestCase):
class TestDataSourceInvariants(test_helpers.TestCase):
-
def test_data_sources_have_valid_network_config_sources(self):
for ds in DEFAULT_LOCAL + DEFAULT_NETWORK:
for cfg_src in ds.network_config_sources:
@@ -95,5 +97,14 @@ class TestDataSourceInvariants(test_helpers.TestCase):
self.assertTrue(hasattr(sources.NetworkConfigSource, cfg_src),
fail_msg)
+ def test_expected_dsname_defined(self):
+ for ds in DEFAULT_LOCAL + DEFAULT_NETWORK:
+ fail_msg = (
+ '{} has an invalid / missing dsname property: {}'.format(
+ str(ds), str(ds.dsname)
+ )
+ )
+ self.assertNotEqual(ds.dsname, DataSource.dsname, fail_msg)
+ self.assertIsNotNone(ds.dsname)
# vi: ts=4 expandtab