Skip to content

Commit 4d1ba66

Browse files
committed
PE-38815 add_replica plan updated, test matrix added (#480)
1 parent 33b5dac commit 4d1ba66

File tree

5 files changed

+145
-6
lines changed

5 files changed

+145
-6
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
--modulepath spec/fixtures/modules \
6969
provider=provision_service \
7070
image=${{ matrix.image }} \
71-
architecture=${{ matrix.architecture }}-with-dr
71+
architecture=${{ matrix.architecture }}-and-spare-replica
7272
echo ::endgroup::
7373
echo ::group::info:request
7474
cat request.json || true; echo

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)