-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
simplify integration testing with matrix jobs #1799
simplify integration testing with matrix jobs #1799
Conversation
name = test + "-postgres" | ||
} | ||
yqCommand := fmt.Sprintf( | ||
"yq eval '.jobs.integration-test.strategy.matrix.test = %s' ../../.github/workflows/test-integration.yaml -i", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add yq
to the flake.nix file so its automatically installed for the dev env? that way we should not run into an issue with needing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure will add it there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little sidenote, is there any particular reason why gofumpt
is not part of the devdeps in the nix shel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it should be, I must have missed it, that can be done in a followup.
Currently we are lacking a bit on jobs to verify the formatting, so a job similar to the "is the tests generated" would potentially be beneficial for golines + gofumpt.
- TestSSHNoSSHConfigured | ||
- TestSSHIsBlockedInACL | ||
- TestSSHUserOnlyIsolation | ||
postgres: [0, 1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be neat if we could fix this naming right of the bat with -sqlite
and -postgres
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah ill try doing it like this
database: [postgres, sqlite]
and use the if commands for the variable so if postgres=1 if sqlite postgres=0
But maybe a better solution would be to change what code expects to get from the env.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok i changed the workflow it will have the name -postgres
or -sqlite
and i change it to if for the env itself if its 1 or 0 :)
In general looks good, thanks for replacing my hacks with some other neater hacks 👍 |
d2fb5aa
to
ae6fad4
Compare
Sorry for one more force push, I realized that the |
hmm, thats some weird postgres failure, all at the same time. |
Fix in #1802 |
I'm just throwing this out there since you have made a very nice change, It would be really nice to have a workflow that runs the generate command and if there is a new file that isnt checked in, it fails so people (me mostly) do not forget to add the new tests. If you are interested in helping more, feel free to see if there are other CI stuff that can be improved, it is mostly something I do the shortest path to success because I really want to spend time on other things, as you can see with the original implementation. The only thing I ask is that its done with Nix so I can have it replicated locally. |
I'll look at what could be improved over the weekend. About the workflow, you're talking about it. Do you mean it will check what tests are in the workflow Happy to help with this project and relieve some of your time towards the features 😄 |
Thank you!
I think the easiest way would be to do something like:
Thank you, I would say this is in the category of "we need it" but not "core business" 😄 |
ae6fad4
to
8c7aa96
Compare
I added the check you suggested. ✔️ |
Great! Ppstfix is in so a rebase should make it happier |
8c7aa96
to
71cdb61
Compare
.github/workflows/check-tests.yaml
Outdated
- name: Generate and check integration tests | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
run: | | ||
nix develop --run "cd cmd/gh-action-integration-generator && go generate" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this needs to be:
nix develop --run -- "cd cmd/gh-action-integration-generator && go generate"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noo its supposed to be nix develop --command
I'm used to nix-shell where its --run
sorry will fix right away
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
71cdb61
to
cddce3a
Compare
Just noticed, maybe go ahaed and cancell the previous waiting checks for aproovement as it now cancells these latest ones and its now running not the final setup. It got stuck in some loop of cancelling a reruning the checks, getting tons of notifications from github 😅 |
cddce3a
to
30545e9
Compare
30545e9
to
90d7b8a
Compare
This PR significantly reduces the number of integration test workflow files. I modified the setup to use the GitHub matrix strategy instead of having 90+ generated workflow files.
I also tried to keep the original go script that generated the workflow files, but now, instead of generating whole workflow files, it adds test names to a matrix strategy. This, in turn, improves readability and updates to the test structure.
This will spawn a job for every combination, so if we fe. have
TestACLHostsInNetMapTable
anddatabase: [postgres, sqlite]
for the matrix strategy, this will create two jobsOr see how it will look in the PR for the already run tests.
Caveats to this setup:
I have checked that the failing tests are not connected to this change. The same issues are currently present with the previous setup.