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

Integration tests proposal #5475

Merged
merged 15 commits into from
Oct 27, 2023
Merged

Integration tests proposal #5475

merged 15 commits into from
Oct 27, 2023

Conversation

wildum
Copy link
Contributor

@wildum wildum commented Oct 13, 2023

PR Description

This PR introduces integration testing to the agent for flow.

Which issue(s) this PR fixes

Notes to the Reviewer

PR Checklist

  • Documentation added

@wildum wildum requested a review from a team as a code owner October 13, 2023 18:14
@wildum wildum mentioned this pull request Oct 13, 2023
2 tasks
Copy link
Contributor

@ptodev ptodev left a comment

Choose a reason for hiding this comment

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

Thank you for working on this. I added a few comments. It would also be nice to have documentation on when we should use unit tests vs when we should use integration tests.

In the future, I also wonder if we can use k6 for any of the tests. We don't have to do it for this PR though.

integration-tests/configs/mimir/mimir.yaml Outdated Show resolved Hide resolved
integration-tests/configs/otel-gen-client/main.go Outdated Show resolved Hide resolved
integration-tests/configs/otel-gen-client/main.go Outdated Show resolved Hide resolved
integration-tests/docker-compose.yaml Show resolved Hide resolved
Copy link
Contributor

@thampiotr thampiotr left a comment

Choose a reason for hiding this comment

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

Few comments. I would also like to see a README.md where we could describe what tests are appropriate for this framework and what are the alternatives.

In general, I would be inclined to merge this and see how reliable it is in practice. We may tweak or revert it later, but either way it's a worthwhile experiment and good work driving and implementing this @wildum ! 🎉 👏

Makefile Show resolved Hide resolved
integration-tests/common/log.go Outdated Show resolved Hide resolved
integration-tests/common/metric.go Outdated Show resolved Hide resolved
integration-tests/configs/mimir/mimir.yaml Outdated Show resolved Hide resolved
integration-tests/configs/otel-gen-server/main.go Outdated Show resolved Hide resolved
integration-tests/main.go Outdated Show resolved Hide resolved
integration-tests/tests/otel-to-prom-metrics/config.river Outdated Show resolved Hide resolved
integration-tests/utils.go Outdated Show resolved Hide resolved
integration-tests/docker-compose.yaml Show resolved Hide resolved
@wildum wildum requested a review from ptodev October 25, 2023 12:49
Copy link
Contributor

@ptodev ptodev left a comment

Choose a reason for hiding this comment

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

Thanks, looks good! I'm happy for it to be merged once @thampiotr also approves.
Btw I wonder if we can also test kubernetes components one day too, using something like k3d. Testing kubernetes-related things locally has been a bit of a pain for me personally.

Comment on lines 3 to 4
# Run tests on main just so the module and build cache can be saved and used
# in PRs. This speeds up the time it takes to test PRs dramatically.
Copy link
Contributor

Choose a reason for hiding this comment

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

So the build cache of main is used when building PRs, but the build cache of one PR is not used when building other PRs? I thought that the cache would be something stored on a build server, and it'd be used regardless of which branch is being built.

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 thought that the cache would be something stored on a build server, and it'd be used regardless of which branch is being built." -> I believe that this is correct. I think that the point is to always have a fresh cache available from the main branch that PRs can use when building for the first time

Copy link
Contributor

Choose a reason for hiding this comment

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

When is this workflow ran on the main branch? Is it when a PR is merged to it? If the test already ran during the PR, I'm not sure if there is any point in having them also run after the PR is merged? I guess the cache would be the same.

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 agree but @rfratto removed it and they put it back for the unit tests in #2921. Robert in the PR you say that "it turns out commits to main are responsible for storing the module and build cache", but aren't PRs also building the same cache?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm ok. I am not sure why this is, but if you could clarify in the comment in .github/workflows/integration-tests.yml that the cache will only be populated if we run this on main and not just the CI of any other branch? It'd be nice if @rfratto could help clarify further why this is, if he happens to remember the reason.

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 think we cant try without it and see how it behaves. If we see that the PRs don't hit the cache we can investigate further

Copy link
Contributor

Choose a reason for hiding this comment

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

If we see that the PRs don't hit the cache

Do you know how to check for this? IS there a log line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the tests run under 4 mins then the cache was hit, if it runs in around 14mins that means that it spent 10mins to download the dependencies instead of using the cache

integration-tests/common/metric.go Show resolved Hide resolved
integration-tests/docker-compose.yaml Show resolved Hide resolved
@ptodev ptodev merged commit 6acb80f into main Oct 27, 2023
8 checks passed
@ptodev ptodev deleted the integration-test-proposal branch October 27, 2023 14:27
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Feb 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants