From 71fb2dc4d4a145da39e3e2e8fb2214046256bb24 Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Mon, 22 Jan 2024 16:45:41 -0500 Subject: [PATCH 1/9] Update Galaxy collection ci to oci-env Add Keycloak as a test profile Issue: AAH-2421 --- .../ci_automation_hub_collection.yml | 60 ++++++++++--------- Makefile | 8 +++ dev/oci_env_integration/actions/action_lib.py | 16 +++++ .../actions/galaxy_collection_keycloak.py | 22 +++++++ .../actions/galaxy_collection_standalone.py | 22 +++++++ 5 files changed, 101 insertions(+), 27 deletions(-) create mode 100644 dev/oci_env_integration/actions/galaxy_collection_keycloak.py create mode 100644 dev/oci_env_integration/actions/galaxy_collection_standalone.py diff --git a/.github/workflows/ci_automation_hub_collection.yml b/.github/workflows/ci_automation_hub_collection.yml index 3cdff236b5..1b96a2a936 100644 --- a/.github/workflows/ci_automation_hub_collection.yml +++ b/.github/workflows/ci_automation_hub_collection.yml @@ -3,28 +3,52 @@ name: Galaxy Collection CI on: pull_request: branches: - - "*" + - '**' paths-ignore: - "CHANGES/**" - "docs/**" - "mkdocs.yml" push: branches: - - "*" + - '**' workflow_dispatch: jobs: - galaxy_collection: + integration: + strategy: + fail-fast: false + matrix: + env: + - TEST_PROFILE: standalone + - TEST_PROFILE: keycloak runs-on: ubuntu-latest steps: - - name: Checkout galaxy_ng - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Setup python - uses: actions/setup-python@v4 + - uses: actions/setup-python@v4 with: python-version: "3.10" + # Note: COMPOSE_INTERACTIVE_NO_CLI=1 is required for oci-env to work correctly when there's no interactive terminal + - name: Set environment variables + run: | + echo "OCI_ENV_PATH=${HOME}/work/galaxy_ng/oci_env" >> $GITHUB_ENV + echo "COMPOSE_INTERACTIVE_NO_CLI=1" >> $GITHUB_ENV + echo "OCI_VERBOSE=1" >> $GITHUB_ENV + echo "GH_DUMP_LOGS=1" >> $GITHUB_ENV + + - name: Update apt + run: sudo apt -y update + + - name: Install LDAP requirements + run: sudo apt-get install -y libsasl2-dev python3 libldap2-dev libssl-dev build-essential + + - name: setup oci-env + run: | + git clone https://github.com/pulp/oci_env.git $OCI_ENV_PATH + pip install -e $OCI_ENV_PATH/client/ + mkdir $OCI_ENV_PATH/db_backup/ + - name: Checkout the galaxy collection uses: actions/checkout@v4 with: @@ -42,23 +66,5 @@ jobs: ansible-galaxy collection build -vvv ansible-galaxy collection install galaxy-galaxy-1.0.0.tar.gz -vvv - - name: Spin up a standalone galaxy_ng installation - run: | - echo "COMPOSE_PROFILE=standalone" > .compose.env - echo "DEV_SOURCE_PATH=galaxy_ng" >> .compose.env - make docker/all - ./compose up -d - pip3 install --upgrade requests pyyaml - python3 dev/common/poll.py - - - name: Test the user playbook - run: ansible-playbook dev/galaxy_collection_plays/user.yml -vvv - - - name: Test the content playbook - run: ansible-playbook dev/galaxy_collection_plays/content.yml -vvv - - - name: Test the repo playbook - run: ansible-playbook dev/galaxy_collection_plays/repo.yml -vvv - - - name: Test the ee playbook - run: ansible-playbook dev/galaxy_collection_plays/ee.yml -vvv + - name: run playbook tests + run: make gh-action/${{ matrix.env.TEST_PROFILE }} diff --git a/Makefile b/Makefile index d2ceafcd0c..0330b1d575 100644 --- a/Makefile +++ b/Makefile @@ -146,6 +146,14 @@ gh-action/community: gh-action/certified-sync: python3 dev/oci_env_integration/actions/certified-sync.py +.PHONY: gh-action/galaxy_collection_standalone +gh-action/galaxy_collection_standalone: + python3 dev/oci_env_integration/actions/galaxy_collection.py + +.PHONY: gh-action/galaxy_collection_keycloak +gh-action/galaxy_collection_keycloak: + python3 dev/oci_env_integration/actions/galaxy_collection.py + .PHONY: docker/loaddata docker/loaddata: ## Load initial data from python script $(call exec_or_run, api, "/bin/bash", "-c", "/entrypoint.sh manage shell < app/dev/common/setup_test_data.py") diff --git a/dev/oci_env_integration/actions/action_lib.py b/dev/oci_env_integration/actions/action_lib.py index 8be2df9dca..ad2e243e0f 100644 --- a/dev/oci_env_integration/actions/action_lib.py +++ b/dev/oci_env_integration/actions/action_lib.py @@ -32,6 +32,7 @@ class OCIEnvIntegrationTest: env_file (string, required): oci-env env file to use for the tests. These are all loaded from dev/oci_env_integration/oci_env_configs run_tests (boolean, required): if true, integration tests will be run inside this instance + run_playbooks (boolean, optional): if true, Galaxy Collection playbook tests will be run inside this instance db_restore (string, optional): database backup to restore before running tests These are all loaded from dev/oci_env_integration/oci_env_configs. When defining this, omit the file extension (ex: fixture, not fixtur.tar.gz) @@ -127,6 +128,21 @@ def run_test(self): f" {pytest_flags} {self.flags}" ) + def run_playbooks(self): + for env in self.envs: + if wait_time := self.envs[env].get("wait_before_tests", 20): + print(f"waiting {wait_time} seconds") + time.sleep(wait_time) + + if self.envs[env]["run_playbooks"]: + if len(self.envs[env]["playbooks"]) > 0: + for playbook in self.envs[env]["playbooks"]: + print(f"testing the {playbook} playbook") + self.exec_cmd( + env, + f"exec ansible-playbook src/galaxy_ng/dev/galaxy_collection_plays/{playbook} -vvv" + ) + def dump_logs(self): if not self.do_dump_logs: return diff --git a/dev/oci_env_integration/actions/galaxy_collection_keycloak.py b/dev/oci_env_integration/actions/galaxy_collection_keycloak.py new file mode 100644 index 0000000000..9239a02a58 --- /dev/null +++ b/dev/oci_env_integration/actions/galaxy_collection_keycloak.py @@ -0,0 +1,22 @@ +import action_lib + +env = action_lib.OCIEnvIntegrationTest( + envs=[ + { + "env_file": "keycloak.compose.env", + "run_tests": False, + "run_playbooks": True, + "playbooks": [ + "user.yml", + "content.yml", + "repo.yml", + "ee.yml", + ], + "db_restore": None, + + # the keycloak profile performs some setup after the service + # comes online + "wait_before_tests": 120 + } + ] +) diff --git a/dev/oci_env_integration/actions/galaxy_collection_standalone.py b/dev/oci_env_integration/actions/galaxy_collection_standalone.py new file mode 100644 index 0000000000..3f85fdb6c2 --- /dev/null +++ b/dev/oci_env_integration/actions/galaxy_collection_standalone.py @@ -0,0 +1,22 @@ +import action_lib + +env = action_lib.OCIEnvIntegrationTest( + envs=[ + { + "env_file": "standalone.compose.env", + "run_tests": False, + "run_playbooks": True, + "playbooks": [ + "user.yml", + "content.yml", + "repo.yml", + "ee.yml", + ], + "db_restore": None, + + # the keycloak profile performs some setup after the service + # comes online + # "wait_before_tests": 120 + } + ] +) From 9cabe6f08cd16a889f08bf407e3c3a1e5a38ebd0 Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Thu, 1 Feb 2024 20:02:00 -0500 Subject: [PATCH 2/9] Add change log Issue: AAH-2421 --- CHANGES/2421.misc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 CHANGES/2421.misc diff --git a/CHANGES/2421.misc b/CHANGES/2421.misc new file mode 100644 index 0000000000..cd2cf70d1c --- /dev/null +++ b/CHANGES/2421.misc @@ -0,0 +1,3 @@ +Migrate galaxy collection testing to oci-env stack +Add keycloak environment to galaxy collection test matrix +Issue: AAH-2421 \ No newline at end of file From fb702f434ca38e194c568a9fc206a2671714a053 Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Fri, 2 Feb 2024 08:18:22 -0500 Subject: [PATCH 3/9] Update test profiles Issue: AAH-2421 --- .github/workflows/ci_automation_hub_collection.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_automation_hub_collection.yml b/.github/workflows/ci_automation_hub_collection.yml index 1b96a2a936..57576de4f2 100644 --- a/.github/workflows/ci_automation_hub_collection.yml +++ b/.github/workflows/ci_automation_hub_collection.yml @@ -19,8 +19,8 @@ jobs: fail-fast: false matrix: env: - - TEST_PROFILE: standalone - - TEST_PROFILE: keycloak + - TEST_PROFILE: galaxy_collection_standalone + - TEST_PROFILE: galaxy_collection_keycloak runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From bcf9a3a29f4ae337cbb18c5993d047b2bdab68e6 Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Fri, 2 Feb 2024 08:24:09 -0500 Subject: [PATCH 4/9] Fix call to action Issue: AAH-2421 --- Makefile | 4 ++-- dev/oci_env_integration/actions/action_lib.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 0330b1d575..387bb89f42 100644 --- a/Makefile +++ b/Makefile @@ -148,11 +148,11 @@ gh-action/certified-sync: .PHONY: gh-action/galaxy_collection_standalone gh-action/galaxy_collection_standalone: - python3 dev/oci_env_integration/actions/galaxy_collection.py + python3 dev/oci_env_integration/actions/galaxy_collection_standalone.py .PHONY: gh-action/galaxy_collection_keycloak gh-action/galaxy_collection_keycloak: - python3 dev/oci_env_integration/actions/galaxy_collection.py + python3 dev/oci_env_integration/actions/galaxy_collection_keycloak.py .PHONY: docker/loaddata docker/loaddata: ## Load initial data from python script diff --git a/dev/oci_env_integration/actions/action_lib.py b/dev/oci_env_integration/actions/action_lib.py index ad2e243e0f..218440b075 100644 --- a/dev/oci_env_integration/actions/action_lib.py +++ b/dev/oci_env_integration/actions/action_lib.py @@ -65,6 +65,7 @@ def __init__(self, envs): try: self.set_up_env() self.run_test() + self.run_playbooks() except Exception as e: print(e) self.failed = True @@ -130,11 +131,11 @@ def run_test(self): def run_playbooks(self): for env in self.envs: - if wait_time := self.envs[env].get("wait_before_tests", 20): - print(f"waiting {wait_time} seconds") - time.sleep(wait_time) - if self.envs[env]["run_playbooks"]: + if wait_time := self.envs[env].get("wait_before_tests", 20): + print(f"waiting {wait_time} seconds") + time.sleep(wait_time) + if len(self.envs[env]["playbooks"]) > 0: for playbook in self.envs[env]["playbooks"]: print(f"testing the {playbook} playbook") From a9abc4f3d495c7dedc9e1c289b7c190fec253c4a Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Fri, 2 Feb 2024 08:58:23 -0500 Subject: [PATCH 5/9] make changelog a one-liner Issue: AAH-2421 --- CHANGES/2421.misc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGES/2421.misc b/CHANGES/2421.misc index cd2cf70d1c..979e922981 100644 --- a/CHANGES/2421.misc +++ b/CHANGES/2421.misc @@ -1,3 +1 @@ -Migrate galaxy collection testing to oci-env stack -Add keycloak environment to galaxy collection test matrix -Issue: AAH-2421 \ No newline at end of file +Migrate galaxy collection testing to oci-env stack for standalone and keycloak profiles \ No newline at end of file From 108ad3fcdcf5f2747774e72142543aedeb5d1c76 Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Fri, 2 Feb 2024 09:08:00 -0500 Subject: [PATCH 6/9] update api port to 55001 Issue: AAH-2421 --- dev/galaxy_collection_plays/vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/galaxy_collection_plays/vars.yml b/dev/galaxy_collection_plays/vars.yml index 52727ed057..266d013188 100644 --- a/dev/galaxy_collection_plays/vars.yml +++ b/dev/galaxy_collection_plays/vars.yml @@ -1,4 +1,4 @@ -ah_host: http://localhost:5001 +ah_host: http://localhost:55001 ah_username: iqe_admin ah_password: redhat ah_path_prefix: automation-hub From 457d48a480f9293bbde5bdf14d9d35b274fadfcf Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Fri, 2 Feb 2024 10:07:02 -0500 Subject: [PATCH 7/9] account for run_playbooks --- dev/oci_env_integration/actions/action_lib.py | 2 +- dev/oci_env_integration/actions/certified-sync.py | 1 + dev/oci_env_integration/actions/community.py | 1 + dev/oci_env_integration/actions/insights.py | 1 + dev/oci_env_integration/actions/iqe_rbac.py | 1 + dev/oci_env_integration/actions/keycloak.py | 1 + dev/oci_env_integration/actions/ldap.py | 1 + dev/oci_env_integration/actions/rbac.py | 1 + dev/oci_env_integration/actions/standalone.py | 1 + dev/oci_env_integration/actions/x_repo_search.py | 1 + 10 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dev/oci_env_integration/actions/action_lib.py b/dev/oci_env_integration/actions/action_lib.py index 218440b075..f10694cc1d 100644 --- a/dev/oci_env_integration/actions/action_lib.py +++ b/dev/oci_env_integration/actions/action_lib.py @@ -32,7 +32,7 @@ class OCIEnvIntegrationTest: env_file (string, required): oci-env env file to use for the tests. These are all loaded from dev/oci_env_integration/oci_env_configs run_tests (boolean, required): if true, integration tests will be run inside this instance - run_playbooks (boolean, optional): if true, Galaxy Collection playbook tests will be run inside this instance + run_playbooks (boolean, required): if true, Galaxy Collection playbook tests will be run inside this instance db_restore (string, optional): database backup to restore before running tests These are all loaded from dev/oci_env_integration/oci_env_configs. When defining this, omit the file extension (ex: fixture, not fixtur.tar.gz) diff --git a/dev/oci_env_integration/actions/certified-sync.py b/dev/oci_env_integration/actions/certified-sync.py index 0ff56fc66d..cd560e28ec 100644 --- a/dev/oci_env_integration/actions/certified-sync.py +++ b/dev/oci_env_integration/actions/certified-sync.py @@ -5,6 +5,7 @@ { "env_file": "standalone.compose.env", "run_tests": True, + "run_playbooks": False, "db_restore": None, "pytest_flags": '-m sync' }, diff --git a/dev/oci_env_integration/actions/community.py b/dev/oci_env_integration/actions/community.py index 6b5e44c512..62b83db1af 100644 --- a/dev/oci_env_integration/actions/community.py +++ b/dev/oci_env_integration/actions/community.py @@ -5,6 +5,7 @@ { "env_file": "community.compose.env", "run_tests": True, + "run_playbooks": False, "db_restore": None, } ] diff --git a/dev/oci_env_integration/actions/insights.py b/dev/oci_env_integration/actions/insights.py index b5e59243ed..8165df3a29 100644 --- a/dev/oci_env_integration/actions/insights.py +++ b/dev/oci_env_integration/actions/insights.py @@ -5,6 +5,7 @@ { "env_file": "insights.compose.env", "run_tests": True, + "run_playbooks": False, "db_restore": None, # The minio client can take a long time to install diff --git a/dev/oci_env_integration/actions/iqe_rbac.py b/dev/oci_env_integration/actions/iqe_rbac.py index 8d72e88a6e..8cb72cd7e6 100644 --- a/dev/oci_env_integration/actions/iqe_rbac.py +++ b/dev/oci_env_integration/actions/iqe_rbac.py @@ -5,6 +5,7 @@ { "env_file": "standalone.compose.env", "run_tests": True, + "run_playbooks": False, "db_restore": None, "pytest_flags": "-m iqe_rbac_test" } diff --git a/dev/oci_env_integration/actions/keycloak.py b/dev/oci_env_integration/actions/keycloak.py index cca240b159..145bc96383 100644 --- a/dev/oci_env_integration/actions/keycloak.py +++ b/dev/oci_env_integration/actions/keycloak.py @@ -5,6 +5,7 @@ { "env_file": "keycloak.compose.env", "run_tests": True, + "run_playbooks": False, "db_restore": None, # the keycloak profile performs some setup after the service diff --git a/dev/oci_env_integration/actions/ldap.py b/dev/oci_env_integration/actions/ldap.py index 6dbff6767d..8b2da9e88f 100644 --- a/dev/oci_env_integration/actions/ldap.py +++ b/dev/oci_env_integration/actions/ldap.py @@ -5,6 +5,7 @@ { "env_file": "ldap.compose.env", "run_tests": True, + "run_playbooks": False, "db_restore": None, } ] diff --git a/dev/oci_env_integration/actions/rbac.py b/dev/oci_env_integration/actions/rbac.py index 7d933650dd..e4f8490592 100644 --- a/dev/oci_env_integration/actions/rbac.py +++ b/dev/oci_env_integration/actions/rbac.py @@ -5,6 +5,7 @@ { "env_file": "standalone.compose.env", "run_tests": True, + "run_playbooks": False, "db_restore": None, "pytest_flags": "-m rbac_roles" } diff --git a/dev/oci_env_integration/actions/standalone.py b/dev/oci_env_integration/actions/standalone.py index 0fd62ff911..6783362321 100644 --- a/dev/oci_env_integration/actions/standalone.py +++ b/dev/oci_env_integration/actions/standalone.py @@ -5,6 +5,7 @@ { "env_file": "standalone.compose.env", "run_tests": True, + "run_playbooks": False, "db_restore": None, } ] diff --git a/dev/oci_env_integration/actions/x_repo_search.py b/dev/oci_env_integration/actions/x_repo_search.py index d9de6e6b82..c0d0b2b52e 100644 --- a/dev/oci_env_integration/actions/x_repo_search.py +++ b/dev/oci_env_integration/actions/x_repo_search.py @@ -5,6 +5,7 @@ { "env_file": "standalone.compose.env", "run_tests": True, + "run_playbooks": False, "db_restore": None, "pytest_flags": "-m x_repo_search" } From 91999ea1f12dff5c5c2eac5d16d07d3edcf76428 Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Mon, 5 Feb 2024 10:58:35 -0500 Subject: [PATCH 8/9] build/install collection in container Issue: AAH-2421 --- .../ci_automation_hub_collection.yml | 17 ---------------- dev/oci_env_integration/actions/action_lib.py | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci_automation_hub_collection.yml b/.github/workflows/ci_automation_hub_collection.yml index 57576de4f2..587183621a 100644 --- a/.github/workflows/ci_automation_hub_collection.yml +++ b/.github/workflows/ci_automation_hub_collection.yml @@ -49,22 +49,5 @@ jobs: pip install -e $OCI_ENV_PATH/client/ mkdir $OCI_ENV_PATH/db_backup/ - - name: Checkout the galaxy collection - uses: actions/checkout@v4 - with: - repository: ansible/galaxy_collection - path: galaxy_collection - - - name: Build and install the collection - working-directory: galaxy_collection - run: | - # The ansible.cfg defined in the collection repository might break the test. We want the same variables for installation and running. - rm -f ansible.cfg - rm -f galaxy.yml - mv .github/files/galaxy.yml.j2 . - ansible all -i localhost, -c local -m template -a "src=galaxy.yml.j2 dest=galaxy.yml" -e collection_namespace=galaxy -e collection_name=galaxy -e collection_version=1.0.0 -e collection_repo=https://github.com/ansible/automation_hub_collection - ansible-galaxy collection build -vvv - ansible-galaxy collection install galaxy-galaxy-1.0.0.tar.gz -vvv - - name: run playbook tests run: make gh-action/${{ matrix.env.TEST_PROFILE }} diff --git a/dev/oci_env_integration/actions/action_lib.py b/dev/oci_env_integration/actions/action_lib.py index f10694cc1d..72a3ce58a1 100644 --- a/dev/oci_env_integration/actions/action_lib.py +++ b/dev/oci_env_integration/actions/action_lib.py @@ -129,6 +129,24 @@ def run_test(self): f" {pytest_flags} {self.flags}" ) + def install_galaxy_collection(self, env): + self.exec_cmd( + env, + "exec git clone https://github.com/ansible/galaxy_collection /src/galaxy_collection_test" + ) + + # The ansible.cfg defined in the collection repository might break the test. We want the same variables for installation and running. + self.exec_cmd(env, "exec rm -f /src/galaxy_collection_test/ansible.cfg") + self.exec_cmd(env, "exec rm -f /src/galaxy_collection_test/galaxy.yml") + self.exec_cmd(env, "exec mv /src/galaxy_collection_test/.github/files/galaxy.yml.j2 /src/galaxy_collection_test/") + self.exec_cmd( + env, + 'exec ansible all -i localhost, -c local -m template -a "src=/src/galaxy_collection_test/galaxy.yml.j2 dest=/src/galaxy_collection_test/galaxy.yml" -e collection_namespace=galaxy -e collection_name=galaxy -e collection_version=1.0.0 -e collection_repo=https://github.com/ansible/automation_hub_collection' + ) + self.exec_cmd(env, "exec ansible-galaxy collection build --output-path /src/galaxy_collection_test/ /src/galaxy_collection_test/ -vvv") + self.exec_cmd(env, "exec ansible-galaxy collection install /src/galaxy_collection_test/galaxy-galaxy-1.0.0.tar.gz -vvv --force") + self.exec_cmd(env, "exec rm -rf /src/galaxy_collection_test") + def run_playbooks(self): for env in self.envs: if self.envs[env]["run_playbooks"]: @@ -136,6 +154,8 @@ def run_playbooks(self): print(f"waiting {wait_time} seconds") time.sleep(wait_time) + self.install_galaxy_collection(env) + if len(self.envs[env]["playbooks"]) > 0: for playbook in self.envs[env]["playbooks"]: print(f"testing the {playbook} playbook") From caf50b951d673b44730a47632c82ba4aec385a05 Mon Sep 17 00:00:00 2001 From: Brian McLaughlin Date: Tue, 6 Feb 2024 10:05:43 -0500 Subject: [PATCH 9/9] need a valid user Issue: AAH-2421 --- dev/galaxy_collection_plays/vars.yml | 8 ++++---- dev/oci_env_integration/actions/action_lib.py | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/dev/galaxy_collection_plays/vars.yml b/dev/galaxy_collection_plays/vars.yml index 266d013188..b2d74cb13e 100644 --- a/dev/galaxy_collection_plays/vars.yml +++ b/dev/galaxy_collection_plays/vars.yml @@ -1,5 +1,5 @@ ah_host: http://localhost:55001 -ah_username: iqe_admin -ah_password: redhat -ah_path_prefix: automation-hub -ah_artifact_runner_absolute_path: /home/runner/work/galaxy_ng/galaxy_ng/galaxy_collection/galaxy-galaxy-1.0.0.tar.gz +ah_username: admin +ah_password: admin +ah_path_prefix: galaxy +ah_artifact_runner_absolute_path: /src/galaxy_collection_test/galaxy-galaxy-1.0.0.tar.gz diff --git a/dev/oci_env_integration/actions/action_lib.py b/dev/oci_env_integration/actions/action_lib.py index 72a3ce58a1..69fe07bb9e 100644 --- a/dev/oci_env_integration/actions/action_lib.py +++ b/dev/oci_env_integration/actions/action_lib.py @@ -32,7 +32,8 @@ class OCIEnvIntegrationTest: env_file (string, required): oci-env env file to use for the tests. These are all loaded from dev/oci_env_integration/oci_env_configs run_tests (boolean, required): if true, integration tests will be run inside this instance - run_playbooks (boolean, required): if true, Galaxy Collection playbook tests will be run inside this instance + run_playbooks (boolean, required): if true, Galaxy Collection playbook tests will be run + inside this instance db_restore (string, optional): database backup to restore before running tests These are all loaded from dev/oci_env_integration/oci_env_configs. When defining this, omit the file extension (ex: fixture, not fixtur.tar.gz) @@ -132,20 +133,20 @@ def run_test(self): def install_galaxy_collection(self, env): self.exec_cmd( env, - "exec git clone https://github.com/ansible/galaxy_collection /src/galaxy_collection_test" + "exec git clone https://github.com/ansible/galaxy_collection /src/galaxy_collection_test" # noqa E501 ) - # The ansible.cfg defined in the collection repository might break the test. We want the same variables for installation and running. + # The ansible.cfg defined in the collection repository might break the test. + # We want the same variables for installation and running. self.exec_cmd(env, "exec rm -f /src/galaxy_collection_test/ansible.cfg") self.exec_cmd(env, "exec rm -f /src/galaxy_collection_test/galaxy.yml") - self.exec_cmd(env, "exec mv /src/galaxy_collection_test/.github/files/galaxy.yml.j2 /src/galaxy_collection_test/") + self.exec_cmd(env, "exec mv /src/galaxy_collection_test/.github/files/galaxy.yml.j2 /src/galaxy_collection_test/") # noqa E501 self.exec_cmd( env, - 'exec ansible all -i localhost, -c local -m template -a "src=/src/galaxy_collection_test/galaxy.yml.j2 dest=/src/galaxy_collection_test/galaxy.yml" -e collection_namespace=galaxy -e collection_name=galaxy -e collection_version=1.0.0 -e collection_repo=https://github.com/ansible/automation_hub_collection' + 'exec ansible all -i localhost, -c local -m template -a "src=/src/galaxy_collection_test/galaxy.yml.j2 dest=/src/galaxy_collection_test/galaxy.yml" -e collection_namespace=galaxy -e collection_name=galaxy -e collection_version=1.0.0 -e collection_repo=https://github.com/ansible/automation_hub_collection' # noqa E501 ) - self.exec_cmd(env, "exec ansible-galaxy collection build --output-path /src/galaxy_collection_test/ /src/galaxy_collection_test/ -vvv") - self.exec_cmd(env, "exec ansible-galaxy collection install /src/galaxy_collection_test/galaxy-galaxy-1.0.0.tar.gz -vvv --force") - self.exec_cmd(env, "exec rm -rf /src/galaxy_collection_test") + self.exec_cmd(env, "exec ansible-galaxy collection build --output-path /src/galaxy_collection_test/ /src/galaxy_collection_test/ -vvv") # noqa E501 + self.exec_cmd(env, "exec ansible-galaxy collection install /src/galaxy_collection_test/galaxy-galaxy-1.0.0.tar.gz -vvv --force") # noqa E501 def run_playbooks(self): for env in self.envs: @@ -161,7 +162,7 @@ def run_playbooks(self): print(f"testing the {playbook} playbook") self.exec_cmd( env, - f"exec ansible-playbook src/galaxy_ng/dev/galaxy_collection_plays/{playbook} -vvv" + f"exec ansible-playbook src/galaxy_ng/dev/galaxy_collection_plays/{playbook} -vvv" # noqa E501 ) def dump_logs(self):