Skip to content

Commit d68a2bc

Browse files
committed
fix: update test cases and error messages for better clarity
Signed-off-by: Ayush <ayushshyamkumar888@gmail.com>
1 parent ee52ee1 commit d68a2bc

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

controllers/configuration/convert_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func TestRawExtension2Map2(t *testing.T) {
9696
},
9797
},
9898
want: want{
99-
errMessage: "invalid character 'x' looking for beginning of value",
99+
errMessage: "cannot convert RawExtension with unrecognized content type to unstructured",
100100
},
101101
}}
102102
for name, tc := range cases {

controllers/configuration_controller_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func TestConfigurationReconcile(t *testing.T) {
172172
Name: "a",
173173
Namespace: "b",
174174
DeletionTimestamp: &time,
175+
Finalizers: []string{configurationFinalizer},
175176
},
176177
Spec: v1beta2.ConfigurationSpec{
177178
HCL: "c",

controllers/provider/credentials_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"testing"
88

99
. "github.com/agiledragon/gomonkey/v2"
10-
"github.com/aliyun/alibaba-cloud-sdk-go/services/sts"
1110
"github.com/google/go-cmp/cmp"
1211
"github.com/jinzhu/copier"
1312
"github.com/stretchr/testify/assert"
@@ -109,10 +108,8 @@ func TestGetProviderCredentials(t *testing.T) {
109108
}
110109
assert.Nil(t, k8sClient1.Create(ctx, secret))
111110

112-
patches := ApplyMethod(reflect.TypeOf(&sts.Client{}), "GetCallerIdentity", func(_ *sts.Client, request *sts.GetCallerIdentityRequest) (response *sts.GetCallerIdentityResponse, err error) {
113-
response = nil
114-
err = nil
115-
return
111+
patches := ApplyFunc(checkAlibabaCloudCredentials, func(region, accessKeyID, accessKeySecret, stsToken string) error {
112+
return nil
116113
})
117114
defer patches.Reset()
118115

controllers/terraform/logging_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func TestGetPodLog(t *testing.T) {
8989
initContainerName: "terraform-init",
9090
},
9191
want: want{
92-
errMsg: "can not be accept",
92+
errMsg: "client rate limiter Wait returned an error: can not be accept",
9393
},
9494
},
9595
}

0 commit comments

Comments
 (0)