From 652fdeab0716cac647108cbbb48f509699a3320f Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 28 Jul 2021 22:09:50 +0200 Subject: [PATCH] Add support for running only the integration tests of changed modules - enable for amazon.aws --- .../ansible-test/tasks/init_test_options.yaml | 5 +++ roles/ansible-test/vars/default.yaml | 2 + zuul.d/project-templates.yaml | 40 ++++++++++++++----- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/roles/ansible-test/tasks/init_test_options.yaml b/roles/ansible-test/tasks/init_test_options.yaml index c45536cce..e0875a1a0 100644 --- a/roles/ansible-test/tasks/init_test_options.yaml +++ b/roles/ansible-test/tasks/init_test_options.yaml @@ -24,6 +24,11 @@ ansible_test_options: "{{ ansible_test_options }} --requirements" when: not ansible_test_collections +- name: Enable --changed + set_fact: + ansible_test_options: "{{ ansible_test_options }} --changed --base-branch {{ ansible_test_base_branch }}" + when: ansible_test_changed_only + - name: Enable coverage commands for unit tests set_fact: ansible_test_options: "--coverage" diff --git a/roles/ansible-test/vars/default.yaml b/roles/ansible-test/vars/default.yaml index e6c9efc02..b4cebc20d 100644 --- a/roles/ansible-test/vars/default.yaml +++ b/roles/ansible-test/vars/default.yaml @@ -1,3 +1,5 @@ --- ansible_test_executable: "ansible-test" +ansible_test_changed_only: false +ansible_test_base_branch: "main" ansible_test_options: "--diff --no-temp-workdir" diff --git a/zuul.d/project-templates.yaml b/zuul.d/project-templates.yaml index 9f10fa8a2..4b86e827d 100644 --- a/zuul.d/project-templates.yaml +++ b/zuul.d/project-templates.yaml @@ -77,16 +77,36 @@ - name: github.com/ansible-collections/community.aws - name: github.com/ansible-collections/community.general - ansible-test-splitter - - ansible-test-cloud-integration-aws-py36_0 - - ansible-test-cloud-integration-aws-py36_1 - - ansible-test-cloud-integration-aws-py36_2 - - ansible-test-cloud-integration-aws-py36_3 - - ansible-test-cloud-integration-aws-py36_4 - - ansible-test-cloud-integration-aws-py36_5 - - ansible-test-cloud-integration-aws-py36_6 - - ansible-test-cloud-integration-aws-py36_7 - - ansible-test-cloud-integration-aws-py36_8 - - ansible-test-cloud-integration-aws-py36_9 + - ansible-test-cloud-integration-aws-py36_0: + vars: + ansible_test_changed_only: true + - ansible-test-cloud-integration-aws-py36_1: + vars: + ansible_test_changed_only: true + - ansible-test-cloud-integration-aws-py36_2: + vars: + ansible_test_changed_only: true + - ansible-test-cloud-integration-aws-py36_3: + vars: + ansible_test_changed_only: true + - ansible-test-cloud-integration-aws-py36_4: + vars: + ansible_test_changed_only: true + - ansible-test-cloud-integration-aws-py36_5: + vars: + ansible_test_changed_only: true + - ansible-test-cloud-integration-aws-py36_6: + vars: + ansible_test_changed_only: true + - ansible-test-cloud-integration-aws-py36_7: + vars: + ansible_test_changed_only: true + - ansible-test-cloud-integration-aws-py36_8: + vars: + ansible_test_changed_only: true + - ansible-test-cloud-integration-aws-py36_9: + vars: + ansible_test_changed_only: true gate: jobs: