-
Notifications
You must be signed in to change notification settings - Fork 137
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
DB Package Unit Tests #361
Conversation
cdd06a9
to
6356905
Compare
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.
Hey @CarlosOVillanueva overall a great start! I'd like to see some more parameterized/randomised data instead of so many hard coded values. Removal of some test setup dupe by using parameterized sub tests would be good too.
5d4b900
to
7813e2d
Compare
@CarlosOVillanueva please rebase on top of master so golangci-lint action doesn't have errors |
7813e2d
to
963d85b
Compare
c7247ff
to
45f070d
Compare
45f070d
to
6c4527d
Compare
@mmlb I've been following on the discussion with both @CarlosOVillanueva and yourself. Believe all the asks you've discussed have been addressed. |
6c4527d
to
5fc9bd8
Compare
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.
We can't merge code that do not pass CI @DavidHwu
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.
besides the CI not passing, there's still a couple of tests that should verify that the intended updated was actually persisted and not that the function didn't error (trust, but verify :D )
if err = a.tinkDb.UpdateWorkflowState(a.ctx, wfContext); err != nil { | ||
a.logger.Error(err) | ||
t.Error(err) | ||
} |
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.
this test isn't actually verifying that the state was updated right?
if err = a.tinkDb.CreateTemplate(a.ctx, "bar", a.templateData, id); err != nil { | ||
a.logger.Error(err) | ||
t.Fail() | ||
} |
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.
this should verify that template was in fact updated and not just that there was no error right?
bc169c2
to
8dd64d1
Compare
7f56fb6
to
b5822e2
Compare
Signed-off-by: [email protected] <[email protected]>
@gauravgahlot do you mind having a look at which tests we can rewrite using the new framework? If all of them are already in you can close this PR. Thanks |
Most of the setup code will be gone with the new framework in place. We can rewrite the Get tests for all three resource types. Create and Delete are already covered. I will update the branch and use the new framework to rewrite the tests. |
## Description The PR adds unit tests for `Get` requests to resources (template, hardware, workflow). Restructures the tests in #361 as per the new framework. ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [x] added unit or e2e tests - [ ] provided instructions on how to upgrade
Sure thanks |
Description
Unit tests for testing db package. These tests require the postgres container to be up and running. Failure to include this will result in failed tests.
Why is this needed
The only unit tests in the db package are mock tests that do not validate database schema or functions embedded in database calls. These new tests validate requests against database responses.
How Has This Been Tested?
go test -v
from within the db package.How are existing users impacted? What migration steps/scripts do we need?
Checklist:
I have: