-
Notifications
You must be signed in to change notification settings - Fork 70
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
Bulk convert to using testify/suite for tests #1185
Conversation
db4bd0e
to
f6435f8
Compare
@ashb This PR has been in draft state for a very long time? Do you still plan to proceed further? |
There were a couple of places where `cmdExec` was changed but not changed back. Now by this being a test suit it's handled for us
And also notice that the test files were misnamed so not always run!
6845b64
to
2b0e736
Compare
I've just updated this PR and it's ready for review now. |
4d1a0a1
to
8bcc025
Compare
Tests not updated by this PR
|
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 have breezed through all the file changes, it's hard to stop and check each line change. But overall LGTM. Also, we should aim to solve the issue with the shared state between tests, happy to help out with that effort @kushalmalani.
8bcc025
to
0bfecef
Compare
Yeah, almost all of these changes were automatic by the patch in the PR desc, or manually creating the driver test: type Suite struct {
suite.Suite
}
func TestAirflowClient(t *testing.T) {
suite.Run(t, new(Suite))
} or in a few cases fixing left over state from one test to another etc. |
45794d0
to
420a6b8
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1185 +/- ##
==========================================
- Coverage 86.72% 86.65% -0.07%
==========================================
Files 114 114
Lines 16707 16709 +2
==========================================
- Hits 14489 14480 -9
- Misses 1329 1337 +8
- Partials 889 892 +3 ☔ View full report in Codecov by Sentry. |
Is this saying it things the coverage has dropped by 22% 😱 Yeah, I've messed something up. On main:
Whoops foolish Ash, I disabled a bunch of tests in my testing |
420a6b8
to
ab5cbfb
Compare
Okay I fixed that issue, but coverage is still reporting a big drop, but the individual views aren't showing what's actually dropped. |
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 looks good and much needed to improve testing framework in CLI. Thanks ash!
This is in some regards a "change for no purpose" but it lets us more
easily add setup or teardown to tests.
The
go test
compatible test was named after the Go packge./pkg/workspace
becomesTestPkgWorkspaceSuite
.This change was almost entirely automatically applied using
github.com/uber-go/gopatch
I have not converted 100% of tests to use suites, some of them proved to have ordering bugs (tests relying on state left over or setup from a previous test) that I wasn't able to easily/quickly solve, and I haven't applied Setup/Teardown functions universally, only where I specifically noticed them.
The patch file used was this: