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

Speed up auth package tests by setting lower test-only bcrypt cost #6682

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

bbrks
Copy link
Member

@bbrks bbrks commented Feb 13, 2024

Initialize most auth tests with NewTestAuthenticator, which lowers the bcrypt cost.

Comparison

- ok  	github.com/couchbase/sync_gateway/auth	8.656s
+ ok  	github.com/couchbase/sync_gateway/auth	2.361s

Integration Tests

  • n/a (unit test covered)

Copy link
Contributor

@gregns1 gregns1 left a comment

Choose a reason for hiding this comment

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

LGTM, one nitpick but happy to merge as is

@@ -27,6 +27,11 @@ import (
"gopkg.in/square/go-jose.v2/jwt"
)

func NewTestAuthenticator(t testing.TB, dataStore sgbucket.DataStore, channelComputer ChannelComputer, opts AuthenticatorOptions) *Authenticator {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, but do we need t passed in here? Doesn't look to be used

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not used but added to prevent this function accidentally being moved and used in non-test code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense! Good shout! 😄

@bbrks bbrks merged commit 03a1274 into master Feb 13, 2024
17 checks passed
@bbrks bbrks deleted the speedup_auth_package_tests branch February 13, 2024 18:48
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.

2 participants