From 3b5171d0ee699059e6f5108e7135c4d3a14fbb66 Mon Sep 17 00:00:00 2001
From: Paul Holzinger <pholzing@redhat.com>
Date: Thu, 29 Sep 2022 14:37:02 +0200
Subject: fix "podman system prune networks" flake

Since by default the network config dir is shared in the e2e tests any
other parallel running test could remove a network and cause this test to
fail.

Fixes #15990

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
---
 test/e2e/network_test.go | 4 ++--
 test/e2e/prune_test.go   | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index b2f50ca55..4366d84aa 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -706,7 +706,7 @@ var _ = Describe("Podman network", func() {
 	})
 
 	It("podman network prune --filter", func() {
-		// set custom cni directory to prevent flakes
+		// set custom network directory to prevent flakes since the dir is shared with all tests by default
 		podmanTest.NetworkConfigDir = tempdir
 		if IsRemote() {
 			podmanTest.RestartRemoteService()
@@ -754,7 +754,7 @@ var _ = Describe("Podman network", func() {
 	})
 
 	It("podman network prune", func() {
-		// set custom cni directory to prevent flakes
+		// set custom network directory to prevent flakes since the dir is shared with all tests by default
 		podmanTest.NetworkConfigDir = tempdir
 		if IsRemote() {
 			podmanTest.RestartRemoteService()
diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go
index 0b1d68aea..e91569231 100644
--- a/test/e2e/prune_test.go
+++ b/test/e2e/prune_test.go
@@ -259,6 +259,12 @@ var _ = Describe("Podman prune", func() {
 	})
 
 	It("podman system prune networks", func() {
+		// set custom network directory to prevent flakes since the dir is shared with all tests by default
+		podmanTest.NetworkConfigDir = tempdir
+		if IsRemote() {
+			podmanTest.RestartRemoteService()
+		}
+
 		// Create new network.
 		session := podmanTest.Podman([]string{"network", "create", "test"})
 		session.WaitWithDefaultTimeout()
-- 
cgit v1.2.3-54-g00ecf