Skip to content

Commit 92f8446

Browse files
(PE-40377) try to alter final checks
1 parent f1e0e8e commit 92f8446

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

spec/acceptance/peadm_spec/plans/test_migration.pp

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
new_primary_host => $new_primary_target,
4545
)
4646

47+
# Initialize a variable to track the overall success status
48+
$all_checks_passed = true
49+
4750
# run infra status on the new primary
4851
out::message("Running peadm::status on new primary host ${new_primary_target}")
4952
$new_primary_status = run_plan('peadm::status', $new_primary_target, { 'format' => 'json' })
@@ -52,18 +55,21 @@
5255
if empty($new_primary_status['failed']) {
5356
out::message('Migrated cluster is healthy, continuing')
5457
} else {
55-
fail_plan('Migrated cluster is not healthy, aborting')
58+
out::message('FAIL: Migrated cluster is not healthy')
59+
$all_checks_passed = false
5660
}
5761

5862
# get the config from new_primary_target and verify config looks as expected
5963
$peadm_config = run_task('peadm::get_peadm_config', $new_primary_target, '_catch_errors' => true).first.to_data()
6064
out::message("peadm_config: ${peadm_config}")
65+
6166
# if new_replica_target is supplied then check that is in the expected place in the config
6267
if $new_replica_target {
6368
if $peadm_config['params']['replica_host'] == $new_replica_target {
6469
out::message("New replica host ${new_replica_target} set up correctly")
6570
} else {
66-
fail_plan("New replica host ${new_replica_target} was not set up correctly")
71+
out::message("FAIL: New replica host ${new_replica_target} was not set up correctly")
72+
$all_checks_passed = false
6773
}
6874
}
6975
@@ -72,7 +78,8 @@
7278
if $peadm_config['params']['primary_postgresql_host'] == $new_primary_postgresql_target {
7379
out::message("New primary postgres host ${new_primary_postgresql_target} set up correctly")
7480
} else {
75-
fail_plan("New primary postgres host ${new_primary_postgresql_target} was not set up correctly")
81+
out::message("FAIL: New primary postgres host ${new_primary_postgresql_target} was not set up correctly")
82+
$all_checks_passed = false
7683
}
7784
}
7885
@@ -81,7 +88,8 @@
8188
if $peadm_config['params']['replica_postgresql_host'] == $new_replica_postgresql_target {
8289
out::message("New primary postgres host ${new_replica_postgresql_target} set up correctly")
8390
} else {
84-
fail_plan("New primary postgres host ${new_replica_postgresql_target} was not set up correctly")
91+
out::message("FAIL: New primary postgres host ${new_replica_postgresql_target} was not set up correctly")
92+
$all_checks_passed = false
8593
}
8694
}
8795
@@ -90,7 +98,15 @@
9098
if $peadm_config['params']['pe_version'] == $upgrade_version {
9199
out::message("Upgraded to new PE version ${upgrade_version} correctly")
92100
} else {
93-
fail_plan("Failed to upgrade to new PE version ${upgrade_version} correctly")
101+
out::message("FAIL: Upgrade to new PE version ${upgrade_version} did not work correctly")
102+
$all_checks_passed = false
94103
}
95104
}
105+
106+
# fail plan if any of the checks failed
107+
if $all_checks_passed {
108+
out::message('All checks passed')
109+
} else {
110+
fail_plan('Migration of cluster failed')
111+
}
96112
}

0 commit comments

Comments
 (0)