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

Various test improvements #130

Merged
merged 3 commits into from
Oct 30, 2024
Merged

Various test improvements #130

merged 3 commits into from
Oct 30, 2024

Conversation

mkisielewski-arista
Copy link
Contributor

@mkisielewski-arista mkisielewski-arista commented Oct 14, 2024

This PR brings a handful of improvements to how tests are run in eext.

  1. afecec0 remove redundant build tag
    We require golang 1.18, and the tag that's removed by this patch was needed for golang versions older than 1.17.
  2. f25fcba remove double running of the tests in cmd/
    go test dir -tags=sometag runs the tests tagged with "sometag", but also runs all the untagged tests, thus, having both:
    • go test code.arista.io/eos/tools/eext/cmd
    • go test code.arista.io/eos/tools/eext/cmd -tags privileged
      doesn't bring any value. The elapsed time spent testing is effectively halved.
  3. 121baa9 mark some tests as "containerized" and make barney run them.
    This commit brings a distinction between unit/code tests and a production-like tests. The latter do destructive changes to the system they're being run on and they should be run in container, thus the "containerized" tag.
    Barney already run all the tests, including the destructive ones, so this patch also makes sure that barney runs the newly marked tests.
    Overall this patch enables developers to run the normal unit and integration tests without having to reach to Barney to iterate.
    The follow-up patch would be to mock all the system tools called by the tests and mocking them inside the code, creating the non-destructive alternative set that could be run on any machine.

The Barney test run go test output is here.

We require golang 1.18, and the tag that's removed by this patch was
needed for golang versions older than 1.17.
`go test dir -tags=sometag` runs the tests taged with "sometag", but
also runs **all the untagged** tests, thus, having both:
* `go test code.arista.io/eos/tools/eext/cmd`
* `go test code.arista.io/eos/tools/eext/cmd -tags privileged`
doesn't bring any value.
This commit brings a disctinction between unit/code tests and a
production-like tests. The latter do destructive changes to the system
they're being run on and they should be run in container, thus the
"containerized" tag.

Barney already run all the tests, including the destructive ones, so
this patch also makes sure that barney runs the newly marked tests.

Overall this patch enables developers to run the normal unit and
integration tests without having to reach to Barney to iterate.

The follow-up patch would be to mock all the system tools called by the
tests and mocking them inside the code, creating the non-destructive
alternative set that could be run on any machine.
@aajith-arista aajith-arista merged commit 419a5ba into main Oct 30, 2024
2 checks passed
@aajith-arista aajith-arista deleted the test-improvements branch October 30, 2024 11:51
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