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

refactor: Run unit tests separately from e2e tests #867

Closed
wants to merge 14 commits into from

Conversation

faddat
Copy link
Contributor

@faddat faddat commented Apr 20, 2023

Description

Closes #908

The venerable @mvdan has contributed many things to the golang ecosystem and it seems he has also made a nice matrix test setup. Having this in CI makes ensuring compatibility easier and makes test results visible.

This is a CI only change.

Alongside the initial changes, I've decoupled the workflow for unit tests and e2e tests so that failures in unit tests do not block e2e tests. This will make sure that failures are more visible in ci, making developers lives easier.

Type of change

If you've checked more than one of the first three boxes, consider splitting this PR into multiple PRs!

  • Feature: Changes and/or adds code behavior, irrelevant to bug fixes
  • Fix: Changes and/or adds code behavior, specifically to fix a bug
  • Refactor: Changes existing code style, naming, structure, etc.
  • Testing: Adds testing
  • Docs: Adds documentation

Regression tests

If Refactor, describe the new or existing tests that verify no behavior was changed or added where refactors were introduced.

New behavior tests

If Feature or Fix, describe the new or existing tests that verify the new behavior is correct and expected.

Versioning Implications

If the above box is checked, which version should be bumped?

  • MAJOR: Consensus breaking changes to both the provider and consumers(s), including updates/breaking changes to IBC communication between provider and consumer(s)
  • MINOR: Consensus breaking changes which affect either only the provider or only the consumer(s)
  • PATCH: Non consensus breaking changes

Targeting

Please select one of the following:

  • This PR is only relevant to main
  • This PR is relevant to main, and should also be back-ported to ____ (ex: v1.0.0 and v1.1.0)
  • This PR is only relevant to ____ (ex: v1.0.0, v1.1.0, and v1.2.0)

@jtremback
Copy link
Contributor

Cool. So is this going to show compatibility of builds on different OSs?

@faddat
Copy link
Contributor Author

faddat commented Apr 21, 2023

yep :) - also osx-windows-linux

@jtremback
Copy link
Contributor

Does this have any downsides? Does it slow down testing at all? Is it running the tests a bunch of different times?

@faddat
Copy link
Contributor Author

faddat commented Apr 24, 2023

no. It is a standard github action with the matrix setup. It will always be dranatically faster than the job called "automated testing"

it runs:

  • go 1.19: windows, mac and linux
  • go 1.20: windows, mac and linux

@faddat
Copy link
Contributor Author

faddat commented Apr 29, 2023

I'd like to get this merged, so that these tests are run separately from the automated tests. Right now the "automated tests" fail if the unit tests fail, and we don't get the feedback from the integration tests.

@faddat faddat changed the title Create go-tests.yml refactor: Run unit tests separately from integration tests Apr 29, 2023
@faddat

This comment was marked as off-topic.

@faddat faddat changed the title refactor: Run unit tests separately from integration tests refactor: Run unit tests separately from e2e tests Apr 29, 2023
Copy link
Contributor

@mpoke mpoke left a comment

Choose a reason for hiding this comment

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

Thanks @faddat for your contribution. See my comments below.

.github/workflows/go-tests.yml Outdated Show resolved Hide resolved
.github/workflows/go-tests.yml Outdated Show resolved Hide resolved
.github/workflows/go-tests.yml Outdated Show resolved Hide resolved
- name: E2E tests
run: make test-e2e-short
run: go run ./tests/e2e/... --happy-path-only
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
run: go run ./tests/e2e/... --happy-path-only
run: make test-e2e-short

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh -- actually I'd meant to add --verbose

Copy link
Contributor

Choose a reason for hiding this comment

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

Please use make test-e2e-short. Developers can always run the tests locally with --verbose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But we can't prove outcomes using CI, so that there's no debate, in the way that you recommend.

CI is a neutral and clearly defined build environment that can be used as proof of issues.

Copy link
Contributor Author

@faddat faddat May 5, 2023

Choose a reason for hiding this comment

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

We want proof, there is no reason whatsoever not to capture the logs.

.github/workflows/automated-tests.yml Outdated Show resolved Hide resolved
@mmulji-ic
Copy link
Contributor

mmulji-ic commented May 4, 2023

Does this have any downsides? Does it slow down testing at all? Is it running the tests a bunch of different times?

We have a limited number of workers, Marko was complaining about this earlier, so we need to rationalise how many tests we run & how often. Ditto with Gaia, coz they're already quite long, adding matrix testing will eat into our budget even more. Just FYI, we need to find a sweet spot - perhaps an exercise for later.

@faddat
Copy link
Contributor Author

faddat commented May 5, 2023

@mmulji-ic so I've got to agree with you on this point. And the options are short of rough. I had thought about moving over to a gitlab that we sell host but this has other significant disadvantages.

I'm curious to learn about what we spend on GitHub, and how to reduce that spend.

At notional, we use only GitHub free features with the exception of copilot.

When we accidentally enabled some kind of a corporate premium mode, we got a bill for 13500, I nearly had a heart attack.

@tac0turtle
Copy link
Member

@faddat id recommend implementing the approach in the sdk here. This way we can be consistent with all repos. Secondly im not sure the need to test on different OS a single os is fine as we target linux machine for production instead of things like windows and mac. I think after adopting the sdk approach this would be good to go 😄

@faddat faddat requested a review from a team as a code owner May 6, 2023 17:47
@faddat
Copy link
Contributor Author

faddat commented May 6, 2023

this log helped me to make a major step forward with 47ification:

https://github.com/cosmos/interchain-security/actions/runs/4903809348/jobs/8756471785?pr=869

the way things are displayed matters, and helps

human time is much more expensive than machine time

@faddat
Copy link
Contributor Author

faddat commented May 12, 2023

I just want to say that I am comfortable asserting that this is the correct way for CI to work in this repository. You can close the pull request if you'd like to, but I believe that this is good.

@faddat faddat mentioned this pull request May 13, 2023
18 tasks
@shaspitz
Copy link
Contributor

The idea here is solid but we're going to take a different direction

@shaspitz shaspitz closed this Jun 13, 2023
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.

Ease of use: Remove unit tests from automated-tests
6 participants