Skip to content

Commit

Permalink
PE-38815 add_replica plan updated, test matrix added (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
CoMfUcIoS committed Sep 2, 2024
1 parent ab9db39 commit 7d37765
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 23 deletions.
124 changes: 124 additions & 0 deletions .github/workflows/test-add-replica-matrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
name: "Add replica matrix"

on:
pull_request:
paths:
- ".github/workflows/**/*"
- "spec/**/*"
- "lib/**/*"
- "tasks/**/*"
- "functions/**/*"
- "types/**/*"
- "plans/**/*"
- "hiera/**/*"
- "manifests/**/*"
- "templates/**/*"
- "files/**/*"
- "metadata.json"
- "Rakefile"
- "Gemfile"
- "provision.yaml"
- ".rspec"
- ".rubocop.yml"
- ".puppet-lint.rc"
- ".fixtures.yml"
branches: [main]
workflow_dispatch: {}

jobs:
test-add-replica:
name: "PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}"
runs-on: ubuntu-20.04
env:
BOLT_GEM: true
BOLT_DISABLE_ANALYTICS: true
LANG: "en_US.UTF-8"
strategy:
fail-fast: false
matrix:
architecture:
- standard
- standard-with-dr
- large
- extra-large
version:
- 2021.7.7
- 2023.6.0
image:
- almalinux-cloud/almalinux-8
steps:
- name: "Checkout Source"
uses: actions/checkout@v2

- name: "Activate Ruby 2.7"
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
bundler-cache: true

- name: "Print bundle environment"
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
echo ::group::info:bundler
bundle env
echo ::endgroup::
- name: 'Provision test cluster (specified architecture and a spare replica)'
timeout-minutes: 15
run: |
echo ::group::prepare
mkdir -p $HOME/.ssh
echo 'Host *' > $HOME/.ssh/config
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
bundle exec rake spec_prep
echo ::endgroup::
echo ::group::provision
bundle exec bolt plan run peadm_spec::provision_test_cluster \
--modulepath spec/fixtures/modules \
provider=provision_service \
image=${{ matrix.image }} \
architecture=${{ matrix.architecture }}-and-spare-replica
echo ::endgroup::
echo ::group::info:request
cat request.json || true; echo
echo ::endgroup::
echo ::group::info:inventory
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
echo ::endgroup::
- name: "Install PE on test cluster"
timeout-minutes: 120
run: |
bundle exec bolt plan run peadm_spec::install_test_cluster \
--inventoryfile spec/fixtures/litmus_inventory.yaml \
--modulepath spec/fixtures/modules \
architecture=${{ matrix.architecture }} \
version=${{ matrix.version }} \
code_manager_auto_configure=true
- name: 'Run add_replica plan'
timeout-minutes: 60
run: |
bundle exec bolt plan run peadm_spec::add_replica -v \
--inventoryfile spec/fixtures/litmus_inventory.yaml \
--modulepath spec/fixtures/modules \
--stream
- name: 'Tear down test cluster'
if: ${{ always() }}
continue-on-error: true
run: |
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
echo ::group::tear_down
bundle exec rake 'litmus:tear_down'
echo ::endgroup::
echo ::group::info:request
cat request.json || true; echo
echo ::endgroup::
fi
37 changes: 19 additions & 18 deletions .github/workflows/test-add-replica.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ on:
workflow_dispatch:
inputs:
image:
description: 'GCP image for test cluster'
description: "GCP image for test cluster"
required: true
default: 'almalinux-cloud/almalinux-8'
default: "almalinux-cloud/almalinux-8"
architecture:
description: 'PE architecture to test'
description: "PE architecture to test"
required: true
default: 'standard'
default: "standard"
version:
description: 'PE version to install'
description: "PE version to install"
required: true
default: '2021.7.8'
default: "2021.7.8"
ssh-debugging:
description: 'Boolean; whether or not to pause for ssh debugging'
description: "Boolean; whether or not to pause for ssh debugging"
required: true
default: 'false'
default: "false"

jobs:
test-add-replica:
Expand All @@ -28,7 +28,7 @@ jobs:
env:
BOLT_GEM: true
BOLT_DISABLE_ANALYTICS: true
LANG: 'en_US.UTF-8'
LANG: "en_US.UTF-8"
strategy:
fail-fast: false
matrix:
Expand All @@ -40,7 +40,7 @@ jobs:
- "${{ github.event.inputs.image }}"

steps:
- name: 'Start SSH session'
- name: "Start SSH session"
if: ${{ github.event.inputs.ssh-debugging == 'true' }}
uses: luchihoratiu/debug-via-ssh@main
with:
Expand All @@ -63,7 +63,7 @@ jobs:
bundle env
echo ::endgroup::
- name: 'Provision test cluster (specified architecture with added DR)'
- name: "Provision test cluster (specified architecture with spare replica)"
timeout-minutes: 15
run: |
echo ::group::prepare
Expand All @@ -79,7 +79,7 @@ jobs:
--modulepath spec/fixtures/modules \
provider=provision_service \
image=${{ matrix.image }} \
architecture=${{ matrix.architecture }}-with-dr
architecture=${{ matrix.architecture }}-and-spare-replica
echo ::endgroup::
echo ::group::info:request
Expand All @@ -90,7 +90,7 @@ jobs:
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
echo ::endgroup::
- name: 'Install PE on test cluster'
- name: "Install PE on test cluster"
timeout-minutes: 120
run: |
bundle exec bolt plan run peadm_spec::install_test_cluster \
Expand All @@ -100,14 +100,15 @@ jobs:
version=${{ matrix.version }} \
console_password=${{ secrets.CONSOLE_PASSWORD }}
- name: 'Run add_replica plan'
timeout-minutes: 30
- name: "Run add_replica plan"
timeout-minutes: 60
run: |
bundle exec bolt plan run peadm_spec::add_replica -v \
--inventoryfile spec/fixtures/litmus_inventory.yaml \
--modulepath spec/fixtures/modules
--modulepath spec/fixtures/modules \
--stream
- name: 'Wait as long as the file ${HOME}/pause file is present'
- name: "Wait as long as the file ${HOME}/pause file is present"
if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }}
run: |
while [ -f "${HOME}/pause" ] ; do
Expand All @@ -116,7 +117,7 @@ jobs:
done
echo "${HOME}/pause absent, continuing workflow."
- name: 'Tear down test cluster'
- name: "Tear down test cluster"
if: ${{ always() }}
continue-on-error: true
run: |
Expand Down
8 changes: 4 additions & 4 deletions plans/add_replica.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
}

run_plan('peadm::util::update_classification', $primary_target,
server_a_host => $replica_avail_group_letter ? { 'A' => $replica_host, default => undef },
server_b_host => $replica_avail_group_letter ? { 'B' => $replica_host, default => undef },
internal_compiler_a_pool_address => $replica_avail_group_letter ? { 'A' => $replica_host, default => undef },
internal_compiler_b_pool_address => $replica_avail_group_letter ? { 'B' => $replica_host, default => undef },
server_a_host => $replica_avail_group_letter ? { 'A' => $replica_target.peadm::certname(), default => undef },
server_b_host => $replica_avail_group_letter ? { 'B' => $replica_target.peadm::certname(), default => undef },
internal_compiler_a_pool_address => $replica_avail_group_letter ? { 'A' => $replica_target.peadm::certname(), default => undef },
internal_compiler_b_pool_address => $replica_avail_group_letter ? { 'B' => $replica_target.peadm::certname(), default => undef },
peadm_config => $peadm_config
)

Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/peadm_spec/plans/add_replica.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

$primary_host = $t.filter |$n| { $n.vars['role'] == 'primary' }
$replica_host = $t.filter |$n| { $n.vars['role'] == 'replica' }
$replica_host = $t.filter |$n| { $n.vars['role'] == 'spare-replica' }
$replica_postgresql_host = $t.filter |$n| { $n.vars['role'] == 'replica-pdb-postgresql' }

if $replica_host == [] {
Expand Down
15 changes: 15 additions & 0 deletions spec/acceptance/peadm_spec/plans/provision_test_cluster.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,24 @@
'standard-with-dr': {
['primary', 'replica']
}
'standard-and-spare-replica': {
['primary', 'spare-replica']
}
'standard-with-dr-and-spare-replica': {
['primary', 'replica', 'spare-replica']
}
'large': {
['primary', 'compiler']
}
'large-with-dr': {
['primary', 'compiler', 'replica', 'compiler']
}
'large-and-spare-replica': {
['primary', 'compiler', 'compiler', 'spare-replica']
}
'large-with-dr-and-spare-replica': {
['primary', 'compiler', 'replica', 'compiler', 'spare-replica']
}
'extra-large': {
['primary', 'primary-pdb-postgresql', 'compiler']
}
Expand All @@ -29,6 +41,9 @@
'extra-large-with-extra-compiler': {
['primary', 'primary-pdb-postgresql', 'compiler', 'unconfigured-compiler']
}
'extra-large-and-spare-replica': {
['primary', 'primary-pdb-postgresql', 'compiler', 'compiler', 'spare-replica']
}
'extra-large-with-dr-and-spare-replica': {
['primary', 'primary-pdb-postgresql', 'compiler',
'replica', 'replica-pdb-postgresql', 'compiler', 'spare-replica']
Expand Down

0 comments on commit 7d37765

Please sign in to comment.