Skip to content

Commit

Permalink
Add SLB PayByBandwidth test case
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhu36 committed Aug 23, 2018
1 parent b9a75b2 commit ae5186e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ FEATURES:

IMPROVEMENTS:

- Add SLB PayByBandwidth test case ([#625](https://github.com/alibaba/terraform-provider/pull/625))
- Improve snat entry test case ([#624](https://github.com/alibaba/terraform-provider/pull/624))
- Allow empty list of SLBs as arg to ESG ([#621](https://github.com/alibaba/terraform-provider/pull/621))
- Improve docs vroute_entry ([#619](https://github.com/alibaba/terraform-provider/pull/619))
Expand Down
1 change: 0 additions & 1 deletion alicloud/resource_alicloud_slb_attachment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func TestAccAlicloudSlbAttachment_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckSlbDestroy,
Steps: []resource.TestStep{
//test internet_charge_type is paybybandwidth
resource.TestStep{
Config: testAccSlbAttachment,
Check: resource.ComposeTestCheckFunc(
Expand Down
2 changes: 1 addition & 1 deletion alicloud/resource_alicloud_slb_listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ resource "alicloud_slb_listener" "tcp" {
const testAccSlbListenerUdp = `
resource "alicloud_slb" "instance" {
name = "tf_test_slb_udp"
internet_charge_type = "PayByBandwidth"
internet_charge_type = "PayByTraffic"
internet = true
bandwidth = 20
}
Expand Down
41 changes: 41 additions & 0 deletions alicloud/resource_alicloud_slb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,34 @@ import (
"github.com/hashicorp/terraform/terraform"
)

//test internet_charge_type is PayByBandwidth and it only support China mainland region
func TestAccAlicloudSlb_paybybandwidth(t *testing.T) {
var slb slb.DescribeLoadBalancerAttributeResponse

resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
},

// module name
IDRefreshName: "alicloud_slb.bandwidth",
Providers: testAccProviders,
CheckDestroy: testAccCheckSlbDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccSlbPayByBandwidth,
Check: resource.ComposeTestCheckFunc(
testAccCheckSlbExists("alicloud_slb.bandwidth", &slb),
resource.TestCheckResourceAttr(
"alicloud_slb.bandwidth", "name", "tf_test_slb_paybybandwidth"),
resource.TestCheckResourceAttr(
"alicloud_slb.bandwidth", "internet_charge_type", "PayByBandwidth"),
),
},
},
})
}

func TestAccAlicloudSlb_vpc(t *testing.T) {
var slb slb.DescribeLoadBalancerAttributeResponse

Expand Down Expand Up @@ -113,6 +141,19 @@ func testAccCheckSlbDestroy(s *terraform.State) error {
return nil
}

const testAccSlbPayByBandwidth = `
provider "alicloud" {
region = "cn-hangzhou"
}
resource "alicloud_slb" "bandwidth" {
name = "tf_test_slb_paybybandwidth"
specification = "slb.s2.medium"
internet_charge_type = "PayByBandwidth"
internet = true
}
`

const testAccSlb4Vpc = `
data "alicloud_zones" "default" {
"available_resource_creation"= "VSwitch"
Expand Down

0 comments on commit ae5186e

Please sign in to comment.