Skip to content

Commit 0fa1949

Browse files
(PE-40377) clean up params and use latest ubuntu
1 parent 28e4c2d commit 0fa1949

File tree

2 files changed

+25
-45
lines changed

2 files changed

+25
-45
lines changed

.github/workflows/test-migration.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ on:
2626
workflow_dispatch: {}
2727
jobs:
2828
test-migration:
29-
name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}
30-
runs-on: ubuntu-20.04
29+
name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }} PE upgrade? ${{ matrix.new_pe_version }}
30+
runs-on: ubuntu-latest
3131
env:
3232
BOLT_GEM: true
3333
BOLT_DISABLE_ANALYTICS: true

spec/acceptance/peadm_spec/plans/test_migration.pp

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
plan peadm_spec::test_migration(
2-
String $primary_host,
3-
String $replica_host,
4-
String $primary_postgresql_host,
5-
String $replica_postgresql_host,
6-
String $new_primary_host,
7-
String $new_replica_host,
8-
String $new_primary_postgresql_host,
9-
String $new_replica_postgresql_host,
10-
String $new_pe_version,
2+
Peadm::SingleTargetSpec $primary_host,
3+
Optional[Peadm::SingleTargetSpec] $replica_host = undef,
4+
Optional[Peadm::SingleTargetSpec] $primary_postgresql_host = undef,
5+
Optional[Peadm::SingleTargetSpec] $replica_postgresql_host = undef,
6+
Peadm::SingleTargetSpec $new_primary_host,
7+
Optional[Peadm::SingleTargetSpec] $new_replica_host = undef,
8+
Optional[Peadm::SingleTargetSpec] $new_primary_postgresql_host = undef,
9+
Optional[Peadm::SingleTargetSpec] $new_replica_postgresql_host = undef,
10+
Optional[Peadm::SingleTargetSpec] $new_pe_version = undef,
1111
) {
1212
out::message("primary_host:${primary_host}.")
1313
out::message("replica_host:${replica_host}.")
@@ -18,29 +18,9 @@
1818
out::message("new_primary_postgresql_host:${new_primary_postgresql_host}.")
1919
out::message("new_replica_postgresql_host:${new_replica_postgresql_host}.")
2020

21-
# Convert String values to Peadm::SingleTargetSpec if they are not blank
22-
$primary_target = $primary_host ? { '' => undef, default => peadm::get_targets($primary_host, 1) }
23-
$replica_target = $replica_host ? { '' => undef, default => peadm::get_targets($replica_host, 1) }
24-
$primary_postgresql_target = $primary_postgresql_host ? { '' => undef, default => peadm::get_targets($primary_postgresql_host, 1) }
25-
$replica_postgresql_target = $replica_postgresql_host ? { '' => undef, default => peadm::get_targets($replica_postgresql_host, 1) }
26-
$new_primary_target = $new_primary_host ? { '' => undef, default => peadm::get_targets($new_primary_host, 1) }
27-
$new_replica_target = $new_replica_host ? { '' => undef, default => peadm::get_targets($new_replica_host, 1) }
28-
$new_primary_postgresql_target = $new_primary_postgresql_host ? { '' => undef, default => peadm::get_targets($new_primary_postgresql_host, 1) }
29-
$new_replica_postgresql_target = $new_replica_postgresql_host ? { '' => undef, default => peadm::get_targets($new_replica_postgresql_host, 1) }
30-
31-
# output converted values
32-
out::message("primary_target:${primary_target}.")
33-
out::message("replica_target:${replica_target}.")
34-
out::message("primary_postgresql_target:${primary_postgresql_target}.")
35-
out::message("replica_postgresql_target:${replica_postgresql_target}.")
36-
out::message("new_primary_target:${new_primary_target}.")
37-
out::message("new_replica_target:${new_replica_target}.")
38-
out::message("new_primary_postgresql_target:${new_primary_postgresql_target}.")
39-
out::message("new_replica_postgresql_target:${new_replica_postgresql_target}.")
40-
4121
# run infra status on the primary
42-
out::message("Running peadm::status on primary host ${primary_target}")
43-
$primary_status = run_plan('peadm::status', $primary_target, { 'format' => 'json' })
22+
out::message("Running peadm::status on primary host ${primary_host}")
23+
$primary_status = run_plan('peadm::status', $primary_host, { 'format' => 'json' })
4424
out::message($primary_status)
4525

4626
if empty($primary_status['failed']) {
@@ -51,13 +31,13 @@
5131

5232
# # perform the migration
5333
# run_plan('peadm::migrate',
54-
# old_primary_host => $primary_target,
34+
# old_primary_host => $primary_host,
5535
# new_primary_host => $new_primary_host,
5636
# )
5737

5838
# run infra status on the new primary
59-
out::message("Running peadm::status on new primary host ${new_primary_target}")
60-
$new_primary_status = run_plan('peadm::status', $new_primary_target, { 'format' => 'json' })
39+
out::message("Running peadm::status on new primary host ${new_primary_host}")
40+
$new_primary_status = run_plan('peadm::status', $new_primary_host, { 'format' => 'json' })
6141
out::message($new_primary_status)
6242

6343
if empty($new_primary_status['failed']) {
@@ -66,29 +46,29 @@
6646
fail_plan('Migrated cluster is not healthy, aborting')
6747
}
6848

69-
# get the config from new_primary_target and verify config looks as expected
70-
$result = run_task('peadm::get_peadm_config', $new_primary_target, '_catch_errors' => true).first.to_data()
49+
# get the config from new_primary_host and verify config looks as expected
50+
$result = run_task('peadm::get_peadm_config', $new_primary_host, '_catch_errors' => true).first.to_data()
7151
out::message("peadm_config: ${result}")
72-
# if new_replica_host is not empty then check that is in the expected place in the config
73-
if $new_replica_host != '' {
52+
# if new_replica_host is supplied then check that is in the expected place in the config
53+
if $new_replica_host {
7454
if $peadm_config['params']['replica_host'] == $new_replica_host {
7555
out::message("New replica host ${new_replica_host} set up correctly")
7656
} else {
7757
fail_plan("New replica host ${new_replica_host} was not set up correctly")
7858
}
7959
}
8060
81-
# if new_primary_postgresql_host is not empty then check that is in the expected place in the config
82-
if $new_primary_postgresql_host != '' {
61+
# if new_primary_postgresql_host is supplied then check that is in the expected place in the config
62+
if $new_primary_postgresql_host {
8363
if $peadm_config['params']['primary_postgresql_host'] == $new_primary_postgresql_host {
8464
out::message("New primary postgres host ${new_primary_postgresql_host} set up correctly")
8565
} else {
8666
fail_plan("New primary postgres host ${new_primary_postgresql_host} was not set up correctly")
8767
}
8868
}
8969
90-
# if new_replica_postgresql_host is not empty then check that is in the expected place in the config
91-
if $new_replica_postgresql_host != '' {
70+
# if new_replica_postgresql_host is supplied then check that is in the expected place in the config
71+
if $new_replica_postgresql_host {
9272
if $peadm_config['params']['replica_postgresql_host'] == $new_replica_postgresql_host {
9373
out::message("New primary postgres host ${new_replica_postgresql_host} set up correctly")
9474
} else {
@@ -97,7 +77,7 @@
9777
}
9878
9979
# if a new PE version was specified then check it has been upgraded
100-
if ($new_pe_version != '') {
80+
if $new_pe_version {
10181
if $peadm_config['params']['pe_version'] == $new_pe_version {
10282
out::message("Upgraded to new PE version ${new_pe_version} correctly")
10383
} else {

0 commit comments

Comments
 (0)