diff options
author | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2016-05-10 20:57:30 +0200 |
---|---|---|
committer | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2016-05-10 20:57:30 +0200 |
commit | 904aeedf343af17ef88bbbaef9896d425eefa778 (patch) | |
tree | 63cccc2c2853a1b7d5188e03003f072c0018c5a9 /tests/unittests/test_handler | |
parent | 66f847f4cba2215490986ffede8e03299dbd5b90 (diff) | |
download | vyos-cloud-init-904aeedf343af17ef88bbbaef9896d425eefa778.tar.gz vyos-cloud-init-904aeedf343af17ef88bbbaef9896d425eefa778.zip |
provide valid matcher for ppa so that apt-add-repository is triggered
Diffstat (limited to 'tests/unittests/test_handler')
-rw-r--r-- | tests/unittests/test_handler/test_handler_apt_source.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/unittests/test_handler/test_handler_apt_source.py b/tests/unittests/test_handler/test_handler_apt_source.py index d9942901..10a03a8d 100644 --- a/tests/unittests/test_handler/test_handler_apt_source.py +++ b/tests/unittests/test_handler/test_handler_apt_source.py @@ -144,14 +144,21 @@ class TestAptSourceConfig(TestCase): cfg = {'source': 'ppa:smoser/cloud-init-test', 'filename': self.aptlistfile} - cc_apt_configure.add_sources([cfg], params) + # default matcher needed for ppa + matcher = re.compile(r'^[\w-]+:\w').search - self.assertTrue(os.path.isfile(self.aptlistfile)) + cc_apt_configure.add_sources([cfg], params, aa_repo_match=matcher) - # report content before making regex - # FAIL ? goes in "untranslated" - # should become e.g. deb http://ppa.launchpad.net/smoser/cloud-init-test/ubuntu xenial main - contents = load_tfile_or_url(self.aptlistfile) + # adding ppa should ignore filename (uses add-apt-repository) + self.assertFalse(os.path.isfile(self.aptlistfile)) + expected_sources_fn=('/etc/apt/sources.list.d/' + 'smoser-ubuntu-cloud-init-test-%s.list' + % params['RELEASE']) + print("filename: %s" % expected_sources_fn) + self.assertTrue(os.path.isfile(expected_sources_fn)) + + # file gets not created, might be permission or env detail + contents = load_tfile_or_url(expected_sources_fn) print(contents) self.assertTrue(1 == 2) |