Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ func TestAccTencentCloudPostgresqlBackupDownloadUrlsDataSource_basic(t *testing.
Providers: testAccProviders,
Steps: []resource.TestStep{
{
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
// Config: fmt.Sprintf(testAccPostgresqlBackupDownloadUrlsDataSource, startTime, endTime),
Config: testAccPostgresqlBackupDownloadUrlsDataSource,
Check: resource.ComposeTestCheckFunc(
Expand All @@ -40,7 +44,7 @@ func TestAccTencentCloudPostgresqlBackupDownloadUrlsDataSource_basic(t *testing.
})
}

const testAccPostgresqlBackupDownloadUrlsDataSource = CommonPresetPGSQL + defaultVpcSubnets + `
const testAccPostgresqlBackupDownloadUrlsDataSource = OperationPresetPGSQL + defaultVpcSubnets + `
data "tencentcloud_postgresql_log_backups" "log_backups" {
min_finish_time = ""
max_finish_time = ""
Expand All @@ -55,8 +59,8 @@ data "tencentcloud_postgresql_log_backups" "log_backups" {
data "tencentcloud_postgresql_backup_download_urls" "backup_download_urls" {
db_instance_id = local.pgsql_id
backup_type = "LogBackup"
// backup_id = data.tencentcloud_postgresql_log_backups.log_backups.log_backup_set.0.id
backup_id = "01a57d08-b7f5-584e-b64a-dc2236bb0438"
backup_id = data.tencentcloud_postgresql_log_backups.log_backups.log_backup_set.0.id
// backup_id = "01a57d08-b7f5-584e-b64a-dc2236bb0438"
url_expire_time = 12
backup_download_restriction {
restriction_type = "NONE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func TestAccTencentCloudPostgresqlBaseBackupsDataSource_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
testAccStepSetRegion(t, "ap-chengdu")
},
Providers: testAccProviders,
Steps: []resource.TestStep{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func TestAccTencentCloudPostgresqlDbInstanceClassesDataSource_basic(t *testing.T
Steps: []resource.TestStep{
{
Config: testAccPostgresqlDbInstanceClassesDataSource,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
testAccCheckTencentCloudDataSourceID("data.tencentcloud_postgresql_db_instance_classes.db_instance_classes"),
resource.TestCheckResourceAttr("data.tencentcloud_postgresql_db_instance_classes.db_instance_classes", "zone", "ap-guangzhou-7"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ func TestAccTencentCloudPostgresqlDbInstanceVersionsDataSource_basic(t *testing.
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccPostgresqlDbInstanceVersionsDataSource,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
testAccCheckTencentCloudDataSourceID("data.tencentcloud_postgresql_db_instance_versions.db_instance_versions"),
resource.TestCheckResourceAttrSet("data.tencentcloud_postgresql_db_instance_versions.db_instance_versions", "version_set.#"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ func TestAccTencentCloudPostgresqlDefaultParametersDataSource_basic(t *testing.T
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccPostgresqlDefaultParametersDataSource,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
testAccCheckTencentCloudDataSourceID("data.tencentcloud_postgresql_default_parameters.default_parameters"),
resource.TestCheckResourceAttr("data.tencentcloud_postgresql_default_parameters.default_parameters", "db_major_version", "13"),
Expand Down
9 changes: 8 additions & 1 deletion tencentcloud/data_source_tc_postgresql_instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ var testDataPostgresqlInstancesName = "data.tencentcloud_postgresql_instances.id
func TestAccTencentCloudPostgresqlInstancesDataSource(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: testAccCheckLBDestroy,
Steps: []resource.TestStep{
{
Config: testAccTencentCloudDataPostgresqlInstanceBasic,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(testDataPostgresqlInstancesName, "instance_list.#", "1"),
resource.TestCheckResourceAttrSet(testDataPostgresqlInstancesName, "instance_list.0.id"),
Expand Down
2 changes: 1 addition & 1 deletion tencentcloud/data_source_tc_postgresql_log_backups.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func dataSourceTencentCloudPostgresqlLogBackupsRead(d *schema.ResourceData, meta
}
tmpSet = append(tmpSet, &filter)
}
paramMap["filters"] = tmpSet
paramMap["Filters"] = tmpSet
}

if v, ok := d.GetOk("order_by"); ok {
Expand Down
5 changes: 5 additions & 0 deletions tencentcloud/data_source_tc_postgresql_log_backups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ func TestAccTencentCloudPostgresqlLogBackupsDataSource_basic(t *testing.T) {
endTime := time.Now().AddDate(0, 0, 1).In(loc).Format("2006-01-02 15:04:05")
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(testAccPostgresqlLogBackupsDataSource, startTime, endTime),
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
testAccCheckTencentCloudDataSourceID("data.tencentcloud_postgresql_log_backups.log_backups"),
resource.TestCheckResourceAttr("data.tencentcloud_postgresql_log_backups.log_backups", "min_finish_time", startTime),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ func TestAccTencentCloudPostgresqlParameterTemplatesDataSource_basic(t *testing.
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccPostgresqlParameterTemplatesDataSource,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
testAccCheckTencentCloudDataSourceID("data.tencentcloud_postgresql_parameter_templates.parameter_templates"),
resource.TestCheckResourceAttr("data.tencentcloud_postgresql_parameter_templates.parameter_templates", "filters.#", "2"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func TestAccTencentCloudPostgresqlReadonlyGroupsDataSource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Expand Down
5 changes: 5 additions & 0 deletions tencentcloud/data_source_tc_postgresql_recovery_time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ func TestAccTencentCloudPostgresqlRecoveryTimeDataSource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccPostgresqlRecoveryTimeDataSource,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
testAccCheckTencentCloudDataSourceID(testAccPostgresqlrecoverytimeObject),
resource.TestCheckResourceAttrSet(testAccPostgresqlrecoverytimeObject, "db_instance_id"),
Expand Down
5 changes: 5 additions & 0 deletions tencentcloud/data_source_tc_postgresql_regions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ func TestAccTencentCloudPostgresqlRegionsDataSource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccPostgresqlRegionsDataSource,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
testAccCheckTencentCloudDataSourceID("data.tencentcloud_postgresql_regions.regions"),
resource.TestCheckResourceAttrSet("data.tencentcloud_postgresql_regions.regions", "region_set.#"),
Expand Down
5 changes: 5 additions & 0 deletions tencentcloud/data_source_tc_postgresql_specinfos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ func TestAccTencentCloudPostgresqlSpecinfosDataSource(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccTencentCloudPostgresqlSpecinfosConfigBasic,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
testAccCheckTencentCloudDataSourceID("data.tencentcloud_postgresql_specinfos.foo"),
resource.TestCheckResourceAttrSet("data.tencentcloud_postgresql_specinfos.foo", "list.#"),
Expand Down
9 changes: 8 additions & 1 deletion tencentcloud/data_source_tc_postgresql_xlogs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ func TestAccTencentCloudPostgresqlXlogsDataSource(t *testing.T) {
startTime := time.Now().AddDate(0, 0, -7).Format("2006-01-02 15:04:05")
endTime := time.Now().Format("2006-01-02 15:04:05")
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccDataSourcePostgresqlXlogsBasic(startTime, endTime),
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("data.tencentcloud_postgresql_xlogs.foo", "start_time", startTime),
resource.TestCheckResourceAttr("data.tencentcloud_postgresql_xlogs.foo", "end_time", endTime),
Expand Down
5 changes: 5 additions & 0 deletions tencentcloud/data_source_tc_postgresql_zones_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ func TestAccTencentCloudPostgresqlZonesDataSource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccPostgresqlZonesDataSource,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
testAccCheckTencentCloudDataSourceID("data.tencentcloud_postgresql_zones.zones"),
resource.TestCheckResourceAttrSet("data.tencentcloud_postgresql_zones.zones", "zone_set.#"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ const TestAccPostgresqlBackupDownloadRestrictionObject = "tencentcloud_postgresq
func TestAccTencentCloudPostgresqlBackupDownloadRestrictionConfigResource_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccPostgresqlBackupDownloadRestrictionConfig_NONE,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(TestAccPostgresqlBackupDownloadRestrictionObject, "id"),
resource.TestCheckResourceAttr(TestAccPostgresqlBackupDownloadRestrictionObject, "restriction_type", "NONE"),
Expand All @@ -34,12 +39,17 @@ func TestAccTencentCloudPostgresqlBackupDownloadRestrictionConfigResource_basic(
func TestAccTencentCloudPostgresqlBackupDownloadRestrictionConfigResource_CUSTOMIZE(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccPostgresqlBackupDownloadRestrictionConfig_CUSTOMIZE_ALLOW,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(TestAccPostgresqlBackupDownloadRestrictionObject, "id"),
resource.TestCheckResourceAttr(TestAccPostgresqlBackupDownloadRestrictionObject, "restriction_type", "CUSTOMIZE"),
Expand All @@ -51,6 +61,10 @@ func TestAccTencentCloudPostgresqlBackupDownloadRestrictionConfigResource_CUSTOM
},
{
Config: testAccPostgresqlBackupDownloadRestrictionConfig_CUSTOMIZE_DENY,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(TestAccPostgresqlBackupDownloadRestrictionObject, "id"),
resource.TestCheckResourceAttr(TestAccPostgresqlBackupDownloadRestrictionObject, "restriction_type", "CUSTOMIZE"),
Expand All @@ -72,12 +86,17 @@ func TestAccTencentCloudPostgresqlBackupDownloadRestrictionConfigResource_CUSTOM
func TestAccTencentCloudPostgresqlBackupDownloadRestrictionConfigResource_INTRANET(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccPostgresqlBackupDownloadRestrictionConfig_INTRANET,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(TestAccPostgresqlBackupDownloadRestrictionObject, "id"),
resource.TestCheckResourceAttr(TestAccPostgresqlBackupDownloadRestrictionObject, "restriction_type", "INTRANET"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ func TestAccTencentCloudPostgresqlBackupPlanConfigResource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccPostgresBackupPlanConfig,
PreConfig: func() {
testAccStepSetRegion(t, "ap-guangzhou")
testAccPreCheckCommon(t, ACCOUNT_TYPE_COMMON)
},
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(testAccPostgresqlBackupPlanConfigObject, "id"),
resource.TestCheckResourceAttrSet(testAccPostgresqlBackupPlanConfigObject, "db_instance_id"),
Expand Down
1 change: 1 addition & 0 deletions tencentcloud/resource_tc_postgresql_base_backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func TestAccTencentCloudPostgresqlBaseBackupResource_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
testAccStepSetRegion(t, "ap-chengdu")
},
Providers: testAccProviders,
Steps: []resource.TestStep{
Expand Down
Loading