Skip to content

Commit 718ad48

Browse files
(PE-40377) tune final checks
1 parent 92f8446 commit 718ad48

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

spec/acceptance/peadm_spec/plans/test_migration.pp

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@
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-
5047
# run infra status on the new primary
5148
out::message("Running peadm::status on new primary host ${new_primary_target}")
5249
$new_primary_status = run_plan('peadm::status', $new_primary_target, { 'format' => 'json' })
@@ -55,21 +52,18 @@
5552
if empty($new_primary_status['failed']) {
5653
out::message('Migrated cluster is healthy, continuing')
5754
} else {
58-
out::message('FAIL: Migrated cluster is not healthy')
59-
$all_checks_passed = false
55+
fail_plan('Migrated cluster is not healthy, aborting')
6056
}
6157

6258
# get the config from new_primary_target and verify config looks as expected
6359
$peadm_config = run_task('peadm::get_peadm_config', $new_primary_target, '_catch_errors' => true).first.to_data()
6460
out::message("peadm_config: ${peadm_config}")
65-
6661
# if new_replica_target is supplied then check that is in the expected place in the config
6762
if $new_replica_target {
6863
if $peadm_config['params']['replica_host'] == $new_replica_target {
6964
out::message("New replica host ${new_replica_target} set up correctly")
7065
} else {
71-
out::message("FAIL: New replica host ${new_replica_target} was not set up correctly")
72-
$all_checks_passed = false
66+
fail_plan("New replica host ${new_replica_target} was not set up correctly")
7367
}
7468
}
7569
@@ -78,8 +72,7 @@
7872
if $peadm_config['params']['primary_postgresql_host'] == $new_primary_postgresql_target {
7973
out::message("New primary postgres host ${new_primary_postgresql_target} set up correctly")
8074
} else {
81-
out::message("FAIL: New primary postgres host ${new_primary_postgresql_target} was not set up correctly")
82-
$all_checks_passed = false
75+
fail_plan("New primary postgres host ${new_primary_postgresql_target} was not set up correctly")
8376
}
8477
}
8578
@@ -88,25 +81,16 @@
8881
if $peadm_config['params']['replica_postgresql_host'] == $new_replica_postgresql_target {
8982
out::message("New primary postgres host ${new_replica_postgresql_target} set up correctly")
9083
} else {
91-
out::message("FAIL: New primary postgres host ${new_replica_postgresql_target} was not set up correctly")
92-
$all_checks_passed = false
84+
fail_plan("New primary postgres host ${new_replica_postgresql_target} was not set up correctly")
9385
}
9486
}
9587
9688
# if a new PE version was specified then check it has been upgraded
9789
if $upgrade_version {
98-
if $peadm_config['params']['pe_version'] == $upgrade_version {
90+
if $peadm_config['value']['pe_version'] == $upgrade_version {
9991
out::message("Upgraded to new PE version ${upgrade_version} correctly")
10092
} else {
101-
out::message("FAIL: Upgrade to new PE version ${upgrade_version} did not work correctly")
102-
$all_checks_passed = false
93+
fail_plan("Failed to upgrade to new PE version ${upgrade_version} correctly")
10394
}
10495
}
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-
}
11296
}

0 commit comments

Comments
 (0)