From 78cb9e70daa2f280ef15a25d175625ddcc2833f5 Mon Sep 17 00:00:00 2001 From: Aaron Shannon Date: Thu, 5 Sep 2024 16:34:48 +0100 Subject: [PATCH 1/5] PE-39228 Smoke test created and added to workflow --- .github/workflows/test-add-replica.yaml | 6 ++++++ .../peadm_spec/plans/verify_replica.pp | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 spec/acceptance/peadm_spec/plans/verify_replica.pp diff --git a/.github/workflows/test-add-replica.yaml b/.github/workflows/test-add-replica.yaml index 217f1b1d2..a7cf1ae53 100644 --- a/.github/workflows/test-add-replica.yaml +++ b/.github/workflows/test-add-replica.yaml @@ -92,6 +92,12 @@ jobs: --inventoryfile spec/fixtures/litmus_inventory.yaml \ --modulepath spec/fixtures/modules \ --stream + - name: Verify that replica was added + timeout-minutes: 10 + run: | + bundle exec bolt plan run peadm_spec::verify_replica -v \ + --inventoryfile spec/fixtures/litmus_inventory.yaml \ + --modulepath spec/fixtures/modules - name: Wait as long as the file ${HOME}/pause file is present if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }} run: | diff --git a/spec/acceptance/peadm_spec/plans/verify_replica.pp b/spec/acceptance/peadm_spec/plans/verify_replica.pp new file mode 100644 index 000000000..d9b5a45da --- /dev/null +++ b/spec/acceptance/peadm_spec/plans/verify_replica.pp @@ -0,0 +1,20 @@ +plan peadm_spec::verify_replica() { + $t = get_targets('*') + wait_until_available($t) + + $primary_host = $t.filter |$n| { $n.vars['role'] == 'primary' } + +if $primary_host == [] { + fail_plan('"primary" role missing from inventory, cannot continue') +} + +$result = run_task('peadm::get_peadm_config', $primary_host, '_catch_errors' => true) + +$replica_host = $result.first['result']['params']['replica_host'] + +if $replica_host == undef or $replica_host == null { + fail_plan("No replica was found in the PE configuration") +} else { + out::message("Replica added successfully: ${replica_host}") +} +} \ No newline at end of file From e11932ea12ad856bce8efb3a99d444ee547c8a75 Mon Sep 17 00:00:00 2001 From: Aaron Shannon Date: Thu, 5 Sep 2024 16:57:58 +0100 Subject: [PATCH 2/5] PE-39228 Workflow updated --- .github/workflows/test-add-replica.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-add-replica.yaml b/.github/workflows/test-add-replica.yaml index a7cf1ae53..c96af945c 100644 --- a/.github/workflows/test-add-replica.yaml +++ b/.github/workflows/test-add-replica.yaml @@ -84,7 +84,8 @@ jobs: --modulepath spec/fixtures/modules \ architecture=${{ matrix.architecture }} \ version=${{ matrix.version }} \ - console_password=${{ secrets.CONSOLE_PASSWORD }} + console_password=${{ secrets.CONSOLE_PASSWORD }} \ + code_manager_auto_configure=true - name: Run add_replica plan timeout-minutes: 60 run: | From b5150b47ee861f3bd6abbb621e431f721a19e13f Mon Sep 17 00:00:00 2001 From: Aaron Shannon Date: Mon, 9 Sep 2024 11:26:57 +0100 Subject: [PATCH 3/5] PE-39228 Spec updated, smoke test added to matrix --- .github/workflows/test-add-replica-matrix.yaml | 7 +++++++ spec/acceptance/peadm_spec/plans/verify_replica.pp | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-add-replica-matrix.yaml b/.github/workflows/test-add-replica-matrix.yaml index df05dd054..42e3a781e 100644 --- a/.github/workflows/test-add-replica-matrix.yaml +++ b/.github/workflows/test-add-replica-matrix.yaml @@ -24,6 +24,7 @@ on: - .fixtures.yml branches: [main] workflow_dispatch: {} + push: jobs: test-add-replica: name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }} @@ -92,6 +93,12 @@ jobs: --inventoryfile spec/fixtures/litmus_inventory.yaml \ --modulepath spec/fixtures/modules \ --stream + - name: Verify that replica was added + timeout-minutes: 10 + run: | + bundle exec bolt plan run peadm_spec::verify_replica -v \ + --inventoryfile spec/fixtures/litmus_inventory.yaml \ + --modulepath spec/fixtures/modules - name: Tear down test cluster if: ${{ always() }} continue-on-error: true diff --git a/spec/acceptance/peadm_spec/plans/verify_replica.pp b/spec/acceptance/peadm_spec/plans/verify_replica.pp index d9b5a45da..154d8d83e 100644 --- a/spec/acceptance/peadm_spec/plans/verify_replica.pp +++ b/spec/acceptance/peadm_spec/plans/verify_replica.pp @@ -8,9 +8,9 @@ fail_plan('"primary" role missing from inventory, cannot continue') } -$result = run_task('peadm::get_peadm_config', $primary_host, '_catch_errors' => true) +$result = run_task('peadm::get_peadm_config', $primary_host, '_catch_errors' => true).first.to_data() -$replica_host = $result.first['result']['params']['replica_host'] +$replica_host = $result['value']['params']['replica_host'] if $replica_host == undef or $replica_host == null { fail_plan("No replica was found in the PE configuration") From d0dbab3bd8cebf90ce5035541e1cc5f3ed6b149d Mon Sep 17 00:00:00 2001 From: Aaron Shannon Date: Tue, 10 Sep 2024 13:49:04 +0100 Subject: [PATCH 4/5] PE-39228 Versions updated, push trigger removed from matrix --- .github/workflows/test-add-replica-matrix.yaml | 3 +-- .github/workflows/test-add-replica.yaml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-add-replica-matrix.yaml b/.github/workflows/test-add-replica-matrix.yaml index 42e3a781e..1b6d98b5e 100644 --- a/.github/workflows/test-add-replica-matrix.yaml +++ b/.github/workflows/test-add-replica-matrix.yaml @@ -24,7 +24,6 @@ on: - .fixtures.yml branches: [main] workflow_dispatch: {} - push: jobs: test-add-replica: name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }} @@ -37,7 +36,7 @@ jobs: fail-fast: false matrix: architecture: [standard, standard-with-dr, large, extra-large] - version: [2021.7.7, 2023.6.0] + version: [2021.7.9, 2023.8.0] image: [almalinux-cloud/almalinux-8] steps: - name: Checkout Source diff --git a/.github/workflows/test-add-replica.yaml b/.github/workflows/test-add-replica.yaml index c96af945c..5fe8787fe 100644 --- a/.github/workflows/test-add-replica.yaml +++ b/.github/workflows/test-add-replica.yaml @@ -14,7 +14,7 @@ on: version: description: PE version to install required: true - default: 2021.7.8 + default: 2021.7.9 ssh-debugging: description: Boolean; whether or not to pause for ssh debugging required: true From a6023efd5f0a6a8941bf27021714c34799f01d73 Mon Sep 17 00:00:00 2001 From: Aaron Shannon Date: Tue, 10 Sep 2024 14:20:33 +0100 Subject: [PATCH 5/5] PE-39228 whitespace fixed --- .../peadm_spec/plans/verify_replica.pp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/acceptance/peadm_spec/plans/verify_replica.pp b/spec/acceptance/peadm_spec/plans/verify_replica.pp index 154d8d83e..e1f484eb8 100644 --- a/spec/acceptance/peadm_spec/plans/verify_replica.pp +++ b/spec/acceptance/peadm_spec/plans/verify_replica.pp @@ -4,17 +4,17 @@ $primary_host = $t.filter |$n| { $n.vars['role'] == 'primary' } -if $primary_host == [] { - fail_plan('"primary" role missing from inventory, cannot continue') -} + if $primary_host == [] { + fail_plan('"primary" role missing from inventory, cannot continue') + } -$result = run_task('peadm::get_peadm_config', $primary_host, '_catch_errors' => true).first.to_data() + $result = run_task('peadm::get_peadm_config', $primary_host, '_catch_errors' => true).first.to_data() -$replica_host = $result['value']['params']['replica_host'] + $replica_host = $result['value']['params']['replica_host'] -if $replica_host == undef or $replica_host == null { - fail_plan("No replica was found in the PE configuration") -} else { - out::message("Replica added successfully: ${replica_host}") + if $replica_host == undef or $replica_host == null { + fail_plan("No replica was found in the PE configuration") + } else { + out::message("Replica added successfully: ${replica_host}") + } } -} \ No newline at end of file