@@ -2,14 +2,11 @@ package eks
22
33import (
44 "context"
5- "net/http"
6- "net/url"
75 "testing"
86
97 ekstypes "github.com/aws/aws-sdk-go-v2/service/eks/types"
8+ "github.com/aws/aws-sdk-go-v2/service/sts"
109 "github.com/aws/aws-sdk-go/aws"
11- "github.com/aws/aws-sdk-go/aws/request"
12- "github.com/aws/aws-sdk-go/service/sts"
1310 "github.com/golang/mock/gomock"
1411 . "github.com/onsi/gomega"
1512 corev1 "k8s.io/api/core/v1"
@@ -21,7 +18,7 @@ import (
2118 infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
2219 ekscontrolplanev1 "sigs.k8s.io/cluster-api-provider-aws/v2/controlplane/eks/api/v1beta2"
2320 "sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/scope"
24- "sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/sts /mock_stsiface"
21+ "sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/s3 /mock_stsiface"
2522 clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2623 "sigs.k8s.io/cluster-api/util/secret"
2724)
@@ -42,20 +39,7 @@ func Test_createCAPIKubeconfigSecret(t *testing.T) {
4239 serviceFunc : func () * Service {
4340 mockCtrl := gomock .NewController (t )
4441 stsMock := mock_stsiface .NewMockSTSAPI (mockCtrl )
45- op := request.Request {
46- Operation : & request.Operation {Name : "GetCallerIdentity" ,
47- HTTPMethod : "POST" ,
48- HTTPPath : "/" ,
49- },
50- HTTPRequest : & http.Request {
51- Header : make (http.Header ),
52- URL : & url.URL {
53- Scheme : "https" ,
54- Host : "F00BA4.gr4.us-east-2.eks.amazonaws.com" ,
55- },
56- },
57- }
58- stsMock .EXPECT ().GetCallerIdentityRequest (gomock .Any ()).Return (& op , & sts.GetCallerIdentityOutput {})
42+ stsMock .EXPECT ().GetCallerIdentity (gomock .Any (), gomock .Any (), gomock .Any ()).Return (& sts.GetCallerIdentityOutput {}, nil )
5943
6044 scheme := runtime .NewScheme ()
6145 _ = infrav1 .AddToScheme (scheme )
@@ -151,20 +135,7 @@ func Test_updateCAPIKubeconfigSecret(t *testing.T) {
151135 serviceFunc : func (tc testCase ) * Service {
152136 mockCtrl := gomock .NewController (t )
153137 stsMock := mock_stsiface .NewMockSTSAPI (mockCtrl )
154- op := request.Request {
155- Operation : & request.Operation {Name : "GetCallerIdentity" ,
156- HTTPMethod : "POST" ,
157- HTTPPath : "/" ,
158- },
159- HTTPRequest : & http.Request {
160- Header : make (http.Header ),
161- URL : & url.URL {
162- Scheme : "https" ,
163- Host : "F00BA4.gr4.us-east-2.eks.amazonaws.com" ,
164- },
165- },
166- }
167- stsMock .EXPECT ().GetCallerIdentityRequest (gomock .Any ()).Return (& op , & sts.GetCallerIdentityOutput {})
138+ stsMock .EXPECT ().GetCallerIdentity (gomock .Any (), gomock .Any (), gomock .Any ()).Return (& sts.GetCallerIdentityOutput {}, nil )
168139
169140 scheme := runtime .NewScheme ()
170141 _ = infrav1 .AddToScheme (scheme )
0 commit comments