From 78cb9e70daa2f280ef15a25d175625ddcc2833f5 Mon Sep 17 00:00:00 2001 From: Aaron Shannon Date: Thu, 5 Sep 2024 16:34:48 +0100 Subject: [PATCH] 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 217f1b1d..a7cf1ae5 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 00000000..d9b5a45d --- /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