[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/18] tests: expand the migration precopy helper to support failu
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 09/18] tests: expand the migration precopy helper to support failures |
Date: |
Thu, 21 Apr 2022 19:40:43 +0100 |
From: Daniel P. Berrangé <berrange@redhat.com>
The migration precopy testing helper function always expects the
migration to run to a completion state. There will be test scenarios
for TLS where expect either the client or server to fail the migration.
This expands the helper to cope with these scenarios.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220310171821.3724080-12-berrange@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
tests/qtest/migration-test.c | 51 +++++++++++++++++++++++++++++-------
1 file changed, 42 insertions(+), 9 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 04f749aaa1..2af36c16a3 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -821,6 +821,30 @@ typedef struct {
TestMigrateStartHook start_hook;
/* Optional: callback to run at finish to cleanup */
TestMigrateFinishHook finish_hook;
+
+ /*
+ * Optional: normally we expect the migration process to complete.
+ *
+ * There can be a variety of reasons and stages in which failure
+ * can happen during tests.
+ *
+ * If a failure is expected to happen at time of establishing
+ * the connection, then MIG_TEST_FAIL will indicate that the dst
+ * QEMU is expected to stay running and accept future migration
+ * connections.
+ *
+ * If a failure is expected to happen while processing the
+ * migration stream, then MIG_TEST_FAIL_DEST_QUIT_ERR will indicate
+ * that the dst QEMU is expected to quit with non-zero exit status
+ */
+ enum {
+ /* This test should succeed, the default */
+ MIG_TEST_SUCCEED = 0,
+ /* This test should fail, dest qemu should keep alive */
+ MIG_TEST_FAIL,
+ /* This test should fail, dest qemu should fail with abnormal status */
+ MIG_TEST_FAIL_DEST_QUIT_ERR,
+ } result;
} MigrateCommon;
static void test_precopy_common(MigrateCommon *args)
@@ -858,24 +882,33 @@ static void test_precopy_common(MigrateCommon *args)
}
- wait_for_migration_pass(from);
+ if (args->result != MIG_TEST_SUCCEED) {
+ bool allow_active = args->result == MIG_TEST_FAIL;
+ wait_for_migration_fail(from, allow_active);
- migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME);
+ if (args->result == MIG_TEST_FAIL_DEST_QUIT_ERR) {
+ qtest_set_expected_status(to, 1);
+ }
+ } else {
+ wait_for_migration_pass(from);
- if (!got_stop) {
- qtest_qmp_eventwait(from, "STOP");
- }
+ migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME);
- qtest_qmp_eventwait(to, "RESUME");
+ if (!got_stop) {
+ qtest_qmp_eventwait(from, "STOP");
+ }
- wait_for_serial("dest_serial");
- wait_for_migration_complete(from);
+ qtest_qmp_eventwait(to, "RESUME");
+
+ wait_for_serial("dest_serial");
+ wait_for_migration_complete(from);
+ }
if (args->finish_hook) {
args->finish_hook(from, to, data_hook);
}
- test_migrate_end(from, to, true);
+ test_migrate_end(from, to, args->result == MIG_TEST_SUCCEED);
}
static void test_precopy_unix(void)
--
2.35.1
- [PULL 00/18] migration queue, (continued)
- [PULL 00/18] migration queue, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 04/18] migration: fix use of TLS PSK credentials with a UNIX socket, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 05/18] tests: switch MigrateStart struct to be stack allocated, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 01/18] tests: improve error message when saving TLS PSK file fails, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 08/18] tests: switch migration FD passing test to use common precopy helper, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 02/18] tests: support QTEST_TRACE env variable, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 10/18] migration: Postpone releasing MigrationState.hostname, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 15/18] migration: Move channel setup out of postcopy_try_recover(), Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 14/18] migration: Export ram_load_postcopy(), Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 16/18] migration: Allow migrate-recover to run multiple times, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 09/18] tests: expand the migration precopy helper to support failures,
Dr. David Alan Gilbert (git) <=
- [PULL 07/18] tests: introduce ability to provide hooks for migration precopy test, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 06/18] tests: merge code for UNIX and TCP migration pre-copy tests, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 03/18] tests: print newline after QMP response in qtest logs, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 11/18] migration: Drop multifd tls_hostname cache, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 13/18] migration: Move migrate_allow_multifd and helpers into migration.c, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 18/18] migration: Read state once, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 12/18] migration: Add pss.postcopy_requested status, Dr. David Alan Gilbert (git), 2022/04/21
- [PULL 17/18] migration: Fix operator type, Dr. David Alan Gilbert (git), 2022/04/21
- Re: [PULL 00/18] migration queue, Richard Henderson, 2022/04/22