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

Add windows integration test #1912

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

wildum
Copy link
Contributor

@wildum wildum commented Oct 17, 2024

PR Description

Add windows integration tests github action and an integration tests for the default collectors of the windows exporter.

The Setup-go step is super slow... (actions/setup-go#495)

Which issue(s) this PR fixes

Fixes #1896

@wildum wildum force-pushed the integration-tests-windows branch from 3c93929 to 44d2d92 Compare November 8, 2024 14:59
@wildum wildum marked this pull request as ready for review November 8, 2024 14:59
@wildum wildum requested a review from a team as a code owner November 8, 2024 14:59
@wildum wildum force-pushed the integration-tests-windows branch from 44d2d92 to 8fed84c Compare November 11, 2024 13:43
push:
branches:
- main
pull_request:
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this enable workflow for pull requests? is this temporary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, I did not change it since our discussion, I will remove it before merging to make sure that the test is running properly

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
Copy link
Contributor

Choose a reason for hiding this comment

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

Would that become another place where we need to update Go version? What's the process currently to update these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, and afaik it's just "search and replace" through the codebase :/

Comment on lines +35 to +37
testFolder := "./tests/"
alloyBinaryPath := "../../../../../build/alloy"
alloyBinary := "build/alloy"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's switch to using https://pkg.go.dev/path#Join

Comment on lines +44 to +45
setupEnvironment()
defer cleanUpEnvironment()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why no setup or clean up 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.

can't use the linux images in the windows runner so we are quite limited in terms of environment. For now not using docker and only running one Alloy to run the windows exporter seems to be sufficient. I can rename the function to "setupDockerEnv" and "cleanupDockerEnv" to make it more clear

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 for clarity we should have two types of tests:

  • one running docker compose with dependency projects - maybe "docker-integration-test"
  • another one with just Alloy - maybe "standalone-integration-test"

And have them somewhat more clearly separated in the code. Otherwise it becomes a bit convoluted 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure that it would be really worth it because besides the docker part which is quite small, they would re-use everything. Also I don't think that we need a linux standalone. And maybe one day the windows runner will be able to use WSL 2 and it will work with Mimir linux image or at some point we may want to run a docker windows image and the difference will be gone.
I agree that now it looks a bit convoluted though. I can structure the test better so that it looks less chaotic

if !filepath.IsAbs(specificTest) && !strings.HasPrefix(specificTest, "./tests/") {
specificTest = "./tests/" + specificTest
if !filepath.IsAbs(specificTest) && !strings.HasPrefix(specificTest, testFolder) {
specificTest = testFolder + specificTest
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +87 to +89
// sleep for a few seconds before deleting the files to make sure that they are not use anymore
time.Sleep(5 * time.Second)

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of sleeps, can we have a retry and backoff (without panic on first failure) to remove all files?
Sleeps are notoriously fragile and should be avoided. A slow machine can sometimes hang for 5 seconds.

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.

Ensure coverage of windows exporter
2 participants