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 <mario.loriedo@gmail.com>
This commit is contained in:
Mario Loriedo
2025-03-18 14:39:16 +01:00
parent ba787dabab
commit ac787b6691

View File

@ -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()