Skip to content

Integration test for lp-1813396#719

Merged
OddBloke merged 3 commits into
canonical:masterfrom
TheRealFalcon:lp-1813396
Dec 10, 2020
Merged

Integration test for lp-1813396#719
OddBloke merged 3 commits into
canonical:masterfrom
TheRealFalcon:lp-1813396

Conversation

@TheRealFalcon
Copy link
Copy Markdown
Contributor

@TheRealFalcon TheRealFalcon commented Dec 9, 2020

Proposed Commit Message

Integration test for lp-1813396 and #669

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.

Additional Context

#669

Test Steps

fail:
CLOUD_INIT_CLOUD_INIT_SOURCE=NONE pytest tests/integration_tests/bugs/test_lp1813396.py
pass:
CLOUD_INIT_CLOUD_INIT_SOURCE=PROPOSED pytest tests/integration_tests/bugs/test_lp1813396.py

Checklist:

  • My code follows the process laid out in the documentation
  • I have updated or added any unit tests accordingly
  • I have updated or added any documentation accordingly

@@ -0,0 +1,33 @@
"""Integration test for lp-1813396

Ensure gpg works even if VM provides no /dev/tty"""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't what we're doing: we're testing that cloud-init passes --no-tty to gpg. I think that's sufficient for validation on Ubuntu (particularly as lxd doesn't support not providing /dev/tty to a system: https://lxd.readthedocs.io/en/latest/instances/#devices-configuration), but there could be an integration test for this bug which masks/removes /dev/tty somehow and then tests that we successfully configure the repo.

apt:
sources:
docker:
source: 'deb [arch=amd64] https://download.docker.com/linux/debian stretch stable'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we better using a PPA for this? Easier to access when we're running tests inside our network, and we don't introduce a dependency on an "external" service.

"Imported key '0EBFCD88' from keyserver 'keyserver.ubuntu.com'",
"finish: modules-config/config-apt-configure: SUCCESS",
]
assert ordered_items_in_text(to_verify, log)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also use a better failure message: now that we're using it in two places, perhaps ordered_items_in_text should return something (the first unfound item?) that could be used for a richer message? Or it could become assert_ordered_items_in_text and be responsible for raising an AssertionError with a richer message?

(A nit for this PR, but I would like to see this improved.)

Ensure gpg works even if VM provides no /dev/tty
@OddBloke
Copy link
Copy Markdown
Collaborator

OddBloke commented Dec 10, 2020 via email

Comment thread tests/integration_tests/modules/test_power_state_change.py Outdated
Copy link
Copy Markdown
Collaborator

@OddBloke OddBloke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've confirmed that this fails/passes as expected, and the change to the power state test (with my suggestion applied) also continues to behave as expected.

@OddBloke OddBloke merged commit 97bfd21 into canonical:master Dec 10, 2020
@TheRealFalcon TheRealFalcon deleted the lp-1813396 branch June 29, 2021 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants