Skip to content

Commit 7d37765

Browse files
committed
PE-38815 add_replica plan updated, test matrix added (#480)
1 parent ab9db39 commit 7d37765

File tree

5 files changed

+163
-23
lines changed

5 files changed

+163
-23
lines changed

Diff for: .github/workflows/test-add-replica-matrix.yaml

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
name: "Add replica matrix"
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- ".github/workflows/**/*"
8+
- "spec/**/*"
9+
- "lib/**/*"
10+
- "tasks/**/*"
11+
- "functions/**/*"
12+
- "types/**/*"
13+
- "plans/**/*"
14+
- "hiera/**/*"
15+
- "manifests/**/*"
16+
- "templates/**/*"
17+
- "files/**/*"
18+
- "metadata.json"
19+
- "Rakefile"
20+
- "Gemfile"
21+
- "provision.yaml"
22+
- ".rspec"
23+
- ".rubocop.yml"
24+
- ".puppet-lint.rc"
25+
- ".fixtures.yml"
26+
branches: [main]
27+
workflow_dispatch: {}
28+
29+
jobs:
30+
test-add-replica:
31+
name: "PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}"
32+
runs-on: ubuntu-20.04
33+
env:
34+
BOLT_GEM: true
35+
BOLT_DISABLE_ANALYTICS: true
36+
LANG: "en_US.UTF-8"
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
architecture:
41+
- standard
42+
- standard-with-dr
43+
- large
44+
- extra-large
45+
version:
46+
- 2021.7.7
47+
- 2023.6.0
48+
image:
49+
- almalinux-cloud/almalinux-8
50+
steps:
51+
- name: "Checkout Source"
52+
uses: actions/checkout@v2
53+
54+
- name: "Activate Ruby 2.7"
55+
uses: ruby/setup-ruby@v1
56+
with:
57+
ruby-version: "2.7"
58+
bundler-cache: true
59+
60+
- name: "Print bundle environment"
61+
if: ${{ github.repository_owner == 'puppetlabs' }}
62+
run: |
63+
echo ::group::info:bundler
64+
bundle env
65+
echo ::endgroup::
66+
67+
- name: 'Provision test cluster (specified architecture and a spare replica)'
68+
timeout-minutes: 15
69+
run: |
70+
echo ::group::prepare
71+
mkdir -p $HOME/.ssh
72+
echo 'Host *' > $HOME/.ssh/config
73+
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
74+
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
75+
bundle exec rake spec_prep
76+
echo ::endgroup::
77+
78+
echo ::group::provision
79+
bundle exec bolt plan run peadm_spec::provision_test_cluster \
80+
--modulepath spec/fixtures/modules \
81+
provider=provision_service \
82+
image=${{ matrix.image }} \
83+
architecture=${{ matrix.architecture }}-and-spare-replica
84+
echo ::endgroup::
85+
86+
echo ::group::info:request
87+
cat request.json || true; echo
88+
echo ::endgroup::
89+
90+
echo ::group::info:inventory
91+
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
92+
echo ::endgroup::
93+
94+
- name: "Install PE on test cluster"
95+
timeout-minutes: 120
96+
run: |
97+
bundle exec bolt plan run peadm_spec::install_test_cluster \
98+
--inventoryfile spec/fixtures/litmus_inventory.yaml \
99+
--modulepath spec/fixtures/modules \
100+
architecture=${{ matrix.architecture }} \
101+
version=${{ matrix.version }} \
102+
code_manager_auto_configure=true
103+
104+
- name: 'Run add_replica plan'
105+
timeout-minutes: 60
106+
run: |
107+
bundle exec bolt plan run peadm_spec::add_replica -v \
108+
--inventoryfile spec/fixtures/litmus_inventory.yaml \
109+
--modulepath spec/fixtures/modules \
110+
--stream
111+
112+
- name: 'Tear down test cluster'
113+
if: ${{ always() }}
114+
continue-on-error: true
115+
run: |
116+
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
117+
echo ::group::tear_down
118+
bundle exec rake 'litmus:tear_down'
119+
echo ::endgroup::
120+
121+
echo ::group::info:request
122+
cat request.json || true; echo
123+
echo ::endgroup::
124+
fi

Diff for: .github/workflows/test-add-replica.yaml

+19-18
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ on:
55
workflow_dispatch:
66
inputs:
77
image:
8-
description: 'GCP image for test cluster'
8+
description: "GCP image for test cluster"
99
required: true
10-
default: 'almalinux-cloud/almalinux-8'
10+
default: "almalinux-cloud/almalinux-8"
1111
architecture:
12-
description: 'PE architecture to test'
12+
description: "PE architecture to test"
1313
required: true
14-
default: 'standard'
14+
default: "standard"
1515
version:
16-
description: 'PE version to install'
16+
description: "PE version to install"
1717
required: true
18-
default: '2021.7.8'
18+
default: "2021.7.8"
1919
ssh-debugging:
20-
description: 'Boolean; whether or not to pause for ssh debugging'
20+
description: "Boolean; whether or not to pause for ssh debugging"
2121
required: true
22-
default: 'false'
22+
default: "false"
2323

2424
jobs:
2525
test-add-replica:
@@ -28,7 +28,7 @@ jobs:
2828
env:
2929
BOLT_GEM: true
3030
BOLT_DISABLE_ANALYTICS: true
31-
LANG: 'en_US.UTF-8'
31+
LANG: "en_US.UTF-8"
3232
strategy:
3333
fail-fast: false
3434
matrix:
@@ -40,7 +40,7 @@ jobs:
4040
- "${{ github.event.inputs.image }}"
4141

4242
steps:
43-
- name: 'Start SSH session'
43+
- name: "Start SSH session"
4444
if: ${{ github.event.inputs.ssh-debugging == 'true' }}
4545
uses: luchihoratiu/debug-via-ssh@main
4646
with:
@@ -63,7 +63,7 @@ jobs:
6363
bundle env
6464
echo ::endgroup::
6565
66-
- name: 'Provision test cluster (specified architecture with added DR)'
66+
- name: "Provision test cluster (specified architecture with spare replica)"
6767
timeout-minutes: 15
6868
run: |
6969
echo ::group::prepare
@@ -79,7 +79,7 @@ jobs:
7979
--modulepath spec/fixtures/modules \
8080
provider=provision_service \
8181
image=${{ matrix.image }} \
82-
architecture=${{ matrix.architecture }}-with-dr
82+
architecture=${{ matrix.architecture }}-and-spare-replica
8383
echo ::endgroup::
8484
8585
echo ::group::info:request
@@ -90,7 +90,7 @@ jobs:
9090
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
9191
echo ::endgroup::
9292
93-
- name: 'Install PE on test cluster'
93+
- name: "Install PE on test cluster"
9494
timeout-minutes: 120
9595
run: |
9696
bundle exec bolt plan run peadm_spec::install_test_cluster \
@@ -100,14 +100,15 @@ jobs:
100100
version=${{ matrix.version }} \
101101
console_password=${{ secrets.CONSOLE_PASSWORD }}
102102
103-
- name: 'Run add_replica plan'
104-
timeout-minutes: 30
103+
- name: "Run add_replica plan"
104+
timeout-minutes: 60
105105
run: |
106106
bundle exec bolt plan run peadm_spec::add_replica -v \
107107
--inventoryfile spec/fixtures/litmus_inventory.yaml \
108-
--modulepath spec/fixtures/modules
108+
--modulepath spec/fixtures/modules \
109+
--stream
109110
110-
- name: 'Wait as long as the file ${HOME}/pause file is present'
111+
- name: "Wait as long as the file ${HOME}/pause file is present"
111112
if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }}
112113
run: |
113114
while [ -f "${HOME}/pause" ] ; do
@@ -116,7 +117,7 @@ jobs:
116117
done
117118
echo "${HOME}/pause absent, continuing workflow."
118119
119-
- name: 'Tear down test cluster'
120+
- name: "Tear down test cluster"
120121
if: ${{ always() }}
121122
continue-on-error: true
122123
run: |

