Skip to content

Commit 93235f3

Browse files
author
petergmurphy
committed
Add CI test for replace_failed_postgresql plan
1 parent 6f88c9a commit 93235f3

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
name: Test replace failed PostgreSQL
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/**/*
7+
- spec/**/*
8+
- lib/**/*
9+
- tasks/**/*
10+
- functions/**/*
11+
- types/**/*
12+
- plans/**/*
13+
- hiera/**/*
14+
- manifests/**/*
15+
- templates/**/*
16+
- files/**/*
17+
- metadata.json
18+
- Rakefile
19+
- Gemfile
20+
- provision.yaml
21+
- .rspec
22+
- .rubocop.yml
23+
- .puppet-lint.rc
24+
- .fixtures.yml
25+
branches: [main]
26+
workflow_dispatch: {}
27+
jobs:
28+
test-replace-failed-postgresql:
29+
name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}
30+
runs-on: ubuntu-20.04
31+
env:
32+
BOLT_GEM: true
33+
BOLT_DISABLE_ANALYTICS: true
34+
LANG: en_US.UTF-8
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
architecture: [extra-large-with-dr-and-spare-replica]
39+
install_architecture: [extra-large-with-dr]
40+
version: [2023.8.0] # can change to test multiple versions once this one works
41+
image: [almalinux-cloud/almalinux-8]
42+
steps:
43+
- name: Checkout Source
44+
uses: actions/checkout@v4
45+
with:
46+
ref: ${{ github.head_ref }}
47+
- name: Activate Ruby 2.7
48+
uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: '2.7'
51+
bundler-cache: true
52+
- name: Print bundle environment
53+
if: ${{ github.repository_owner == 'puppetlabs' }}
54+
run: |
55+
echo ::group::info:bundler
56+
bundle env
57+
echo ::endgroup::
58+
- name: Provision test cluster
59+
timeout-minutes: 15
60+
run: |
61+
echo ::group::prepare
62+
mkdir -p $HOME/.ssh
63+
echo 'Host *' > $HOME/.ssh/config
64+
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
65+
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
66+
bundle exec rake spec_prep
67+
echo ::endgroup::
68+
echo ::group::provision
69+
bundle exec bolt plan run peadm_spec::provision_test_cluster \
70+
--modulepath spec/fixtures/modules \
71+
provider=provision_service \
72+
image=${{ matrix.image }} \
73+
architecture=${{ matrix.architecture }} \
74+
--log-level trace
75+
echo ::endgroup::
76+
echo ::group::info:request
77+
cat request.json || true; echo
78+
echo ::endgroup::
79+
echo ::group::info:inventory
80+
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
81+
echo ::endgroup::
82+
- name: Install PE on test cluster
83+
timeout-minutes: 120
84+
run: |
85+
bundle exec bolt plan run peadm_spec::install_test_cluster \
86+
--inventoryfile spec/fixtures/litmus_inventory.yaml \
87+
--modulepath spec/fixtures/modules \
88+
architecture=${{ matrix.install_architecture }} \
89+
version=${{ matrix.version }} \
90+
console_password=${{ secrets.CONSOLE_PASSWORD }}
91+
- name: Replace failed PostgreSQL
92+
run: |
93+
echo ::group::prepare
94+
mkdir -p $HOME/.ssh
95+
echo 'Host *' > $HOME/.ssh/config
96+
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
97+
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
98+
bundle exec rake spec_prep
99+
echo ::endgroup::
100+
bundle exec bolt plan run peadm::replace_failed_postgresql \
101+
--inventoryfile=spec/fixtures/litmus_inventory.yaml \
102+
--modulepath=spec/fixtures/modules \
103+
primary_host=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .uri' spec/fixtures/litmus_inventory.yaml) \
104+
replica_host=$(yq '.groups[].targets[] | select(.vars.role == "replica") | .uri' spec/fixtures/litmus_inventory.yaml) \
105+
working_postgresql_host=$(yq '.groups[].targets[] | select(.vars.role == "replica-pdb-postgresql") | .uri' spec/fixtures/litmus_inventory.yaml) \
106+
failed_postgresql_host=$(yq '.groups[].targets[] | select(.vars.role == "primary-pdb-postgresql") | .uri' spec/fixtures/litmus_inventory.yaml) \
107+
replacement_postgresql_host=$(yq '.groups[].targets[] | select(.vars.role == "spare-replica") | .uri' spec/fixtures/litmus_inventory.yaml) \
108+
--no-host-key-check
109+
- name: Tear down PE XL DR test cluster
110+
if: ${{ always() }}
111+
continue-on-error: true
112+
run: |-
113+
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
114+
echo ::group::tear_down
115+
bundle exec rake 'litmus:tear_down'
116+
echo ::endgroup::
117+
echo ::group::info:request
118+
cat request.json || true; echo
119+
echo ::endgroup::
120+
fi

0 commit comments

Comments
 (0)