summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/testcases
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2018-10-07 19:31:50 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-10-07 19:31:50 +0000
commit638f09e82260ea3256c387cd55408e0411f36c23 (patch)
tree210bda0ef777e382290e15e8f432cf2e7290488d /tests/cloud_tests/testcases
parentd3e803ad316e6796e5d83e7e8f8f4f7224b92df9 (diff)
downloadvyos-cloud-init-638f09e82260ea3256c387cd55408e0411f36c23.tar.gz
vyos-cloud-init-638f09e82260ea3256c387cd55408e0411f36c23.zip
tests: fix apt_configure_primary to be more flexible
Commit d3e803ad316e6796e5d83e7e8f8f4f7224b92df9 added deb-src comments to the cloud-init apt templates. This doubled the number of matching entries seen in /etc/apt/sources.list in apt_configure_primary integration test. This test was really asserting that GaTech urls were present in /etc//apt/sources.list instead of archive.ubuntu.com. Fix the test to be a bit more flexible in case cloud-init changes its bas apt template again.
Diffstat (limited to 'tests/cloud_tests/testcases')
-rw-r--r--tests/cloud_tests/testcases/modules/apt_configure_primary.py14
-rw-r--r--tests/cloud_tests/testcases/modules/apt_configure_primary.yaml7
2 files changed, 9 insertions, 12 deletions
diff --git a/tests/cloud_tests/testcases/modules/apt_configure_primary.py b/tests/cloud_tests/testcases/modules/apt_configure_primary.py
index c1c4bbc0..4950a2ef 100644
--- a/tests/cloud_tests/testcases/modules/apt_configure_primary.py
+++ b/tests/cloud_tests/testcases/modules/apt_configure_primary.py
@@ -9,12 +9,16 @@ class TestAptconfigurePrimary(base.CloudTestCase):
def test_ubuntu_sources(self):
"""Test no default Ubuntu entries exist."""
- out = self.get_data_file('ubuntu.sources.list')
- self.assertEqual(0, int(out))
+ out = self.get_data_file('sources.list')
+ ubuntu_source_count = len(
+ [line for line in out.split('\n') if 'archive.ubuntu.com' in line])
+ self.assertEqual(0, ubuntu_source_count)
def test_gatech_sources(self):
- """Test GaTech entires exist."""
- out = self.get_data_file('gatech.sources.list')
- self.assertEqual(20, int(out))
+ """Test GaTech entries exist."""
+ out = self.get_data_file('sources.list')
+ gatech_source_count = len(
+ [line for line in out.split('\n') if 'gtlib.gatech.edu' in line])
+ self.assertGreater(gatech_source_count, 0)
# vi: ts=4 expandtab
diff --git a/tests/cloud_tests/testcases/modules/apt_configure_primary.yaml b/tests/cloud_tests/testcases/modules/apt_configure_primary.yaml
index 41bcf2fd..cc067d4f 100644
--- a/tests/cloud_tests/testcases/modules/apt_configure_primary.yaml
+++ b/tests/cloud_tests/testcases/modules/apt_configure_primary.yaml
@@ -12,13 +12,6 @@ cloud_config: |
- default
uri: "http://www.gtlib.gatech.edu/pub/ubuntu-releases/"
collect_scripts:
- ubuntu.sources.list: |
- #!/bin/bash
- grep -v '^#' /etc/apt/sources.list | sed '/^\s*$/d' | grep -c archive.ubuntu.com
- gatech.sources.list: |
- #!/bin/bash
- grep -v '^#' /etc/apt/sources.list | sed '/^\s*$/d' | grep -c gtlib.gatech.edu
-
sources.list: |
#!/bin/bash
cat /etc/apt/sources.list