From cd4882e2297e78e46b676663d9c899148a16cc4f Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 12 Sep 2019 01:48:06 -0700 Subject: [PATCH] Fix ansible-test vcenter test filtering. The default behavior of the ansible-test vcenter plugin is to use the govcsim container to run tests. However, unless the govcsim mode was specified using the VMWARE_TEST_PLATFORM environment variable, the filter code would skip the tests unless the tests ran on Shippable or the user had an ansible-core-ci key. Now the filter correctly recognizes that govcsim is the default. --- changelogs/fragments/ansible-test-vcenter-plugin.yml | 2 ++ test/lib/ansible_test/_internal/cloud/vcenter.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/ansible-test-vcenter-plugin.yml diff --git a/changelogs/fragments/ansible-test-vcenter-plugin.yml b/changelogs/fragments/ansible-test-vcenter-plugin.yml new file mode 100644 index 0000000000..a0d11e8451 --- /dev/null +++ b/changelogs/fragments/ansible-test-vcenter-plugin.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test now properly activates the vcenter plugin for vcenter tests when docker is available diff --git a/test/lib/ansible_test/_internal/cloud/vcenter.py b/test/lib/ansible_test/_internal/cloud/vcenter.py index 79b1e96926..4fb7936c98 100644 --- a/test/lib/ansible_test/_internal/cloud/vcenter.py +++ b/test/lib/ansible_test/_internal/cloud/vcenter.py @@ -61,7 +61,7 @@ class VcenterProvider(CloudProvider): :type targets: tuple[TestTarget] :type exclude: list[str] """ - if self.vmware_test_platform == 'govcsim': + if self.vmware_test_platform == 'govcsim' or (self.vmware_test_platform == '' and not os.path.isfile(self.config_static_path)): docker = find_executable('docker', required=False) if docker: @@ -72,8 +72,8 @@ class VcenterProvider(CloudProvider): if skipped: exclude.append(skip) - display.warning('Excluding tests marked "%s" which require the "docker" command: %s' - % (skip.rstrip('/'), ', '.join(skipped))) + display.warning('Excluding tests marked "%s" which require the "docker" command or config (see "%s"): %s' + % (skip.rstrip('/'), self.config_template_path, ', '.join(skipped))) else: if os.path.isfile(self.config_static_path): return