- Notifications
You must be signed in to change notification settings - Fork1k
chore: remove duplicate validate calls on same oauth token#11598
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -184,6 +184,9 @@ type Options struct { | ||
// under the enterprise license, and can't be imported into AGPL. | ||
ParseLicenseClaims func(rawJWT string) (email string, trial bool, err error) | ||
AllowWorkspaceRenames bool | ||
// NewTicker is used for unit tests to replace "time.NewTicker". | ||
NewTicker func(duration time.Duration) (tick <-chan time.Time, done func()) | ||
} | ||
// @title Coder API | ||
@@ -208,6 +211,12 @@ func New(options *Options) *API { | ||
if options == nil { | ||
options = &Options{} | ||
} | ||
if options.NewTicker == nil { | ||
options.NewTicker = func(duration time.Duration) (tick <-chan time.Time, done func()) { | ||
ticker := time.NewTicker(duration) | ||
return ticker.C, ticker.Stop | ||
} | ||
} | ||
Comment on lines +214 to +219 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This is OK for now but we should probably swap this out for something better later on 🕰️ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I agree. Some fake clock solution would be ideal, then we can use across all tests more generally. | ||
// Safety check: if we're not running a unit test, we *must* have a Prometheus registry. | ||
if options.PrometheusRegistry == nil && flag.Lookup("test.v") == nil { | ||