From ac787b669158bab382e5dc4ce28538976a8fdbb3 Mon Sep 17 00:00:00 2001 From: Mario Loriedo Date: Tue, 18 Mar 2025 14:39:16 +0100 Subject: [PATCH] Fix flake on machine cp e2e test Explicitly close file to avoid machine e2e test to fail on CI from time to time. See for example this failed execution of the machine-wsl task: https://api.cirrus-ci.com/v1/artifact/task/6697640798191616/html/machine-wsl-podman-windows-rootless-host-sqlite.log.html Fix #25614 Signed-off-by: Mario Loriedo --- pkg/machine/e2e/cp_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/machine/e2e/cp_test.go b/pkg/machine/e2e/cp_test.go index 103dd25d04..a68e9ab765 100644 --- a/pkg/machine/e2e/cp_test.go +++ b/pkg/machine/e2e/cp_test.go @@ -43,13 +43,17 @@ var _ = Describe("podman machine cp", func() { guestToHostDir = "guest-foo-dir" ) - _, err := os.Create(filePath) + f, err := os.Create(filePath) + Expect(err).ToNot(HaveOccurred()) + err = f.Close() Expect(err).ToNot(HaveOccurred()) err = os.MkdirAll(directoryPath, 0755) Expect(err).ToNot(HaveOccurred()) - _, err = os.Create(fileInDirectoryPath) + f, err = os.Create(fileInDirectoryPath) + Expect(err).ToNot(HaveOccurred()) + err = f.Close() Expect(err).ToNot(HaveOccurred()) name := randomString()