summaryrefslogtreecommitdiff
path: root/tests/integration_tests/bugs
diff options
context:
space:
mode:
authorJames Falcon <TheRealFalcon@users.noreply.github.com>2020-12-10 10:58:12 -0600
committerGitHub <noreply@github.com>2020-12-10 11:58:12 -0500
commit97bfd21d2dca978a662c87f0255a2a2bb97fc5d6 (patch)
tree646a8d58333171a974ae29bfef0bc2684ff750bb /tests/integration_tests/bugs
parent1d1649e56e553576240cf4b1fafc098997b9ba6d (diff)
downloadvyos-cloud-init-97bfd21d2dca978a662c87f0255a2a2bb97fc5d6.tar.gz
vyos-cloud-init-97bfd21d2dca978a662c87f0255a2a2bb97fc5d6.zip
Integration test for LP: #1813396 and #669 (#719)
Ensure gpg is called with --no-tty flag. Also, refactored the "ordered_items_in_text" to assert if the line is missing and provide a more useful error message.
Diffstat (limited to 'tests/integration_tests/bugs')
-rw-r--r--tests/integration_tests/bugs/test_lp1813396.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/integration_tests/bugs/test_lp1813396.py b/tests/integration_tests/bugs/test_lp1813396.py
new file mode 100644
index 00000000..7ad0e809
--- /dev/null
+++ b/tests/integration_tests/bugs/test_lp1813396.py
@@ -0,0 +1,34 @@
+"""Integration test for lp-1813396
+
+Ensure gpg is called with no tty flag.
+"""
+
+import pytest
+
+from tests.integration_tests.instances import IntegrationInstance
+from tests.integration_tests.log_utils import verify_ordered_items_in_text
+
+
+USER_DATA = """\
+#cloud-config
+apt:
+ sources:
+ cloudinit:
+ source: 'deb [arch=amd64] http://ppa.launchpad.net/cloud-init-dev/daily/ubuntu focal main'
+ keyserver: keyserver.ubuntu.com
+ keyid: E4D304DF
+""" # noqa: E501
+
+
+@pytest.mark.sru_2020_11
+@pytest.mark.user_data(USER_DATA)
+def test_gpg_no_tty(client: IntegrationInstance):
+ log = client.read_from_file('/var/log/cloud-init.log')
+ to_verify = [
+ "Running command ['gpg', '--no-tty', "
+ "'--keyserver=keyserver.ubuntu.com', '--recv-keys', 'E4D304DF'] "
+ "with allowed return codes [0] (shell=False, capture=True)",
+ "Imported key 'E4D304DF' from keyserver 'keyserver.ubuntu.com'",
+ "finish: modules-config/config-apt-configure: SUCCESS",
+ ]
+ verify_ordered_items_in_text(to_verify, log)