← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~raharper/cloud-init:fix/cloud-test-apt-pipelining into cloud-init:master

 

Ryan Harper has proposed merging ~raharper/cloud-init:fix/cloud-test-apt-pipelining into cloud-init:master.

Commit message:
cloud_tests: fix apt_pipelining test-cases
    
The apt_pipelining test-cases were broken but until cloud-init
changed it's default behavior to not disable, these silently passed
as both only ever checked if pipelinging was disabled.
    
First, the tests used the 'apt' namespace, which is not for
configuring pipelining, rather that requires 'apt_pipelining'
 as the namespace.
    
Second, the 'os' variant needs to check that cloud-init does not
write a configuration file; it was a copy-and-paste error from the
disable test-case.
    
This branch fixes the config and collection to validate both
scenarios.


Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/365349
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~raharper/cloud-init:fix/cloud-test-apt-pipelining into cloud-init:master.
diff --git a/tests/cloud_tests/testcases/modules/apt_pipelining_disable.yaml b/tests/cloud_tests/testcases/modules/apt_pipelining_disable.yaml
index bd9b5d0..22a31dc 100644
--- a/tests/cloud_tests/testcases/modules/apt_pipelining_disable.yaml
+++ b/tests/cloud_tests/testcases/modules/apt_pipelining_disable.yaml
@@ -5,8 +5,7 @@ required_features:
   - apt
 cloud_config: |
   #cloud-config
-  apt:
-    apt_pipelining: false
+  apt_pipelining: false
 collect_scripts:
   90cloud-init-pipelining: |
     #!/bin/bash
diff --git a/tests/cloud_tests/testcases/modules/apt_pipelining_os.py b/tests/cloud_tests/testcases/modules/apt_pipelining_os.py
index 740dc7c..2b940a6 100644
--- a/tests/cloud_tests/testcases/modules/apt_pipelining_os.py
+++ b/tests/cloud_tests/testcases/modules/apt_pipelining_os.py
@@ -8,8 +8,8 @@ class TestAptPipeliningOS(base.CloudTestCase):
     """Test apt-pipelining module."""
 
     def test_os_pipelining(self):
-        """Test pipelining set to os."""
-        out = self.get_data_file('90cloud-init-pipelining')
-        self.assertIn('Acquire::http::Pipeline-Depth "0";', out)
+        """test 'os' settings does not write apt config file."""
+        out = self.get_data_file('90cloud-init-pipelining_not_written')
+        self.assertEqual(0, int(out))
 
 # vi: ts=4 expandtab
diff --git a/tests/cloud_tests/testcases/modules/apt_pipelining_os.yaml b/tests/cloud_tests/testcases/modules/apt_pipelining_os.yaml
index cbed3ba..86d5220 100644
--- a/tests/cloud_tests/testcases/modules/apt_pipelining_os.yaml
+++ b/tests/cloud_tests/testcases/modules/apt_pipelining_os.yaml
@@ -1,15 +1,14 @@
 #
-# Set apt pipelining value to OS
+# Set apt pipelining value to OS, no conf written
 #
 required_features:
   - apt
 cloud_config: |
   #cloud-config
-  apt:
-    apt_pipelining: os
+  apt_pipelining: os
 collect_scripts:
-  90cloud-init-pipelining: |
+  90cloud-init-pipelining_not_written: |
     #!/bin/bash
-    cat /etc/apt/apt.conf.d/90cloud-init-pipelining
+    ls /etc/apt/apt.conf.d/90cloud-init-pipelining | wc -l
 
 # vi: ts=4 expandtab