Skip to content

Conversation

kolyshkin
Copy link
Collaborator

@kolyshkin kolyshkin commented Aug 19, 2025

  1. import1: use t.TempDir

    This test was leaving files and directories under $PWD.
    Use t.TempDir to avoid it.

  2. import1: fix TestImport* cleanup

    TestImport functions create some artefacts under /var/lib/machines which
    require "machinectl remove" invocation to clean up.

    Unfortunately, Import operations are async, meaning we either have to
    listen to transfer events to ensure they are completed, or just sleep
    for some time. Since this is a test I'd like to keep things simple.

)
for range 5 {
time.Sleep(dur)
out, err = exec.Command("machinectl", "image-status", name).CombinedOutput()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is not removing anything, is it? Would this not need to call remove?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! It was remove and when I was doing some testing trying to remove sleep.

Fixed.

This test was leaving files and directories under $PWD.
Use t.TempDir to avoid it.

Signed-off-by: Kir Kolyshkin <[email protected]>
TestImport functions create some artefacts under /var/lib/machines which
require "machinectl remove" invocation to clean up.

Unfortunately, Import operations are async, meaning we either have to
listen to transfer events to ensure they are completed, or just sleep
for some time. Since this is a test I'd like to keep things simple.

Signed-off-by: Kir Kolyshkin <[email protected]>
Copy link
Collaborator

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Luap99 Luap99 merged commit 8214e15 into coreos:main Aug 20, 2025
21 checks passed
@kolyshkin kolyshkin changed the title import1 test fixes import1: test fixes Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants