Skip to content

Commit 7582a9a

Browse files
tongyimingmikatong
andauthored
fix: eip unit test (#933)
* fix: eip unit test * fix: fmt resource_tc_vpn_ssl_client.go Co-authored-by: mikatong <mikatong@tencent.com>
1 parent 0eae51a commit 7582a9a

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

tencentcloud/resource_tc_eip_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package tencentcloud
33
import (
44
"context"
55
"fmt"
6+
"os"
67
"testing"
78

89
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
@@ -72,6 +73,10 @@ func TestAccTencentCloudEip_basic(t *testing.T) {
7273

7374
func TestAccTencentCloudEip_anycast(t *testing.T) {
7475
t.Parallel()
76+
defer func() {
77+
os.Setenv(PROVIDER_REGION, "")
78+
}()
79+
os.Setenv(PROVIDER_REGION, "ap-hongkong")
7580
resource.Test(t, resource.TestCase{
7681
PreCheck: func() { testAccPreCheck(t) },
7782
Providers: testAccProviders,
@@ -234,14 +239,14 @@ const testAccEipAnycast = `
234239
resource "tencentcloud_eip" "foo" {
235240
name = "eip_anycast"
236241
type = "AnycastEIP"
237-
anycast_zone = "ANYCAST_ZONE_GLOBAL"
242+
anycast_zone = "ANYCAST_ZONE_OVERSEAS"
238243
}
239244
`
240245

241246
const testAccEipProvider = `
242247
resource "tencentcloud_eip" "foo" {
243248
name = "eip_provider"
244-
internet_service_provider = "CMCC"
249+
internet_service_provider = "CUCC"
245250
}
246251
`
247252

tencentcloud/resource_tc_vpn_ssl_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func resourceTencentCloudVpnSslClientCreate(d *schema.ResourceData, meta interfa
125125
return fmt.Errorf("get instance list error: %s", err.Error())
126126
}
127127
if len(newIns) != 1 {
128-
return fmt.Errorf("create ssl client error")
128+
return fmt.Errorf("create ssl client error")
129129
}
130130

131131
sslClient := newIns[0]

tencentcloud/service_tencentcloud_vpc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,7 @@ func (me *VpcService) UnattachEip(ctx context.Context, eipId string) error {
21282128
}
21292129

21302130
// DisassociateAddress Doesn't support Disassociate NAT Address
2131-
if strings.HasPrefix(*eip.InstanceId, "nat-") {
2131+
if eip.InstanceId != nil && strings.HasPrefix(*eip.InstanceId, "nat-") {
21322132
request := vpc.NewDisassociateNatGatewayAddressRequest()
21332133
request.NatGatewayId = eip.InstanceId
21342134
request.PublicIpAddresses = []*string{eip.AddressIp}

0 commit comments

Comments
 (0)