Skip to content

Commit 564783c

Browse files
committed
refactor(gcp): rename FetchInstanceWithService → FetchInstanceWithClient for cross-cloud consistency
AWS and Azure modules already use the *WithClient* naming for their injected-client variants. Keep GCP's public surface consistent even though the underlying type is called *compute.Service upstream.
1 parent 9215649 commit 564783c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

modules/gcp/compute.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ func FetchInstanceContextE(t testing.TestingT, ctx context.Context, projectID st
9191
return nil, err
9292
}
9393

94-
return FetchInstanceWithServiceContextE(t, ctx, service, projectID, name)
94+
return FetchInstanceWithClientContextE(t, ctx, service, projectID, name)
9595
}
9696

97-
// FetchInstanceWithServiceContextE queries GCP to return an instance of the Compute Instance type
97+
// FetchInstanceWithClientContextE queries GCP to return an instance of the Compute Instance type
9898
// using the supplied *compute.Service. Prefer this variant in unit tests where the service is
9999
// backed by an httptest fake server (see compute_unit_test.go for the pattern).
100100
// The ctx parameter supports cancellation and timeouts.
101-
func FetchInstanceWithServiceContextE(t testing.TestingT, ctx context.Context, service *compute.Service, projectID string, name string) (*Instance, error) {
101+
func FetchInstanceWithClientContextE(t testing.TestingT, ctx context.Context, service *compute.Service, projectID string, name string) (*Instance, error) {
102102
logger.Default.Logf(t, "Getting Compute Instance %s", name)
103103

104104
// If we want to fetch an Instance without knowing its Zone, we have to query GCP for all Instances in the project

modules/gcp/compute_unit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func TestGetPublicIPContextE(t *testing.T) {
107107
}
108108
}
109109

110-
func TestFetchInstanceWithServiceContextE(t *testing.T) {
110+
func TestFetchInstanceWithClientContextE(t *testing.T) {
111111
t.Parallel()
112112

113113
const projectID = "my-project"
@@ -141,7 +141,7 @@ func TestFetchInstanceWithServiceContextE(t *testing.T) {
141141

142142
svc := newFakeComputeService(t, handler)
143143

144-
instance, err := gcp.FetchInstanceWithServiceContextE(t, context.Background(), svc, projectID, tc.target)
144+
instance, err := gcp.FetchInstanceWithClientContextE(t, context.Background(), svc, projectID, tc.target)
145145
if tc.wantErrMsg != "" {
146146
require.Error(t, err)
147147
assert.Contains(t, err.Error(), tc.wantErrMsg)

0 commit comments

Comments
 (0)