Skip to content

Conversation

hiranya911
Copy link
Contributor

We currently perform a credential lookup in the emulator mode, which can result in errors if the developer hasn't specified any credentials during initialization. This PR attempts to solve this problem by defaulting to "owner" emulator credentials in the emulator mode.

One downside of this solution is that it will cause all client options to get ignored in emulator mode. Ideally we should check if the developer has specified any credentials, and only replace that. But currently there's no clean way to implement such a replacement.

Also found a couple of existing unit tests that were taking 7 seconds each due to automatic retries. I've disabled retries for those tests thus saving 14 seconds from our unit test runs.

Resolves #458

Copy link
Member

@lahirumaramba lahirumaramba left a comment

Choose a reason for hiding this comment

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

LGTM! Left one comment?

@@ -114,7 +120,15 @@ func NewClient(ctx context.Context, conf *internal.AuthConfig) (*Client, error)
return nil, err
}

transport, _, err := transport.NewHTTPClient(ctx, conf.Opts...)
var opts []option.ClientOption
Copy link
Member

Choose a reason for hiding this comment

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

You must have tried this already... but just for my curiosity, can we access conf.Opts here without creating a new []option.ClientOption and append the ts?

Copy link
Contributor Author

@hiranya911 hiranya911 Sep 1, 2021

Choose a reason for hiding this comment

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

conf gets passed into this function as an argument. I'm not a huge fan of modifying function arguments, since the caller usually has a reference to the same struct. Granted, in this case it doesn't really do anything adverse. But I'd still like to stick to a consistent style.

@hiranya911 hiranya911 merged commit 241c293 into dev Sep 2, 2021
@hiranya911 hiranya911 deleted the hkj-emulator-creds branch September 2, 2021 20:50
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.

3 participants