-
Notifications
You must be signed in to change notification settings - Fork 977
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
chore: parallelize unit tests #3081
Conversation
@@ -25,37 +25,37 @@ func mkpw(t *testing.T, length int) []byte { | |||
} |
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.
From ~35s to ~12s
driver/registry_default_test.go
Outdated
@@ -30,10 +30,19 @@ import ( | |||
"github.com/ory/kratos/selfservice/hook" |
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.
From ~35s to 1.3s (not a typo 😅)
Reason being that internal.NewFastRegistryWithMocks
was running migrations on every sub-test case, which always took around 0.5s - 1s. Also, parallalizing helped a bit too.
Since we are just testing config here, this should be a good change. LMK, if you think otherwise...
testDatabase(t, "cockroach", dockertest.ConnectToTestCockroachDBPop(t)) | ||
} | ||
|
||
func testDatabase(t *testing.T, db string, c *pop.Connection) { |
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.
Turn off whitespace diff to see what actually changed here.
testDatabase(t, "mysql", dockertest.ConnectToTestMySQLPop(t)) | ||
} | ||
|
||
func TestMigrations_Cockroach(t *testing.T) { |
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 setup is a lot easier to use. I've had to comment out parts of the old setup from time to time, if say the mysql migrations were failing, and I wanted to debug. Now, I can just click debug on the TestMigrations_Mysql
case. WDYT?
@@ -6,7 +6,6 @@ package migratest | |||
import ( |
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 real speedup here, just some cleanup.
Codecov Report
@@ Coverage Diff @@
## master #3081 +/- ##
=======================================
Coverage 77.62% 77.62%
=======================================
Files 317 317
Lines 20041 20046 +5
=======================================
+ Hits 15556 15561 +5
Misses 3292 3292
Partials 1193 1193
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@@ -26,7 +26,7 @@ import ( | |||
) |
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.
These were running for around 5s and are now < 0.5s total.
(They are called by the github.com/ory/kratos/courier/template/email
tests, which were running for around 40s and are now at 6.5s)
@@ -224,7 +224,9 @@ func TestWebHooks(t *testing.T) { | |||
}, |
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.
25.608s => 9s
What is needed to merge this? |
9d7a662
to
c34c94f
Compare
Still some more to go, but let's merge this, and I'll work on the others in separate PRs. |
Related issue(s)
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got the approval (please contact
[email protected]) from the maintainers to push
the changes.
works.
Further Comments