Skip to content

Commit 6ff885a

Browse files
authored
fix: cos,cfs,mongo testcases (#1064)
1 parent 7754575 commit 6ff885a

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

tencentcloud/resource_tc_cfs_access_rule_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestAccTencentCloudCfsAccessRule(t *testing.T) {
2020
Config: testAccCfsAccessRule,
2121
Check: resource.ComposeTestCheckFunc(
2222
testAccCheckCfsAccessRuleExists("tencentcloud_cfs_access_rule.foo"),
23-
resource.TestCheckResourceAttr("tencentcloud_cfs_access_rule.foo", "auth_client_ip", "10.10.1.0/24"),
23+
resource.TestCheckResourceAttr("tencentcloud_cfs_access_rule.foo", "auth_client_ip", "10.11.1.0/24"),
2424
resource.TestCheckResourceAttr("tencentcloud_cfs_access_rule.foo", "priority", "1"),
2525
resource.TestCheckResourceAttrSet("tencentcloud_cfs_access_rule.foo", "access_group_id"),
2626
),
@@ -101,7 +101,7 @@ const testAccCfsAccessRule = defaultCfsAccessGroup + `
101101
102102
resource "tencentcloud_cfs_access_rule" "foo" {
103103
access_group_id = local.cfs_access_group_id
104-
auth_client_ip = "10.10.1.0/24"
104+
auth_client_ip = "10.11.1.0/24"
105105
priority = 1
106106
}
107107
`

tencentcloud/resource_tc_cos_bucket_object_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ resource "tencentcloud_cos_bucket_object" "object_storage" {
250250
func testAccCosBucketObject_acl(appid, acl string) string {
251251
return fmt.Sprintf(`
252252
resource "tencentcloud_cos_bucket" "object_bucket" {
253-
bucket = "tf-bucket-acl-%s"
253+
bucket = "tf-bucket-obj-acl-%s"
254254
}
255255
256256
resource "tencentcloud_cos_bucket_object" "object_acl" {

tencentcloud/resource_tc_mongodb_instance.go

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ package tencentcloud
3030

3131
import (
3232
"context"
33-
"errors"
3433
"fmt"
3534
"log"
3635
"reflect"
@@ -291,10 +290,12 @@ func resourceTencentCloudMongodbInstanceRead(d *schema.ResourceData, meta interf
291290

292291
logId := getLogId(contextNil)
293292
ctx := context.WithValue(context.TODO(), logIdKey, logId)
293+
client := meta.(*TencentCloudClient).apiV3Conn
294294

295295
instanceId := d.Id()
296296

297-
mongodbService := MongodbService{client: meta.(*TencentCloudClient).apiV3Conn}
297+
mongodbService := MongodbService{client}
298+
tagService := TagService{client}
298299
instance, has, err := mongodbService.DescribeInstanceById(ctx, instanceId)
299300
if err != nil {
300301
return err
@@ -358,20 +359,8 @@ func resourceTencentCloudMongodbInstanceRead(d *schema.ResourceData, meta interf
358359
}
359360
_ = d.Set("standby_instance_list", standbyInsList)
360361

361-
tags := make(map[string]string, len(instance.Tags))
362-
for _, tag := range instance.Tags {
363-
if tag.TagKey == nil {
364-
return errors.New("mongodb tag key is nil")
365-
}
366-
if tag.TagValue == nil {
367-
return errors.New("mongodb tag value is nil")
368-
}
369-
if *tag.TagKey == "project" {
370-
continue
371-
}
362+
tags, err := tagService.DescribeResourceTags(ctx, "mongodb", "instance", client.Region, instanceId)
372363

373-
tags[*tag.TagKey] = *tag.TagValue
374-
}
375364
_ = d.Set("tags", tags)
376365

377366
return nil

0 commit comments

Comments
 (0)