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

fix(transport): set UniverseDomain in http.NewClient for new auth #2773

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions transport/grpc/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ func dialPoolNewAuth(ctx context.Context, secure bool, poolSize int, ds *interna
DefaultScopes: ds.DefaultScopes,
SkipValidation: skipValidation,
},
UniverseDomain: ds.UniverseDomain,
})
return pool, err
}
Expand Down
12 changes: 12 additions & 0 deletions transport/grpc/dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ func TestDial(t *testing.T) {
func TestDialPoolNewAuthDialOptions(t *testing.T) {
oldDialContextNewAuth := dialContextNewAuth
var wantNumOpts int
var universeDomain string
// Replace package var in order to assert DialContext args.
dialContextNewAuth = func(ctx context.Context, secure bool, opts *grpctransport.Options) (grpctransport.GRPCClientConnPool, error) {
if len(opts.GRPCDialOpts) != wantNumOpts {
t.Fatalf("got: %d, want: %d", len(opts.GRPCDialOpts), wantNumOpts)
}
if opts.UniverseDomain != universeDomain {
t.Fatalf("got: %q, want: %q", opts.UniverseDomain, universeDomain)
}
return nil, nil
}
defer func() {
Expand All @@ -67,9 +71,17 @@ func TestDialPoolNewAuthDialOptions(t *testing.T) {
},
wantNumOpts: 1,
},
{
name: "universe domain",
ds: &internal.DialSettings{
UniverseDomain: "example.com",
},
wantNumOpts: 0,
},
} {
t.Run(testcase.name, func(t *testing.T) {
wantNumOpts = testcase.wantNumOpts
universeDomain = testcase.ds.UniverseDomain
dialPoolNewAuth(context.Background(), false, 1, testcase.ds)
})
}
Expand Down
1 change: 1 addition & 0 deletions transport/http/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func newClientNewAuth(ctx context.Context, base http.RoundTripper, ds *internal.
DefaultScopes: ds.DefaultScopes,
SkipValidation: skipValidation,
},
UniverseDomain: ds.UniverseDomain,
quartzmo marked this conversation as resolved.
Show resolved Hide resolved
})
if err != nil {
return nil, err
Expand Down