Skip to content

Commit f405e13

Browse files
author
petergmurphy
committed
Peter's changes
1 parent a678fbd commit f405e13

File tree

2 files changed

+52
-119
lines changed

2 files changed

+52
-119
lines changed
Lines changed: 40 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Install test matrix
2+
name: Test migration for failed database
33
on:
44
pull_request:
55
paths:
@@ -22,10 +22,10 @@ on:
2222
- .rubocop.yml
2323
- .puppet-lint.rc
2424
- .fixtures.yml
25-
branches: [main]
25+
branches: [PE-40163-replace-failed-postgres-plan]
2626
workflow_dispatch: {}
2727
jobs:
28-
test-install:
28+
test-migrate-failed-db:
2929
name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}
3030
runs-on: ubuntu-20.04
3131
env:
@@ -52,6 +52,16 @@ jobs:
5252
echo ::group::info:bundler
5353
bundle env
5454
echo ::endgroup::
55+
- name: Run migration
56+
run: |
57+
bundle exec bolt plan run peadm::replace_failed_postgresql \
58+
--modulepath=spec/fixtures/modules \
59+
primary_host=primary \
60+
replica_host=replica \
61+
working_postgresql_host=primary-pdb-postgresql \
62+
failed_postgresql_host=replica-pdb-postgresql \
63+
replacement_postgresql_host=primary-pdb-postgresql \
64+
--no-host-key-check
5565
- name: Provision test cluster
5666
timeout-minutes: 15
5767
run: |
@@ -76,55 +86,19 @@ jobs:
7686
echo ::group::info:inventory
7787
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
7888
echo ::endgroup::
89+
- name: Change PE inventory name
90+
run: |
91+
mv spec/fixtures/litmus_inventory.yaml spec/fixtures/litmus_inventory_PE_XL_DR.yaml
7992
- name: Install PE on test cluster
8093
timeout-minutes: 120
8194
run: |
8295
bundle exec bolt plan run peadm_spec::install_test_cluster \
83-
--inventoryfile spec/fixtures/litmus_inventory.yaml \
96+
--inventoryfile spec/fixtures/litmus_inventory_PE_XL_DR.yaml \
8497
--modulepath spec/fixtures/modules \
8598
architecture=${{ matrix.architecture }} \
8699
version=${{ matrix.version }} \
87100
console_password=${{ secrets.CONSOLE_PASSWORD }}
88-
- name: Tear down test cluster
89-
if: ${{ always() }}
90-
continue-on-error: true
91-
run: |-
92-
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
93-
echo ::group::tear_down
94-
bundle exec rake 'litmus:tear_down'
95-
echo ::endgroup::
96-
echo ::group::info:request
97-
cat request.json || true; echo
98-
echo ::endgroup::
99-
fi
100-
test-backup: # to replace failed VM
101-
name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}
102-
runs-on: ubuntu-20.04
103-
env:
104-
BOLT_GEM: true
105-
BOLT_DISABLE_ANALYTICS: true
106-
LANG: en_US.UTF-8
107-
strategy:
108-
fail-fast: false
109-
matrix:
110-
architecture: [extra-large-with-dr]
111-
version: [2023.8.0] # can change to test multiple versions once this one works
112-
image: [almalinux-cloud/almalinux-8]
113-
steps:
114-
- name: Checkout Source
115-
uses: actions/checkout@v4
116-
- name: Activate Ruby 2.7
117-
uses: ruby/setup-ruby@v1
118-
with:
119-
ruby-version: '2.7'
120-
bundler-cache: true
121-
- name: Print bundle environment
122-
if: ${{ github.repository_owner == 'puppetlabs' }}
123-
run: |
124-
echo ::group::info:bundler
125-
bundle env
126-
echo ::endgroup::
127-
- name: Provision test cluster
101+
- name: Provision single node
128102
timeout-minutes: 15
129103
run: |
130104
echo ::group::prepare
@@ -138,7 +112,7 @@ jobs:
138112
bundle exec bolt plan run peadm_spec::provision_test_cluster \
139113
--modulepath spec/fixtures/modules \
140114
provider=provision_service \
141-
image=${{ matrix.image }} \
115+
image=almalinux-cloud/almalinux-8 \
142116
architecture=standard \
143117
--log-level trace
144118
echo ::endgroup::
@@ -148,98 +122,45 @@ jobs:
148122
echo ::group::info:inventory
149123
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
150124
echo ::endgroup::
151-
- name: Install PE on test cluster
152-
timeout-minutes: 120
125+
- name: Change single node inventory name
153126
run: |
154-
bundle exec bolt plan run peadm_spec::install_test_cluster \
155-
--inventoryfile spec/fixtures/litmus_inventory.yaml \
156-
--modulepath spec/fixtures/modules \
157-
architecture=${{ matrix.architecture }} \
158-
version=${{ matrix.version }} \
159-
console_password=${{ secrets.CONSOLE_PASSWORD }}
160-
- name: Tear down test cluster
127+
mv spec/fixtures/litmus_inventory.yaml spec/fixtures/litmus_inventory_single_node.yaml
128+
# - name: Run migration
129+
# run: |
130+
# bundle exec bolt plan run peadm::replace_failed_postgresql \
131+
# --inventoryfile=spec/fixtures/litmus_inventory_PE_XL_DR.yaml \
132+
# --modulepath=spec/fixtures/modules \
133+
# primary_host=primary \
134+
# replica_host=replica \
135+
# working_postgresql_host=primary-pdb-postgresql \
136+
# failed_postgresql_host=replica-pdb-postgresql \
137+
# replacement_postgresql_host=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .uri' spec/fixtures/litmus_inventory_single_node.yaml) \
138+
# --no-host-key-check
139+
- name: Tear down PE XL DR test cluster
161140
if: ${{ always() }}
162141
continue-on-error: true
163142
run: |-
164-
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
143+
if [ -f spec/fixtures/litmus_inventory_PE_XL_DR.yaml ]; then
144+
mv spec/fixtures/litmus_inventory_PE_XL_DR.yaml spec/fixtures/litmus_inventory.yaml
165145
echo ::group::tear_down
166146
bundle exec rake 'litmus:tear_down'
167147
echo ::endgroup::
168148
echo ::group::info:request
169149
cat request.json || true; echo
170150
echo ::endgroup::
151+
rm -f spec/fixtures/litmus_inventory.yaml
171152
fi
172-
173-
test-backup: # to replace failed VM
174-
test-install:
175-
name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}
176-
runs-on: ubuntu-20.04
177-
env:
178-
BOLT_GEM: true
179-
BOLT_DISABLE_ANALYTICS: true
180-
LANG: en_US.UTF-8
181-
strategy:
182-
fail-fast: false
183-
matrix:
184-
architecture: [extra-large-with-dr]
185-
version: [2023.8.0] # can change to test multiple versions once this one works
186-
image: [almalinux-cloud/almalinux-8]
187-
steps:
188-
- name: Checkout Source
189-
uses: actions/checkout@v4
190-
- name: Activate Ruby 2.7
191-
uses: ruby/setup-ruby@v1
192-
with:
193-
ruby-version: '2.7'
194-
bundler-cache: true
195-
- name: Print bundle environment
196-
if: ${{ github.repository_owner == 'puppetlabs' }}
197-
run: |
198-
echo ::group::info:bundler
199-
bundle env
200-
echo ::endgroup::
201-
- name: Provision test cluster
202-
timeout-minutes: 15
203-
run: |
204-
echo ::group::prepare
205-
mkdir -p $HOME/.ssh
206-
echo 'Host *' > $HOME/.ssh/config
207-
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
208-
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
209-
bundle exec rake spec_prep
210-
echo ::endgroup::
211-
echo ::group::provision
212-
bundle exec bolt plan run peadm_spec::provision_test_cluster \
213-
--modulepath spec/fixtures/modules \
214-
provider=provision_service \
215-
image=${{ matrix.image }} \
216-
architecture=${{ matrix.architecture }} \
217-
--log-level trace
218-
echo ::endgroup::
219-
echo ::group::info:request
220-
cat request.json || true; echo
221-
echo ::endgroup::
222-
echo ::group::info:inventory
223-
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
224-
echo ::endgroup::
225-
- name: Install PE on test cluster
226-
timeout-minutes: 120
227-
run: |
228-
bundle exec bolt plan run peadm_spec::install_test_cluster \
229-
--inventoryfile spec/fixtures/litmus_inventory.yaml \
230-
--modulepath spec/fixtures/modules \
231-
architecture=${{ matrix.architecture }} \
232-
version=${{ matrix.version }} \
233-
console_password=${{ secrets.CONSOLE_PASSWORD }}
234-
- name: Tear down test cluster
153+
- name: Tear down single node
235154
if: ${{ always() }}
236155
continue-on-error: true
237156
run: |-
238-
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
157+
if [ -f spec/fixtures/litmus_inventory_single_node.yaml ]; then
158+
mv spec/fixtures/litmus_inventory_single_node.yaml spec/fixtures/litmus_inventory.yaml
239159
echo ::group::tear_down
240160
bundle exec rake 'litmus:tear_down'
241161
echo ::endgroup::
242162
echo ::group::info:request
243163
cat request.json || true; echo
244164
echo ::endgroup::
165+
rm -f spec/fixtures/litmus_inventory.yaml
245166
fi
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
plan peadm_spec::test_replace_failed_postgresql(
2+
Peadm::SingleTargetSpec $primary_host,
3+
Peadm::SingleTargetSpec $replica_host,
4+
Peadm::SingleTargetSpec $working_postgresql_host,
5+
Peadm::SingleTargetSpec $failed_postgresql_host,
6+
Peadm::SingleTargetSpec $replacement_postgresql_host,
7+
) {
8+
# add any necessary checks here
9+
run_plan('peadm::replace_failed_postgresql', $primary_host, $replica_host, $working_postgresql_host, $failed_postgresql_host,
10+
$replacement_postgresql_host)
11+
# add any necessary checks here
12+
}

0 commit comments

Comments
 (0)