Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testcase: Change vpc and vswitch creation to read #4387

Merged
merged 1 commit into from
Jan 7, 2022

Conversation

thisnihonglei
Copy link
Contributor

No description provided.

@@ -293,7 +293,7 @@ func resourceAliyunVpnGatewayDelete(d *schema.ResourceData, meta interface{}) er
})

if err != nil {
if IsExpectedErrors(err, []string{"InvalidVpnGatewayInstanceId.NotFound"}) {
if IsExpectedErrors(err, []string{"InvalidVpnGatewayInstanceId.NotFound", "ForbiddenRelease"}) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改为预付费后,删除资源时抛出errcode:ForbiddenRelease,所以在这里做预知错误处理

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ForbiddenRelease 是代表这个资源已经不存在了么

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是,报错信息是:Forbidden to release a prepaid instance within validity period,有效期内无法删除实例

bandwidth = "10"
enable_ssl = true
instance_charge_type = "PostPaid"
instance_charge_type = "PrePaid"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里修改这个字段为预付费的原因是查看了当前资源的文档以及去控制台手动创建测试,发现这个资源现在只支持预付费类型.

@@ -124,7 +124,7 @@ func TestAccAlicloudSslVpnClientCert_basic(t *testing.T) {
// module name
IDRefreshName: resourceId,
Providers: testAccProviders,
CheckDestroy: testAccCheckSslVpnClientCertDestroy,
CheckDestroy: nil,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个case是只有国际站的账号才能创建,你是怎么测试的

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果你的账号可以测试成功,那么这个case就不受账号类型的限制了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已去掉

@@ -293,7 +293,7 @@ func resourceAliyunVpnGatewayDelete(d *schema.ResourceData, meta interface{}) er
})

if err != nil {
if IsExpectedErrors(err, []string{"InvalidVpnGatewayInstanceId.NotFound"}) {
if IsExpectedErrors(err, []string{"InvalidVpnGatewayInstanceId.NotFound", "ForbiddenRelease"}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ForbiddenRelease 是代表这个资源已经不存在了么


return WrapError(vpnGatewayService.WaitForVpnGateway(d.Id(), Deleted, DefaultTimeoutMedium))
log.Printf("[WARN] Cannot destroy resource Alicloud Resource VPN Gateway. Terraform will remove this resource from the state file, however resources may remain.")
return nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对于预付费的要改成这种,对于后付费的,还是应该保留原有的逻辑

@@ -15,6 +15,8 @@ Provides a VPN gateway resource.

-> Currently International-Site account can open `PostPaid` VPN gateway and China-Site account can open `PrePaid` VPN gateway.

-> **NOTE:** The resource Cannot destroy. Terraform will remove this resource from the state file, however resources may remain.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要说清楚,只有是预付费的时候才不能删除,

@@ -15,6 +15,8 @@ Provides a VPN gateway resource.

-> Currently International-Site account can open `PostPaid` VPN gateway and China-Site account can open `PrePaid` VPN gateway.

-> **NOTE:** If the resource is `PerPaid` type the resource Cannot destroy. Terraform will remove this resource from the state file, however resources may remain.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> NOTE: PrePaid VPN gateway cannot be destroyed and provider will remove it from the state file.

@@ -124,7 +124,7 @@ func TestAccAlicloudSslVpnClientCert_basic(t *testing.T) {
// module name
IDRefreshName: resourceId,
Providers: testAccProviders,
CheckDestroy: testAccCheckSslVpnClientCertDestroy,
CheckDestroy: nil,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果你的账号可以测试成功,那么这个case就不受账号类型的限制了

@thisnihonglei thisnihonglei force-pushed the changecreatetoread branch 3 times, most recently from 57d8e04 to 111c765 Compare December 28, 2021 05:42
@@ -12,7 +12,7 @@ func TestAccAlicloudVpnGatewaysDataSourceBasic(t *testing.T) {
rand := acctest.RandIntRange(1000, 9999)
preCheck := func() {
testAccPreCheck(t)
testAccPreCheckWithAccountSiteType(t, IntlSite)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后付费的case还是应该保留

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已改

@@ -15,6 +15,8 @@ Provides a VPN gateway resource.

-> Currently International-Site account can open `PostPaid` VPN gateway and China-Site account can open `PrePaid` VPN gateway.

-> **NOTE:** `PrePaid` VPN gateway cannot be destroyed and provider will remove it from the state file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个描述跟 nat gateway 的那个保持一致

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已改

@xiaozhu36 xiaozhu36 merged commit 7fab6e5 into aliyun:master Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants