Skip to content

Comments

internal/testutils: make TempBPFFS portable#1688

Merged
lmb merged 1 commit intocilium:mainfrom
lmb:windows-testutils-bpffs
Feb 24, 2025
Merged

internal/testutils: make TempBPFFS portable#1688
lmb merged 1 commit intocilium:mainfrom
lmb:windows-testutils-bpffs

Conversation

@lmb
Copy link
Contributor

@lmb lmb commented Feb 17, 2025

Object pinning on Windows isn't backed by a file system, instead the path is just used as an identifier. Generate a random prefix to use for tests on Windows.

@lmb lmb marked this pull request as ready for review February 17, 2025 17:50
@lmb lmb requested a review from a team as a code owner February 17, 2025 17:50
Object pinning on Windows isn't backed by a file system, instead
the path is just used as an identifier. Generate a random prefix
to use for tests on Windows.

Signed-off-by: Lorenz Bauer <[email protected]>
"github.com/go-quicktest/qt"
)

func TestTempBPFFS(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this test is really necessary; could we cover this with existing tests that run on both platforms? I get that this is more of a smoke test, but if it wouldn't work correctly, tests in the root package would probably also fail, especially given that t.Cleanup() looks very strict around wanting to remove all pins explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't really have tests which pin and then check that the function removes pins, I discovered this the hard way. Mostly because on Linux the cleanup is just os.RemoveAll, where here it's more involved. We could make this a test which runs on Linux as well, the benefit there is minimal IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is to say: I think it's worth having this test.

@lmb lmb merged commit e2e008f into cilium:main Feb 24, 2025
18 checks passed
@lmb lmb deleted the windows-testutils-bpffs branch February 24, 2025 19:47
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