Skip to content

Commit

Permalink
- testcase: Improve the unit of the test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
thisnihonglei committed Jan 28, 2022
1 parent bd0cdfc commit 84f0a8c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions alicloud/resource_alicloud_cr_chart_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,10 @@ func TestAccAlicloudCRChartNamespace_unit(t *testing.T) {
})
t.Run("DeleteMockAbnormal", func(t *testing.T) {
retryFlag := true
noRetryFlag := false
noRetryFlag := true
patches := gomonkey.ApplyMethod(reflect.TypeOf(&client.Client{}), "DoRequest", func(_ *client.Client, _ *string, _ *string, _ *string, _ *string, _ *string, _ map[string]interface{}, _ map[string]interface{}, _ *util.RuntimeOptions) (map[string]interface{}, error) {
if retryFlag {
// retry until the timeout comes
retryFlag = false
return responseMock["RetryError"]("Throttling")
} else if noRetryFlag {
noRetryFlag = false
Expand Down
4 changes: 2 additions & 2 deletions alicloud/resource_alicloud_cr_chart_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@ func TestAccAlicloudCRChartRepository_unit(t *testing.T) {
})
t.Run("DeleteMockAbnormal", func(t *testing.T) {
retryFlag := true
noRetryFlag := false
noRetryFlag := true
patches := gomonkey.ApplyMethod(reflect.TypeOf(&client.Client{}), "DoRequest", func(_ *client.Client, _ *string, _ *string, _ *string, _ *string, _ *string, _ map[string]interface{}, _ map[string]interface{}, _ *util.RuntimeOptions) (map[string]interface{}, error) {
if retryFlag {
// retry until the timeout comes
retryFlag = false
return responseMock["RetryError"]("Throttling")
} else if noRetryFlag {
noRetryFlag = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ func TestAccAlicloudEcsAutoSnapshotPolicyAttachment_unit(t *testing.T) {
})
t.Run("DeleteMockAbnormal", func(t *testing.T) {
retryFlag := true
noRetryFlag := false
noRetryFlag := true
patches := gomonkey.ApplyMethod(reflect.TypeOf(&client.Client{}), "DoRequest", func(_ *client.Client, _ *string, _ *string, _ *string, _ *string, _ *string, _ map[string]interface{}, _ map[string]interface{}, _ *util.RuntimeOptions) (map[string]interface{}, error) {
if retryFlag {
// retry until the timeout comes
retryFlag = false
return responseMock["RetryError"]("Throttling")
} else if noRetryFlag {
noRetryFlag = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ resource "alicloud_vpc_traffic_mirror_filter" "default" {
}

func TestAccAlicloudVPCTrafficMirrorFilterEgressRule_unit(t *testing.T) {
t.Parallel()
//t.Parallel()
p := Provider().(*schema.Provider).ResourcesMap
d, _ := schema.InternalMap(p["alicloud_vpc_traffic_mirror_filter_egress_rule"].Schema).Data(nil, nil)
dCreate, _ := schema.InternalMap(p["alicloud_vpc_traffic_mirror_filter_egress_rule"].Schema).Data(nil, nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ resource "alicloud_vpc_traffic_mirror_filter" "default" {
}

func TestAccAlicloudVPCTrafficMirrorFilterIngressRule_unit(t *testing.T) {
t.Parallel()
//t.Parallel()
p := Provider().(*schema.Provider).ResourcesMap
d, _ := schema.InternalMap(p["alicloud_vpc_traffic_mirror_filter_ingress_rule"].Schema).Data(nil, nil)
dCreate, _ := schema.InternalMap(p["alicloud_vpc_traffic_mirror_filter_ingress_rule"].Schema).Data(nil, nil)
Expand Down

0 comments on commit 84f0a8c

Please sign in to comment.