Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tmpnet] Ensure tmpnet compatibility with windows #3002

Merged
merged 4 commits into from May 20, 2024

Conversation

marun
Copy link
Contributor

@marun marun commented May 7, 2024

Why this should be merged

This avoids breaking unit test discovery on windows for any package that imports tmpnet.

How this works

Separate os-specific process configuration into files that are conditionally compiled.

How this was tested

CI should be sufficient

@marun marun added the testing This primarily focuses on testing label May 7, 2024
@marun marun self-assigned this May 7, 2024
Copy link
Contributor

@abi87 abi87 left a comment

Choose a reason for hiding this comment

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

LGTM.
I don't get whether we can run tmpnets on windows with this PR alone or if is there other work to do.

Comment on lines 12 to 17
GOOS=$(go env GOOS)
if [[ "$GOOS" == "windows" ]]; then
# tmpnet is not compatible with windows
EXCLUDED_TARGETS="${EXCLUDED_TARGETS} | grep -v tests/fixture"
fi

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess now tmpnet is windows compatible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Compatible with test discovery, yes. But since we don't run e2e on windows I have no confidence in the compatibility for actually running tempory networks on windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the windows implementation to panic. The previous code was untested and I don't think there's value in maintaining an untested solution.

@@ -0,0 +1,17 @@
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should this file be renamed something like "detached_process_default.go"?
Windows seems to be the special case we have.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@marun marun force-pushed the tmpnet-windows-compatible branch from af01132 to 0b8982d Compare May 7, 2024 19:48
marun added 2 commits May 13, 2024 11:01
This avoids breaking unit test discovery for any package that imports
tmpnet.
@marun marun force-pushed the tmpnet-windows-compatible branch from f82c711 to da51a7f Compare May 13, 2024 18:01
@marun
Copy link
Contributor Author

marun commented May 13, 2024

Rebased

tests/fixture/tmpnet/detached_process_windows.go Outdated Show resolved Hide resolved
cmd.SysProcAttr = &syscall.SysProcAttr{
Setsid: true,
}
configureDetachedProcess(cmd)
Copy link
Contributor

Choose a reason for hiding this comment

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

To clarify - this PR is to make it so that this code can compile on windows, but there is no expectation for it to run on windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct.

Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
Signed-off-by: marun <maru.newby@avalabs.org>
@StephenButtolph StephenButtolph added this pull request to the merge queue May 20, 2024
Merged via the queue into master with commit 7106666 May 20, 2024
19 of 20 checks passed
@StephenButtolph StephenButtolph deleted the tmpnet-windows-compatible branch May 20, 2024 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing This primarily focuses on testing
Projects
Status: Done ✅
Development

Successfully merging this pull request may close these issues.

None yet

4 participants