diff options
author | Matt Clay <matt@mystile.com> | 2021-09-24 11:15:11 -0700 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2021-09-24 12:16:35 -0700 |
commit | 6a5d6896fd78b94894fc731a7f703cf893457d7c (patch) | |
tree | 27f93b3dc25a52b5e0627fef97b7a78f12e13cfb /test/lib/ansible_test/_internal | |
parent | b70077364ab864d8d7dbff6bbe6546ef4be9af26 (diff) | |
download | ansible-6a5d6896fd78b94894fc731a7f703cf893457d7c.tar.gz |
ansible-test - Warn about stale sanity venvs.
Diffstat (limited to 'test/lib/ansible_test/_internal')
-rw-r--r-- | test/lib/ansible_test/_internal/commands/sanity/__init__.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lib/ansible_test/_internal/commands/sanity/__init__.py b/test/lib/ansible_test/_internal/commands/sanity/__init__.py index edd6563646..f30d9ff039 100644 --- a/test/lib/ansible_test/_internal/commands/sanity/__init__.py +++ b/test/lib/ansible_test/_internal/commands/sanity/__init__.py @@ -96,6 +96,7 @@ from ...content_config import ( ) from ...host_configs import ( + DockerConfig, PosixConfig, PythonConfig, VirtualPythonConfig, @@ -121,6 +122,8 @@ COMMAND = 'sanity' SANITY_ROOT = os.path.join(ANSIBLE_TEST_CONTROLLER_ROOT, 'sanity') TARGET_SANITY_ROOT = os.path.join(ANSIBLE_TEST_TARGET_ROOT, 'sanity') +created_venvs = [] # type: t.List[str] + def command_sanity(args): """ @@ -279,6 +282,12 @@ def command_sanity(args): if isinstance(result, SanityFailure): failed.append(result.test + options) + controller = args.controller + + if created_venvs and isinstance(controller, DockerConfig) and controller.name == 'default' and not args.prime_venvs: + names = ', '.join(created_venvs) + display.warning(f'There following sanity test virtual environments are out-of-date in the "default" container: {names}') + if failed: message = 'The %d sanity test(s) listed below (out of %d) failed. See error output above for details.\n%s' % ( len(failed), total, '\n'.join(failed)) @@ -1155,6 +1164,8 @@ def create_sanity_virtualenv( write_json_file(meta_yaml, virtualenv_yaml) + created_venvs.append(f'{label}-{python.version}') + # touch the marker to keep track of when the virtualenv was last used pathlib.Path(virtualenv_marker).touch() |