diff mbox series

[v5,9/9] migration: adding test case for modified QAPI syntax

Message ID 20230519094617.7078-10-het.gala@nutanix.com (mailing list archive)
State New, archived
Headers show
Series migration: Modify 'migrate' and 'migrate-incoming' QAPI commands for migration | expand

Commit Message

Het Gala May 19, 2023, 9:46 a.m. UTC
Adding multifd tcp common test case for modified QAPI syntax defined.

Suggested-by: Aravind Retnakaran <aravind.retnakaran@nutanix.com>
Signed-off-by: Het Gala <het.gala@nutanix.com>
---
 tests/qtest/migration-test.c | 47 ++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

Comments

Het Gala May 19, 2023, 9:49 a.m. UTC | #1
On 19/05/23 3:16 pm, Het Gala wrote:
> Adding multifd tcp common test case for modified QAPI syntax defined.
>
> Suggested-by: Aravind Retnakaran <aravind.retnakaran@nutanix.com>
> Signed-off-by: Het Gala <het.gala@nutanix.com>
> ---
>   tests/qtest/migration-test.c | 47 ++++++++++++++++++++++++++++++++++++
>   1 file changed, 47 insertions(+)
>
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index b99b49a314..ef6f9181da 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c
> @@ -2021,6 +2021,34 @@ test_migrate_precopy_tcp_multifd_start_common(QTestState *from,
>       return NULL;
>   }
>   
> +static void *
> +test_migrate_precopy_tcp_multifd_start_new_syntax_common(QTestState *from,
> +                                                         QTestState *to,
> +                                                         const char *method)
> +{
> +    QDict *rsp;
> +
> +    migrate_set_parameter_int(from, "multifd-channels", 16);
> +    migrate_set_parameter_int(to, "multifd-channels", 16);
> +
> +    migrate_set_parameter_str(from, "multifd-compression", method);
> +    migrate_set_parameter_str(to, "multifd-compression", method);
> +
> +    migrate_set_capability(from, "multifd", true);
> +    migrate_set_capability(to, "multifd", true);
> +
> +    /* Start incoming migration from the 1st socket */
> +    rsp = wait_command(to, "{ 'execute': 'migrate-incoming',"
> +                           "  'arguments': { "
> +                           "    'channels': [ { 'channeltype': 'main',"
> +                           "     'addr': { 'transport': 'socket',"
> +                           "               'type': 'inet','host': '127.0.0.1',"
> +                           "               'port': '0' } } ] } }");
> +    qobject_unref(rsp);
> +
> +    return NULL;
> +}
> +
>   static void *
>   test_migrate_precopy_tcp_multifd_start(QTestState *from,
>                                          QTestState *to)
> @@ -2028,6 +2056,14 @@ test_migrate_precopy_tcp_multifd_start(QTestState *from,
>       return test_migrate_precopy_tcp_multifd_start_common(from, to, "none");
>   }
>   
> +static void *
> +test_migrate_precopy_tcp_multifd_new_syntax_start(QTestState *from,
> +                                                  QTestState *to)
> +{
> +    return test_migrate_precopy_tcp_multifd_start_new_syntax_common(from,
> +                                                              to, "none");
> +}
> +
>   static void *
>   test_migrate_precopy_tcp_multifd_zlib_start(QTestState *from,
>                                               QTestState *to)
> @@ -2053,6 +2089,15 @@ static void test_multifd_tcp_none(void)
>       test_precopy_common(&args);
>   }
>   
> +static void test_multifd_tcp_new_syntax_none(void)
> +{
> +    MigrateCommon args = {
> +        .listen_uri = "defer",
> +        .start_hook = test_migrate_precopy_tcp_multifd_new_syntax_start,
> +    };
> +    test_precopy_common(&args);
> +}
> +
>   static void test_multifd_tcp_zlib(void)
>   {
>       MigrateCommon args = {
> @@ -2736,6 +2781,8 @@ int main(int argc, char **argv)
>       }
>       qtest_add_func("/migration/multifd/tcp/plain/none",
>                      test_multifd_tcp_none);
> +    qtest_add_func("/migration/multifd/tcp/plain/none",
> +                   test_multifd_tcp_new_syntax_none);
>       /*
>        * This test is flaky and sometimes fails in CI and otherwise:
>        * don't run unless user opts in via environment variable.

Maintainers, though I have added a tcp test with new QAPI syntax for 
multifd here. I feel it is incomplete because it seems like 
test_precopy_common() finally sees the arguments in form of char *uri -> 
string form. Please advice, do we need to totally revamp the test case 
functions here for the modified syntax ?

Regards,
Het Gala
diff mbox series

Patch

diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index b99b49a314..ef6f9181da 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -2021,6 +2021,34 @@  test_migrate_precopy_tcp_multifd_start_common(QTestState *from,
     return NULL;
 }
 
+static void *
+test_migrate_precopy_tcp_multifd_start_new_syntax_common(QTestState *from,
+                                                         QTestState *to,
+                                                         const char *method)
+{
+    QDict *rsp;
+
+    migrate_set_parameter_int(from, "multifd-channels", 16);
+    migrate_set_parameter_int(to, "multifd-channels", 16);
+
+    migrate_set_parameter_str(from, "multifd-compression", method);
+    migrate_set_parameter_str(to, "multifd-compression", method);
+
+    migrate_set_capability(from, "multifd", true);
+    migrate_set_capability(to, "multifd", true);
+
+    /* Start incoming migration from the 1st socket */
+    rsp = wait_command(to, "{ 'execute': 'migrate-incoming',"
+                           "  'arguments': { "
+                           "    'channels': [ { 'channeltype': 'main',"
+                           "     'addr': { 'transport': 'socket',"
+                           "               'type': 'inet','host': '127.0.0.1',"
+                           "               'port': '0' } } ] } }");
+    qobject_unref(rsp);
+
+    return NULL;
+}
+
 static void *
 test_migrate_precopy_tcp_multifd_start(QTestState *from,
                                        QTestState *to)
@@ -2028,6 +2056,14 @@  test_migrate_precopy_tcp_multifd_start(QTestState *from,
     return test_migrate_precopy_tcp_multifd_start_common(from, to, "none");
 }
 
+static void *
+test_migrate_precopy_tcp_multifd_new_syntax_start(QTestState *from,
+                                                  QTestState *to)
+{
+    return test_migrate_precopy_tcp_multifd_start_new_syntax_common(from,
+                                                              to, "none");
+}
+
 static void *
 test_migrate_precopy_tcp_multifd_zlib_start(QTestState *from,
                                             QTestState *to)
@@ -2053,6 +2089,15 @@  static void test_multifd_tcp_none(void)
     test_precopy_common(&args);
 }
 
+static void test_multifd_tcp_new_syntax_none(void)
+{
+    MigrateCommon args = {
+        .listen_uri = "defer",
+        .start_hook = test_migrate_precopy_tcp_multifd_new_syntax_start,
+    };
+    test_precopy_common(&args);
+}
+
 static void test_multifd_tcp_zlib(void)
 {
     MigrateCommon args = {
@@ -2736,6 +2781,8 @@  int main(int argc, char **argv)
     }
     qtest_add_func("/migration/multifd/tcp/plain/none",
                    test_multifd_tcp_none);
+    qtest_add_func("/migration/multifd/tcp/plain/none",
+                   test_multifd_tcp_new_syntax_none);
     /*
      * This test is flaky and sometimes fails in CI and otherwise:
      * don't run unless user opts in via environment variable.