Skip to contentSkip to conversation

tests/migration: Tweek auto converge limits check

PATCH In review Dr. David Alan Gilbert (git) 2 participants 2 messages Mar 6, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/migration: Tweek auto converge limits check

From: "Dr. David Alan Gilbert" <[email protected]>

Thomas found an autoconverge test failure where the migration completed before the autoconverge had kicked in.

To try and avoid this again:
a) Reduce the usleep in test_migrate_auto_converge so that it should exit quicker when autoconverge kicks in
b) Make the loop exit immediately rather than have the sleep when it does start autoconverge, otherwise the autoconverge might succeed during the sleep.
c) Reduce inc_pct so auto converge happens more slowly
d) Reduce the max-bandwidth in migrate_ensure_non_converge to make the ensure more ensure.

---
 tests/qtest/migration-test.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
tests/qtest/migration-test.c +11 -8
index d4ab3934ed..75d4f1d4a9 100644
@@ -408,8 +408,8 @@ static void migrate_set_parameter_str(QTestState *who, const char *parameter,
 
 static void migrate_ensure_non_converge(QTestState *who)
 {
-    /* Can't converge with 1ms downtime + 30 mbs bandwidth limit */
-    migrate_set_parameter_int(who, "max-bandwidth", 30 * 1000 * 1000);
+    /* Can't converge with 1ms downtime + 3 mbs bandwidth limit */
+    migrate_set_parameter_int(who, "max-bandwidth", 3 * 1000 * 1000);
     migrate_set_parameter_int(who, "downtime-limit", 1);
 }
 
@@ -1808,7 +1808,7 @@ static void test_migrate_auto_converge(void)
      * E.g., with 1Gb/s bandwith migration may pass without throttling,
      * so we need to decrease a bandwidth.
      */
-    const int64_t init_pct = 5, inc_pct = 50, max_pct = 95;
+    const int64_t init_pct = 5, inc_pct = 25, max_pct = 95;
 
     if (test_migrate_start(&from, &to, uri, &args)) {
         return;
@@ -1835,13 +1835,16 @@ static void test_migrate_auto_converge(void)
 
     /* Wait for throttling begins */
     percentage = 0;
-    while (percentage == 0) {
+    do {
         percentage = read_migrate_property_int(from, "cpu-throttle-percentage");
-        usleep(100);
+        if (percentage != 0) {
+            break;
+        }
+        usleep(20);
         g_assert_false(got_stop);
-    }
-    /* The first percentage of throttling should be equal to init_pct */
-    g_assert_cmpint(percentage, ==, init_pct);
+    } while (true);
+    /* The first percentage of throttling should be at least init_pct */
+    g_assert_cmpint(percentage, >=, init_pct);
     /* Now, when we tested that throttling works, let it converge */
     migrate_ensure_converge(from);
 
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Thomas found an autoconverge test failure where the migration completed before the autoconverge had kicked in.

To try and avoid this again:
a) Reduce the usleep in test_migrate_auto_converge so that it should exit quicker when autoconverge kicks in
b) Make the loop exit immediately rather than have the sleep when it does start autoconverge, otherwise the autoconverge might succeed during the sleep.
c) Reduce inc_pct so auto converge happens more slowly
d) Reduce the max-bandwidth in migrate_ensure_non_converge to make the ensure more ensure.

Quoted 4 lines
---
 tests/qtest/migration-test.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|