8000 chore: general linting and update integration tests to be cross-platform by JasonLovesDoggo · Pull Request #133 · TecharoHQ/anubis · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: general linting and update integration tests to be cross-platform #133

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

Closed
wants to merge 11 commits into from

Conversation

JasonLovesDoggo
Copy link
Member

Updated the integration tests to be cross-platform (tested on Windows 11 & ubuntu)
Some linting fixes & fieldalignement where it didn't look too bad.

Didn't add changes to unreleased as all changes are already present

Checklist:

  • Added a description of the changes to the [Unreleased] section of docs/docs/CHANGELOG.md
  • Tested this at least manually

JasonLovesDoggo and others added 5 commits March 26, 2025 19:30
- Use `errors.Is` for comparing errors in `cmd/anubis/main.go`.
- Use `errors.New` instead of `fmt.Errorf` for simple errors
  in `cmd/containerbuild/main.go` and `lib/anubis.go`.
- Align fields in structs in `lib/policy/bot.go`
  and `lib/policy/config/config.go`.
- Remove unnecessary variable shadowing in tests.
- Use `t.TempDir()` in `internal/test/playwright_test.go`.
- Use `strconv.Itoa` instead of `fmt.Sprint` for integer
  conversion in `lib/anubis_test.go`.
Updates integration tests to function correctly on both Windows and
Unix-like systems.  Replaces shell-specific commands with
cross-platform alternatives for running and daemonizing processes.
Also includes a more robust temporary file creation mechanism.
Improves reliability and consistency of the test suite across
different operating systems.
Signed-off-by: Jason Cameron <jasoncameron.all@gmail.com>
if runtime.GOOS == "windows" {
cmd = exec.Command("cmd", "/C", "start", "/B", command)
} else {
cmd = exec.Command("sh", "-c", command+" &")
Copy link
Contributor

Choose a reason for hiding this comment

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

This won't do what you think it will I don't think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, I tested it on windows/linux, and it worked fine. I think my only difference was the background (via & and /B), I can run the previous tests as well to double check they behave the same

@JasonLovesDoggo JasonLovesDoggo changed the title chore: handle deferred close errors explicitly (lint) chore: general linting and update integration tests to be cross-platform Mar 27, 2025
@JasonLovesDoggo
Copy link
Member Author

Bump! The integration tests not working on windows is pretty annoying

@Xe
Copy link
Contributor
Xe commented Mar 30, 2025

I'm not sure I want to merge this as-is. I understand the desire to do this testing from windows, but there's significant semantic differences between cmd.exe and bash syntax in ways that would make it annoying to write. I personally do all my development for Anubis in WSL (specifically in an Ubuntu container). I think it may be better to just tell people to use WSL to do this for now.

I do want to have better windows support eventually, but Windows needs dedicated experience and knowledge in ways that I just don't have the time for. I was personally planning on making windows support first-class when there's an enterprise customer with windows specifically in mind.

Well that, and the fact that Windows server costs enough that people are not willing to run it for open source projects. I'd love to be proven wrong though!

@JasonLovesDoggo
Copy link
Member Author

I'm not sure I want to merge this as-is. I understand the desire to do this testing from windows, but there's significant semantic differences between cmd.exe and bash syntax in ways that would make it annoying to write. I personally do all my development for Anubis in WSL (specifically in an Ubuntu container). I think it may be better to just tell people to use WSL to do this for now.

I do want to have better windows support eventually, but Windows needs dedicated experience and knowledge in ways that I just don't have the time for. I was personally planning on making windows support first-class when there's an enterprise customer with windows specifically in mind.

Well that, and the fact that Windows server costs enough that people are not willing to run it for open source projects. I'd love to be proven wrong though!

Fair enough. When that enterprise client comes knocking, feel free to ping me, and I'm happy to work on that. I'll open a PR with just the linting changes sometime tomorrow.

Thanks for the response!

@JasonLovesDoggo
Copy link
Member Author
JasonLovesDoggo commented Mar 30, 2025

though maybe we should update the integration_test.go file to have !goos=windows buildflag as whenever I run go test ./... I always get annoyed by the failure lol

@Xe
Copy link
Contributor
Xe commented Mar 30, 2025

Makes sense. Ship it!

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
0