-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add sweeper for some test case * Improve sweep test
- Loading branch information
Showing
93 changed files
with
2,571 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package alicloud | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
"github.com/denverdino/aliyungo/common" | ||
"github.com/hashicorp/terraform/helper/resource" | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
resource.TestMain(m) | ||
} | ||
|
||
// sharedClientForRegion returns a common AWSClient setup needed for the sweeper | ||
// functions for a given region | ||
func sharedClientForRegion(region string) (interface{}, error) { | ||
var accessKey, secretKey string | ||
if accessKey = os.Getenv("ALICLOUD_ACCESS_KEY"); accessKey == "" { | ||
return nil, fmt.Errorf("empty ALICLOUD_ACCESS_KEY") | ||
} | ||
|
||
if secretKey = os.Getenv("ALICLOUD_SECRET_KEY"); secretKey == "" { | ||
return nil, fmt.Errorf("empty ALICLOUD_SECRET_KEY") | ||
} | ||
|
||
conf := Config{ | ||
Region: common.Region(region), | ||
RegionId: region, | ||
AccessKey: accessKey, | ||
SecretKey: secretKey, | ||
} | ||
if accountId := os.Getenv("ALICLOUD_ACCOUNT_ID"); accountId != "" { | ||
conf.AccountId = accountId | ||
} | ||
|
||
// configures a default client for the region, using the above env vars | ||
client, err := conf.Client() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return client, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ func TestAccAlicloudRamUsersDataSource_for_group(t *testing.T) { | |
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckAlicloudDataSourceID("data.alicloud_ram_users.user"), | ||
resource.TestCheckResourceAttr("data.alicloud_ram_users.user", "users.#", "1"), | ||
resource.TestCheckResourceAttr("data.alicloud_ram_users.user", "users.0.name", "testAccCheckAlicloudRamUsersDataSourceForGroupConfig"), | ||
resource.TestCheckResourceAttr("data.alicloud_ram_users.user", "users.0.name", "tf-testAccCheckAlicloudRamUsersDataSourceForGroupConfig"), | ||
), | ||
}, | ||
}, | ||
|
@@ -37,7 +37,7 @@ func TestAccAlicloudRamUsersDataSource_for_policy(t *testing.T) { | |
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckAlicloudDataSourceID("data.alicloud_ram_users.user"), | ||
resource.TestCheckResourceAttr("data.alicloud_ram_users.user", "users.#", "1"), | ||
resource.TestCheckResourceAttr("data.alicloud_ram_users.user", "users.0.name", "testAccCheckAlicloudRamUsersDataSourceForPolicyConfig"), | ||
resource.TestCheckResourceAttr("data.alicloud_ram_users.user", "users.0.name", "tf-testAccCheckAlicloudRamUsersDataSourceForPolicyConfig"), | ||
), | ||
}, | ||
}, | ||
|
@@ -81,7 +81,7 @@ func TestAccAlicloudRamUsersDataSource_user_name_regex(t *testing.T) { | |
|
||
const testAccCheckAlicloudRamUsersDataSourceForGroupConfig = ` | ||
variable "name" { | ||
default = "testAccCheckAlicloudRamUsersDataSourceForGroupConfig" | ||
default = "tf-testAccCheckAlicloudRamUsersDataSourceForGroupConfig" | ||
} | ||
resource "alicloud_ram_user" "user" { | ||
name = "${var.name}" | ||
|
@@ -107,7 +107,7 @@ data "alicloud_ram_users" "user" { | |
|
||
const testAccCheckAlicloudRamUsersDataSourceForPolicyConfig = ` | ||
variable "name" { | ||
default = "testAccCheckAlicloudRamUsersDataSourceForPolicyConfig" | ||
default = "tf-testAccCheckAlicloudRamUsersDataSourceForPolicyConfig" | ||
} | ||
resource "alicloud_ram_policy" "policy" { | ||
name = "${var.name}" | ||
|
@@ -150,7 +150,7 @@ data "alicloud_ram_users" "user" { | |
|
||
const testAccCheckAlicloudRamGroupsDataSourceUserNameRegexConfig = ` | ||
resource "alicloud_ram_user" "user" { | ||
name = "testAccCheckAlicloudRamGroupsDataSourceUserNameRegexConfig" | ||
name = "tf-testAccCheckAlicloudRamGroupsDataSourceUserNameRegexConfig" | ||
display_name = "displayname" | ||
mobile = "86-18888888888" | ||
email = "[email protected]" | ||
|
Oops, something went wrong.