[v1,1/8] tests: migrate: fix events race

Submitted by Victor Toso on Oct. 7, 2019, 12:19 p.m.

Details

Message ID 20191007121935.22567-1-victortoso@redhat.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Victor Toso Oct. 7, 2019, 12:19 p.m.
From: Victor Toso <me@victortoso.com>

Currently, when we run migrate.py with --client option we get stuck
waiting for SPICE_CONNECTED event on target qmp (while receiving only
QMP). Problem is, only after event SPICE_INITIALIZED in the source qmp
is that the client will be able to do migration (to properly exchange
spice messages).

So, it is a must that if we have a test where a client is connected,
to wait for SPICE_INITIALIZED event in the source qmp.

To clarify, this patches fixes the following test:

    ./migrate.py --client spicy

Signed-off-by: Victor Toso <victortoso@redhat.com>
---
 tests/migrate.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/tests/migrate.py b/tests/migrate.py
index 87a32eb0..e283ad0f 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -194,7 +194,7 @@  class Migrator(object):
                 raw_input()
 
         # Tester can launch its own client or we wait start_client() to connect
-        if wait_user_connect:
+        if self.connected_client or wait_user_connect:
             wait_for_event(self.active.qmp, 'SPICE_INITIALIZED')
 
         self.active.qmp.cmd('client_migrate_info', {'protocol':'spice',