pkg/machine/e2e: use tmp file for connections

On linux and macos the connections are stored under the home dir by
default so it is not a problem there but on windows we first check
the APPDATA env and use this dir as config storage. This has the problem
that it is not cleaned up after each test as such connections might leak
into the following test causing failues there.

Fixes #22844

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-07-01 13:04:03 +02:00
parent 672c6c8702
commit f84f4a9cce

View File

@ -111,6 +111,9 @@ func setup() (string, *machineTestBuilder) {
if err := os.Unsetenv("SSH_AUTH_SOCK"); err != nil { if err := os.Unsetenv("SSH_AUTH_SOCK"); err != nil {
Fail("unable to unset SSH_AUTH_SOCK") Fail("unable to unset SSH_AUTH_SOCK")
} }
if err := os.Setenv("PODMAN_CONNECTIONS_CONF", filepath.Join(homeDir, "connections.json")); err != nil {
Fail("failed to set PODMAN_CONNECTIONS_CONF")
}
mb, err := newMB() mb, err := newMB()
if err != nil { if err != nil {
Fail(fmt.Sprintf("failed to create machine test: %q", err)) Fail(fmt.Sprintf("failed to create machine test: %q", err))