[PATCH v2 1/4] tests/functional/migration: Use socket_dir

Fabiano Rosas posted 4 patches 4 days, 19 hours ago
Maintainers: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>
[PATCH v2 1/4] tests/functional/migration: Use socket_dir
Posted by Fabiano Rosas 4 days, 19 hours ago
Use QemuBaseTest.socket_dir instead of calling tempfile directly so
all tests have consistent directory prefixes.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/functional/migration.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/functional/migration.py b/tests/functional/migration.py
index 2bfb1f7790..0aa873edba 100644
--- a/tests/functional/migration.py
+++ b/tests/functional/migration.py
@@ -11,7 +11,6 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
 
-import tempfile
 import time
 
 from qemu_test import QemuSystemTest, which
@@ -65,9 +64,8 @@ def migration_with_tcp_localhost(self):
             self.do_migrate(dest_uri)
 
     def migration_with_unix(self):
-        with tempfile.TemporaryDirectory(prefix='socket_') as socket_path:
-            dest_uri = 'unix:%s/qemu-test.sock' % socket_path
-            self.do_migrate(dest_uri)
+        dest_uri = 'unix:%s/migration.sock' % self.socket_dir().name
+        self.do_migrate(dest_uri)
 
     def migration_with_exec(self):
         if not which('ncat'):
-- 
2.51.0


Re: [PATCH v2 1/4] tests/functional/migration: Use socket_dir
Posted by Thomas Huth 3 days ago
On 04/02/2026 18.23, Fabiano Rosas wrote:
> Use QemuBaseTest.socket_dir instead of calling tempfile directly so
> all tests have consistent directory prefixes.
> 
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Reviewed-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>   tests/functional/migration.py | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/functional/migration.py b/tests/functional/migration.py
> index 2bfb1f7790..0aa873edba 100644
> --- a/tests/functional/migration.py
> +++ b/tests/functional/migration.py
> @@ -11,7 +11,6 @@
>   # This work is licensed under the terms of the GNU GPL, version 2 or
>   # later.  See the COPYING file in the top-level directory.
>   
> -import tempfile
>   import time
>   
>   from qemu_test import QemuSystemTest, which
> @@ -65,9 +64,8 @@ def migration_with_tcp_localhost(self):
>               self.do_migrate(dest_uri)
>   
>       def migration_with_unix(self):
> -        with tempfile.TemporaryDirectory(prefix='socket_') as socket_path:
> -            dest_uri = 'unix:%s/qemu-test.sock' % socket_path
> -            self.do_migrate(dest_uri)
> +        dest_uri = 'unix:%s/migration.sock' % self.socket_dir().name
> +        self.do_migrate(dest_uri)
>   
>       def migration_with_exec(self):
>           if not which('ncat'):

Reviewed-by: Thomas Huth <thuth@redhat.com>