Skip to content

testing: integration_test updates (SC-362)#1001

Merged
TheRealFalcon merged 21 commits intocanonical:mainfrom
TheRealFalcon:vm-workarounds
Sep 15, 2021
Merged

testing: integration_test updates (SC-362)#1001
TheRealFalcon merged 21 commits intocanonical:mainfrom
TheRealFalcon:vm-workarounds

Conversation

@TheRealFalcon
Copy link
Contributor

@TheRealFalcon TheRealFalcon commented Aug 25, 2021

Proposed Commit Message

Integration test upgrades for the 21.3-1 SRU:

* Update test_combined.py to allow either valid LXD subplatform
* Split jinja templated tests into separate module as they can be more
  fragile
* Move checks for warnings and tracebacks into dedicated utility
  function. This allows us to work around persistent and expected
  tracebacks/warnings on particular clouds.
* Update test_upgrade.py to allow either valid Azure datasource.
  /var/lib/waagent or a mounted device are both valid.
* Add specificity to test_ntp_servers.py
  Clouds will often specify their own ntp servers in the ntp
  configuration files, so make the tests manually specify their own.
* Account for additional keys on system in test_ssh_keysfiles.py
* Update tests to account for invalid cache
  test_user_events.py and test_version_change.py both have tests that
  assume we will have valid ds cache when rebooting.
  In test_user_events.py, subsequent boots should block applying
  network on boot if boot event is denied. However, if the cache is
  invalid, it is valid to apply networking config that boot.
  In test_version_change.py no cache found won't trigger the expected
  debug log. Additionally, the pickle used for that test on an older
  release triggered an unexpected issue that took a different error
  path.
* Ignore bionic in hotplug tests (LP: #1942247)
  On Bionic, we traceback when attempting to detect the hotplugged
  device in the updated metadata. This is because Bionic is
  specifically configured not to provide network metadata.
  See LP: #1942247 for more details.
* Fix date used in test_final_message.
  In test_final_message, we ensured the variable substitution works as
  expected. For $timestamp, we compared against the current date. It's
  possible for the host date to be massively different from the client
  date, so obtain date on client rather than host.
* Remove module success from lp1813396 test. Module may fail
  unrelatedly (in this case apt-get update is failing), but the test
  should still pass.
* Skip testing events if network is disabled
* Ensure we install expected version of cloud-init
  As part of test setup, we can install cloud-init from various
  sources, including PROPOSED, PPAs, etc. We were never checking that
  this install completes successfully, and on OCI, it wasn't
  completing successfully because of apt locking issues. Code has
  been updated to retry, and then fail loudly if we can't complete the
  install.
* Remove ubuntu-azure-fips metapkg which mandates FIPS-flavour kernel
  In test_lp1835584.py
* Update test_user_events.py to account for Azure behavior
  since Azure has a separate service to clear the pickled metadata
  every boot
* Change failure to warning in test_upgrade.py if initial boot errors
  If there's already a pre-existing cause for warnings or tracebacks,
  that shouldn't cause the new version to fail.
* Add retry to test_random_passwords_emitted_to_serial_console
  It's possible we haven't retrieved the entire log when the call returns,
  so retry a few times if the output isn't empty.

Additional Context

Test Steps

Run integration tests

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

@TheRealFalcon TheRealFalcon changed the title testing: workaround lxd_vm bionic issues testing: workaround lxd_vm bionic issues (SC-362) Aug 25, 2021
@TheRealFalcon TheRealFalcon changed the title testing: workaround lxd_vm bionic issues (SC-362) testing: integration_test updates (SC-362) Aug 27, 2021
@TheRealFalcon TheRealFalcon added the wip Work in progress, do not land label Aug 27, 2021
@TheRealFalcon TheRealFalcon force-pushed the vm-workarounds branch 3 times, most recently from 3abc512 to 96486e4 Compare August 27, 2021 16:10
@blackboxsw
Copy link
Collaborator

blackboxsw commented Sep 1, 2021

@TheRealFalcon you'll also need this to fix the Azure FIps test

diff --git a/tests/integration_tests/bugs/test_lp1835584.py b/tests/integration_tests/bugs/test_lp1835584.py
index 660d2a2a1..e5fe3fd59 100644
--- a/tests/integration_tests/bugs/test_lp1835584.py
+++ b/tests/integration_tests/bugs/test_lp1835584.py
@@ -59,6 +59,10 @@ def _check_iid_insensitive_across_kernel_upgrade(
     result = instance.execute("apt-get install linux-azure --assume-yes")
     if not result.ok:
         pytest.fail("Unable to install linux-azure kernel: {}".format(result))
+    # Remove ubuntu-azure-fips metapkg which mandates FIPS-flavour kernel
+    result = instance.execute("ua disable fips --assume-yes")
+    if not result.ok:
+        pytest.fail("Unable to disable fips: {}".format(result))
     instance.restart()
     new_kernel = instance.execute("uname -r").strip()
     assert orig_kernel != new_kernel

@TheRealFalcon
Copy link
Contributor Author

Wahoo...Thanks!

@TheRealFalcon TheRealFalcon force-pushed the vm-workarounds branch 2 times, most recently from 5bb4fb5 to 8496115 Compare September 9, 2021 00:24
@TheRealFalcon TheRealFalcon removed the wip Work in progress, do not land label Sep 13, 2021
version of LXD. Additionally, I split the jinja templated tests into a
separate module as bionic vms were unable to read the sensitive instance
json. In general the jinja functionality feels a bit more fragile.
Currently we get warnings on every launch for a particular cloud.
Moving all traceback/warning checks to a dedicated function makes it
easy for us to workaround such persistent warnings.
Sometimes the datasource listed in /run/cloud-init/result.json can show
/var/lib/waagnet or a mounted device. Since both of these are valid,
simply check for 'DataSourceAzure' in the test_upgrade check.
Since cloud's will often specify their own ntp servers in the ntp
configuration files, specify the servers manually so we have no
unexpected results
the test_ssh_keysfile.py was written again NoCloud. In real clouds, keys
added to your account are also added to the authorized_keys file.
Test needed to be updated to account for this.
test_user_events.py and test_version_change.py both have tests that
assume we will have valid ds cache when rebooting.
In test_user_events.py, subsequent boots should block applying network
on boot if boot event is denied. However, if the cache is invalid, it is
valid to apply networking config on that boot.
In test_version_change.py, no cache found won't trigger the expected
debug log. Additionally, the pickle used for that test on an older
release triggered an expected issue that took a different error path.
On Bionic, we traceback when attempting to detect the hotplugged
device in the updated metadata. This is because Bionic is specifically
configured not to provide network metadata.

This is a legitimate issue, but can be addressed outside of these test
changes and in the next release.
In test_final_message, we ensure that the variable substition works as
expected. For $timestamp, we compare against the current date. It's
possible for the host date to be massively different from the client
date, so obtain date on client rather than host.
Module may fail unrelatedly (in this case apt-get update is failing),
but the test should still pass
As part of test setup, we can install cloud-init from various sources,
including PROPOSED, PPAs, etc. We were never checking that this install
completes successfully, and on one particular cloud, it wasn't because
apt locking issues. Code has been updated to retry, and then fail loudly
if we can't complete the install.
Azure has a separate service to clear the pickled metadata every boot,
so test was updated to account for that behavior.
If there's already a pre-existing cause for warning or tracebacks, that
shouldn't cause this SRU to fail
Copy link
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

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

Thank you for all of these changes.

# log
pytest.skip("NotImplementedError when requesting console log")
return
if console_log.lower() == 'no console output':
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for this addition/retry fix here.

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