Diff for: plans/add_replica.pp

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@
9090
}
9191

9292
run_plan('peadm::util::update_classification', $primary_target,
93-
server_a_host => $replica_avail_group_letter ? { 'A' => $replica_host, default => undef },
94-
server_b_host => $replica_avail_group_letter ? { 'B' => $replica_host, default => undef },
95-
internal_compiler_a_pool_address => $replica_avail_group_letter ? { 'A' => $replica_host, default => undef },
96-
internal_compiler_b_pool_address => $replica_avail_group_letter ? { 'B' => $replica_host, default => undef },
93+
server_a_host => $replica_avail_group_letter ? { 'A' => $replica_target.peadm::certname(), default => undef },
94+
server_b_host => $replica_avail_group_letter ? { 'B' => $replica_target.peadm::certname(), default => undef },
95+
internal_compiler_a_pool_address => $replica_avail_group_letter ? { 'A' => $replica_target.peadm::certname(), default => undef },
96+
internal_compiler_b_pool_address => $replica_avail_group_letter ? { 'B' => $replica_target.peadm::certname(), default => undef },
9797
peadm_config => $peadm_config
9898
)
9999

Diff for: spec/acceptance/peadm_spec/plans/add_replica.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010

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

1515
if $replica_host == [] {

Diff for: spec/acceptance/peadm_spec/plans/provision_test_cluster.pp

+15
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,24 @@
1111
'standard-with-dr': {
1212
['primary', 'replica']
1313
}
14+
'standard-and-spare-replica': {
15+
['primary', 'spare-replica']
16+
}
17+
'standard-with-dr-and-spare-replica': {
18+
['primary', 'replica', 'spare-replica']
19+
}
1420
'large': {
1521
['primary', 'compiler']
1622
}
1723
'large-with-dr': {
1824
['primary', 'compiler', 'replica', 'compiler']
1925
}
26+
'large-and-spare-replica': {
27+
['primary', 'compiler', 'compiler', 'spare-replica']
28+
}
29+
'large-with-dr-and-spare-replica': {
30+
['primary', 'compiler', 'replica', 'compiler', 'spare-replica']
31+
}
2032
'extra-large': {
2133
['primary', 'primary-pdb-postgresql', 'compiler']
2234
}
@@ -29,6 +41,9 @@
2941
'extra-large-with-extra-compiler': {
3042
['primary', 'primary-pdb-postgresql', 'compiler', 'unconfigured-compiler']
3143
}
44+
'extra-large-and-spare-replica': {
45+
['primary', 'primary-pdb-postgresql', 'compiler', 'compiler', 'spare-replica']
46+
}
3247
'extra-large-with-dr-and-spare-replica': {
3348
['primary', 'primary-pdb-postgresql', 'compiler',
3449
'replica', 'replica-pdb-postgresql', 'compiler', 'spare-replica']

0 commit comments

Comments
 (0)