diff options
author | James Falcon <james.falcon@canonical.com> | 2021-11-18 14:45:21 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 13:45:21 -0700 |
commit | 36adb6dab494f23b30c68cf6af04c10ddb693c43 (patch) | |
tree | 738178bda9064245a33ff740718776d60ca26772 | |
parent | 7f03da357e4e72f7fe09e9b35b23ba1d83477f6c (diff) | |
download | vyos-cloud-init-36adb6dab494f23b30c68cf6af04c10ddb693c43.tar.gz vyos-cloud-init-36adb6dab494f23b30c68cf6af04c10ddb693c43.zip |
integration_tests: Ensure log directory exists before symlinking to it (#1110)
Also simplify a path and fix a spelling error while in the file
-rw-r--r-- | tests/integration_tests/conftest.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/integration_tests/conftest.py b/tests/integration_tests/conftest.py index 68b92e4b..5eab5a45 100644 --- a/tests/integration_tests/conftest.py +++ b/tests/integration_tests/conftest.py @@ -191,16 +191,15 @@ def _collect_logs(instance: IntegrationInstance, node_id: str, ) / session_start_time / node_id_path log.info("Writing logs to %s", log_dir) + if not log_dir.exists(): + log_dir.mkdir(parents=True) + # Add a symlink to the latest log output directory last_symlink = Path(integration_settings.LOCAL_LOG_PATH) / 'last' if os.path.islink(last_symlink): os.unlink(last_symlink) - os.symlink( - Path(integration_settings.LOCAL_LOG_PATH) / session_start_time, - last_symlink) + os.symlink(log_dir.parent, last_symlink) - if not log_dir.exists(): - log_dir.mkdir(parents=True) tarball_path = log_dir / 'cloud-init.tar.gz' instance.pull_file('/var/tmp/cloud-init.tar.gz', tarball_path) @@ -251,7 +250,7 @@ def _client(request, fixture_utils, session_cloud: IntegrationCloud): local_launch_kwargs = {} if lxd_setup is not None: if not isinstance(session_cloud, _LxdIntegrationCloud): - pytest.skip('lxd_setup requres LXD') + pytest.skip('lxd_setup requires LXD') local_launch_kwargs['lxd_setup'] = lxd_setup with session_cloud.launch( |