From 29ccb5b625a5cf915f87d1d85952dde6b9b572ee Mon Sep 17 00:00:00 2001
From: Adrian Reber <areber@redhat.com>
Date: Thu, 6 Feb 2025 07:34:26 +0000
Subject: [PATCH] test: others/rpc do not use nftables locking backend

The tests in others/rpc are running as non-root and
fail silently if the nftables network locking backend is used.

This switches those tests to skip the network locking.

Signed-off-by: Adrian Reber <areber@redhat.com>
---
 test/others/rpc/errno.py   | 2 ++
 test/others/rpc/ps_test.py | 1 +
 test/others/rpc/run.sh     | 2 +-
 test/others/rpc/test-c.c   | 2 ++
 test/others/rpc/test.py    | 1 +
 5 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/others/rpc/errno.py b/test/others/rpc/errno.py
index b600b6d1c4..4ea6c9d441 100755
--- a/test/others/rpc/errno.py
+++ b/test/others/rpc/errno.py
@@ -67,6 +67,7 @@ def no_process(self):
         req = self.get_base_req()
         req.type = rpc.DUMP
         req.opts.pid = pid
+        req.opts.network_lock = rpc.SKIP
 
         self.send_req(req)
         resp = self.recv_resp()
@@ -84,6 +85,7 @@ def process_exists(self):
         req = self.get_base_req()
         req.type = rpc.DUMP
         req.opts.leave_running = True
+        req.opts.network_lock = rpc.SKIP
 
         self.send_req(req)
         resp = self.recv_resp()
diff --git a/test/others/rpc/ps_test.py b/test/others/rpc/ps_test.py
index daeda49bce..259f22e775 100755
--- a/test/others/rpc/ps_test.py
+++ b/test/others/rpc/ps_test.py
@@ -23,6 +23,7 @@
 req.opts.log_file = 'page-server.log'
 req.opts.log_level = 4
 req.opts.images_dir_fd = os.open(args['dir'], os.O_DIRECTORY)
+req.opts.network_lock = rpc.SKIP
 
 s.send(req.SerializeToString())
 
diff --git a/test/others/rpc/run.sh b/test/others/rpc/run.sh
index afd4fb5e33..3d5a53ae66 100755
--- a/test/others/rpc/run.sh
+++ b/test/others/rpc/run.sh
@@ -51,7 +51,7 @@ function test_restore_loop {
 	title_print "Dump loop process"
 	# So theoretically '-j' (--shell-job) should not be necessary, but on alpine
 	# this test fails without it.
-	${CRIU} dump -j -v4 -o dump-loop.log -D build/imgs_loop -t ${P}
+	${CRIU} dump -j -v4 -o dump-loop.log --network-lock skip -D build/imgs_loop -t ${P}
 
 	title_print "Run restore-loop"
 	./restore-loop.py build/criu_service.socket build/imgs_loop
diff --git a/test/others/rpc/test-c.c b/test/others/rpc/test-c.c
index 792dbbf9c9..b3507975f8 100644
--- a/test/others/rpc/test-c.c
+++ b/test/others/rpc/test-c.c
@@ -99,6 +99,8 @@ int main(int argc, char *argv[])
 	req.opts->images_dir_fd = dir_fd;
 	req.opts->has_log_level = true;
 	req.opts->log_level = 4;
+	req.opts->has_network_lock = true;
+	req.opts->network_lock = CRIU_NETWORK_LOCK_METHOD__SKIP;
 
 	/*
 	 * Connect to service socket
diff --git a/test/others/rpc/test.py b/test/others/rpc/test.py
index ce8411bc60..6f692f7557 100755
--- a/test/others/rpc/test.py
+++ b/test/others/rpc/test.py
@@ -24,6 +24,7 @@
 req.opts.leave_running = True
 req.opts.log_level = 4
 req.opts.images_dir_fd = os.open(args['dir'], os.O_DIRECTORY)
+req.opts.network_lock = rpc.SKIP
 
 # Send request
 s.send(req.SerializeToString())

