[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/26] tests/qtest/migration: Add negative tests to validate migra
From: |
Peter Xu |
Subject: |
[PULL 08/26] tests/qtest/migration: Add negative tests to validate migration QAPIs |
Date: |
Tue, 23 Apr 2024 18:37:55 -0400 |
From: Het Gala <het.gala@nutanix.com>
Migration QAPI arguments - uri and channels are mutually exhaustive.
Add negative validation tests, one with both arguments present and
one with none present.
Signed-off-by: Het Gala <het.gala@nutanix.com>
Suggested-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20240312202634.63349-9-het.gala@nutanix.com
Signed-off-by: Peter Xu <peterx@redhat.com>
---
tests/qtest/migration-test.c | 55 +++++++++++++++++++++++++++++++++++-
1 file changed, 54 insertions(+), 1 deletion(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index be67a92536..5d6d8cd634 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -1724,7 +1724,7 @@ static void test_precopy_common(MigrateCommon *args)
}
if (args->result == MIG_TEST_QMP_ERROR) {
- migrate_qmp_fail(from, args->connect_uri, NULL, "{}");
+ migrate_qmp_fail(from, args->connect_uri, args->connect_channels,
"{}");
goto finish;
}
@@ -2571,6 +2571,55 @@ static void test_validate_uuid_dst_not_set(void)
do_test_validate_uuid(&args, false);
}
+static void do_test_validate_uri_channel(MigrateCommon *args)
+{
+ QTestState *from, *to;
+
+ if (test_migrate_start(&from, &to, args->listen_uri, &args->start)) {
+ return;
+ }
+
+ /* Wait for the first serial output from the source */
+ wait_for_serial("src_serial");
+
+ /*
+ * 'uri' and 'channels' validation is checked even before the migration
+ * starts.
+ */
+ migrate_qmp_fail(from, args->connect_uri, args->connect_channels, "{}");
+ test_migrate_end(from, to, false);
+}
+
+static void test_validate_uri_channels_both_set(void)
+{
+ MigrateCommon args = {
+ .start = {
+ .hide_stderr = true,
+ },
+ .listen_uri = "defer",
+ .connect_uri = "tcp:127.0.0.1:0",
+ .connect_channels = "[ { 'channel-type': 'main',"
+ " 'addr': { 'transport': 'socket',"
+ " 'type': 'inet',"
+ " 'host': '127.0.0.1',"
+ " 'port': '0' } } ]",
+ };
+
+ do_test_validate_uri_channel(&args);
+}
+
+static void test_validate_uri_channels_none_set(void)
+{
+ MigrateCommon args = {
+ .start = {
+ .hide_stderr = true,
+ },
+ .listen_uri = "defer",
+ };
+
+ do_test_validate_uri_channel(&args);
+}
+
/*
* The way auto_converge works, we need to do too many passes to
* run this test. Auto_converge logic is only run once every
@@ -3679,6 +3728,10 @@ int main(int argc, char **argv)
test_validate_uuid_src_not_set);
migration_test_add("/migration/validate_uuid_dst_not_set",
test_validate_uuid_dst_not_set);
+ migration_test_add("/migration/validate_uri/channels/both_set",
+ test_validate_uri_channels_both_set);
+ migration_test_add("/migration/validate_uri/channels/none_set",
+ test_validate_uri_channels_none_set);
/*
* See explanation why this test is slow on function definition
*/
--
2.44.0
- [PULL 00/26] Migration 20240423 patches, Peter Xu, 2024/04/23
- [PULL 01/26] tests/qtest/migration: Add 'to' object into migrate_qmp(), Peter Xu, 2024/04/23
- [PULL 04/26] tests/qtest/migration: Add channels parameter in migrate_qmp_fail, Peter Xu, 2024/04/23
- [PULL 02/26] tests/qtest/migration: Replace connect_uri and move migrate_get_socket_address inside migrate_qmp, Peter Xu, 2024/04/23
- [PULL 07/26] tests/qtest/migration: Add multifd_tcp_plain test using list of channels instead of uri, Peter Xu, 2024/04/23
- [PULL 13/26] migration: Always report an error in ram_save_setup(), Peter Xu, 2024/04/23
- [PULL 16/26] migration: Add Error** argument to .save_setup() handler, Peter Xu, 2024/04/23
- [PULL 19/26] migration: Introduce ram_bitmaps_destroy(), Peter Xu, 2024/04/23
- [PULL 24/26] migration: Add Error** argument to add_bitmaps_to_list(), Peter Xu, 2024/04/23
- [PULL 26/26] migration/colo: Fix bdrv_graph_rdlock_main_loop: Assertion `!qemu_in_coroutine()' failed., Peter Xu, 2024/04/23
- [PULL 08/26] tests/qtest/migration: Add negative tests to validate migration QAPIs,
Peter Xu <=
- [PULL 06/26] tests/qtest/migration: Add channels parameter in migrate_qmp, Peter Xu, 2024/04/23
- [PULL 17/26] migration: Add Error** argument to .load_setup() handler, Peter Xu, 2024/04/23
- [PULL 10/26] s390/stattrib: Add Error** argument to set_migrationmode() handler, Peter Xu, 2024/04/23
- [PULL 25/26] migration/multifd: solve zero page causing multiple page faults, Peter Xu, 2024/04/23
- [PULL 05/26] tests/qtest/migration: Add migrate_set_ports into migrate_qmp to update migration port value, Peter Xu, 2024/04/23
- [PULL 12/26] migration: Always report an error in block_save_setup(), Peter Xu, 2024/04/23
- [PULL 14/26] migration: Add Error** argument to vmstate_save(), Peter Xu, 2024/04/23
- [PULL 09/26] tests/qtest/migration: Fix typo for vsock in SocketAddress_to_str, Peter Xu, 2024/04/23
- [PULL 11/26] vfio: Always report an error in vfio_save_setup(), Peter Xu, 2024/04/23
- [PULL 22/26] migration: Add Error** argument to xbzrle_init(), Peter Xu, 2024/04/23