terraform-provider-huaweicloud
terraform-provider-huaweicloud copied to clipboard
test(lts): improve the ut coverage and using env to reduce test time
What this PR does / why we need it:
- Using environment variable
HW_LTS_HOST_ID
,HW_LTS_HOST_ANOTHER_ID
andHW_LTS_CCE_CLUSTER_ID
to reduce the test time. - Adding ignored fields to documents.
- Adjust some acceptance test scripts to improve the ut coverage.
Which issue this PR fixes:
(optional, in fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged)
fixes #xxx
Special notes for your reviewer:
Release note:
1. improve the UT coverage and using env to reduce test time.
PR Checklist
- [x] Tests added/passed.
- [x] Documentation updated.
- [ ] Schema updated.
Acceptance Steps Performed
=== RUN TestAccDataSourceAOMAccesses_basic
=== PAUSE TestAccDataSourceAOMAccesses_basic
=== RUN TestAccDatasourceCceAccesses_basic
=== PAUSE TestAccDatasourceCceAccesses_basic
=== RUN TestAccDataSourceGroups_basic
=== PAUSE TestAccDataSourceGroups_basic
=== RUN TestAccDataSourceHostGroups_basic
=== PAUSE TestAccDataSourceHostGroups_basic
=== RUN TestAccDataSourceNotificationTemplates_basic
=== PAUSE TestAccDataSourceNotificationTemplates_basic
=== RUN TestAccDataSourcSearchCriteria_basic
=== PAUSE TestAccDataSourcSearchCriteria_basic
=== RUN TestAccDataSourceStreams_basic
=== PAUSE TestAccDataSourceStreams_basic
=== RUN TestAccDatasourceCustomTemplates_basic
=== PAUSE TestAccDatasourceCustomTemplates_basic
=== RUN TestAccDatasourceTransfers_basic
=== PAUSE TestAccDatasourceTransfers_basic
=== RUN TestAccessRule_basic
=== PAUSE TestAccessRule_basic
=== RUN TestAccAOMAccess_basic
=== PAUSE TestAccAOMAccess_basic
=== RUN TestAccAOMAccess_withCCICluster
=== PAUSE TestAccAOMAccess_withCCICluster
=== RUN TestAccCceAccessConfig_containerFile
=== PAUSE TestAccCceAccessConfig_containerFile
=== RUN TestAccCceAccessConfig_containerStdout
=== PAUSE TestAccCceAccessConfig_containerStdout
=== RUN TestAccCceAccessConfig_hostFile
=== PAUSE TestAccCceAccessConfig_hostFile
=== RUN TestAccCrossAccountAccess_basic
=== PAUSE TestAccCrossAccountAccess_basic
=== RUN TestAccDashboard_basic
=== PAUSE TestAccDashboard_basic
=== RUN TestAccLtsElbComp_basic
=== PAUSE TestAccLtsElbComp_basic
=== RUN TestAccLtsGroup_basic
=== PAUSE TestAccLtsGroup_basic
=== RUN TestAccHostAccessConfig_basic
=== PAUSE TestAccHostAccessConfig_basic
=== RUN TestAccHostAccessConfig_windows
=== PAUSE TestAccHostAccessConfig_windows
=== RUN TestAccHostGroup_basic
=== PAUSE TestAccHostGroup_basic
=== RUN TestAccKeywordsAlarmRule_basic
=== PAUSE TestAccKeywordsAlarmRule_basic
=== RUN TestAccLogConvergeSwitch_basic
=== PAUSE TestAccLogConvergeSwitch_basic
=== RUN TestAccLogConverge_basic
=== PAUSE TestAccLogConverge_basic
=== RUN TestAccNotificationTemplate_basic
=== PAUSE TestAccNotificationTemplate_basic
=== RUN TestAccSearchCriteria_basic
=== PAUSE TestAccSearchCriteria_basic
=== RUN TestAccSQLAlarmRule_basic
=== PAUSE TestAccSQLAlarmRule_basic
=== RUN TestAccLtsStream_basic
=== PAUSE TestAccLtsStream_basic
=== RUN TestAccLtsStream_epsId
=== PAUSE TestAccLtsStream_epsId
=== RUN TestAccLtsStructTemplate_basic
=== PAUSE TestAccLtsStructTemplate_basic
=== RUN TestAccStructConfig_basic
=== PAUSE TestAccStructConfig_basic
=== RUN TestAccStructConfig_customTemplate
=== PAUSE TestAccStructConfig_customTemplate
=== RUN TestAccStructCustomConfig_basic
=== PAUSE TestAccStructCustomConfig_basic
=== RUN TestAccLtsTransfer_basic
=== PAUSE TestAccLtsTransfer_basic
=== RUN TestAccLtsTransfer_dis
=== PAUSE TestAccLtsTransfer_dis
=== RUN TestAccLtsTransfer_agency
=== PAUSE TestAccLtsTransfer_agency
=== RUN TestAccWAFAccess_basic
=== PAUSE TestAccWAFAccess_basic
=== RUN TestAccWAFAccess_withEpsId
=== PAUSE TestAccWAFAccess_withEpsId
=== CONT TestAccDataSourceAOMAccesses_basic
=== CONT TestAccHostAccessConfig_windows
=== CONT TestAccLtsStructTemplate_basic
=== CONT TestAccAOMAccess_basic
=== CONT TestAccHostAccessConfig_basic
=== CONT TestAccLtsStream_epsId
--- PASS: TestAccLtsStream_epsId (66.38s)
=== CONT TestAccLtsGroup_basic
--- PASS: TestAccLtsStructTemplate_basic (101.21s)
=== CONT TestAccLtsElbComp_basic
--- PASS: TestAccHostAccessConfig_windows (116.45s)
=== CONT TestAccDashboard_basic
=== CONT TestAccLtsElbComp_basic
resource_huaweicloud_lts_elb_log_test.go:48: Step 1/2 error: Error running apply: exit status 1
Error: error creating LogTank fields f93f9fe0-de75-49c7-8eaf-a490b7ed202f: Resource not found: [POST https://elb.cn-north-4.myhuaweicloud.com/v3/0970dd7a1300f5672ff2c003c60ae115/elb/logtanks], request_id: 3ed56627194831f5b0f2f57e4eaf1c87, error message: {"error_msg":"loadbalancer d2b7a742-fb38-49f2-b2d8-473a97a18434 could not be found.","error_code":"ELB.8904","request_id":"3ed56627194831f5b0f2f57e4eaf1c87"}
with huaweicloud_elb_log.elb_1,
on terraform_plugin_test.tf line 2, in resource "huaweicloud_elb_log" "elb_1":
2: resource "huaweicloud_elb_log" "elb_1" {
--- FAIL: TestAccLtsElbComp_basic (18.26s)
=== CONT TestAccCrossAccountAccess_basic
acceptance.go:1448: The delegator account config of HW_LTS_AGENCY_STREAM_NAME, HW_LTS_AGENCY_STREAM_ID, HW_LTS_AGENCY_GROUP_NAME, HW_LTS_AGENCY_GROUP_ID, HW_LTS_AGENCY_PROJECT_ID, HW_LTS_AGENCY_DOMAIN_NAME and HW_LTS_AGENCY_NAME must be set for the acceptance test
--- SKIP: TestAccCrossAccountAccess_basic (0.01s)
=== CONT TestAccCceAccessConfig_hostFile
=== CONT TestAccDashboard_basic
resource_huaweicloud_lts_dashboard_test.go:52: Step 1/2 error: Error running apply: exit status 1
Error: error creating LtsDashBoard fields 9ac33c09-7f00-4eed-b9a0-0ffaad7a64d1: Bad request with: [POST https://lts.cn-north-4.myhuaweicloud.com/v2/0970dd7a1300f5672ff2c003c60ae115/lts/template-dashboard], request_id: f5a76e157c2ad8ca6704c0c62cb5461e, error message: {"message":{"code":"LTS.0603","details":"group or stream not exist"}}
with huaweicloud_lts_dashboard.dashboard_1,
on terraform_plugin_test.tf line 2, in resource "huaweicloud_lts_dashboard" "dashboard_1":
2: resource "huaweicloud_lts_dashboard" "dashboard_1" {
--- FAIL: TestAccDashboard_basic (17.53s)
=== CONT TestAccCceAccessConfig_containerStdout
--- PASS: TestAccHostAccessConfig_basic (191.39s)
=== CONT TestAccCceAccessConfig_containerFile
--- PASS: TestAccDataSourceAOMAccesses_basic (207.59s)
=== CONT TestAccAOMAccess_withCCICluster
--- PASS: TestAccLtsGroup_basic (147.78s)
=== CONT TestAccLtsTransfer_dis
--- PASS: TestAccAOMAccess_basic (239.68s)
=== CONT TestAccWAFAccess_withEpsId
--- PASS: TestAccCceAccessConfig_hostFile (188.36s)
=== CONT TestAccWAFAccess_basic
--- PASS: TestAccCceAccessConfig_containerStdout (194.21s)
=== CONT TestAccLtsTransfer_agency
=== CONT TestAccWAFAccess_withEpsId
resource_huaweicloud_lts_waf_access_test.go:132: Step 1/2 error: Error running apply: exit status 1
Error: error creating WAF dedicated : Action forbidden: [POST https://waf.cn-north-4.myhuaweicloud.com/v1/0970dd7a1300f5672ff2c003c60ae115/premium-waf/instance?enterprise_project_id=0], request_id: d004d3239d97f3264f28b0a3bc03f979, error message: {"error_code":"WAF.00012006","error_msg":"User: iam::0970d7b7d400f2470fbec00316a03560:user:tf-user13 is not authorized to perform: waf:premiumInstance:create on resource: waf:cn-north-4:0970d7b7d400f2
...
with huaweicloud_waf_dedicated_instance.test,
on terraform_plugin_test.tf line 60, in resource "huaweicloud_waf_dedicated_instance" "test":
60: resource "huaweicloud_waf_dedicated_instance" "test" {
--- PASS: TestAccCceAccessConfig_containerFile (189.58s)
=== CONT TestAccNotificationTemplate_basic
--- PASS: TestAccAOMAccess_withCCICluster (183.93s)
=== CONT TestAccLtsStream_basic
--- FAIL: TestAccWAFAccess_withEpsId (156.06s)
=== CONT TestAccSQLAlarmRule_basic
--- PASS: TestAccLtsTransfer_dis (204.52s)
=== CONT TestAccSearchCriteria_basic
=== CONT TestAccWAFAccess_basic
resource_huaweicloud_lts_waf_access_test.go:71: Step 1/4 error: Error running apply: exit status 1
Error: error creating WAF dedicated : Action forbidden: [POST https://waf.cn-north-4.myhuaweicloud.com/v1/0970dd7a1300f5672ff2c003c60ae115/premium-waf/instance], request_id: c753cd06f4ac4e63ab737a3802de87a9, error message: {"error_code":"WAF.00012006","error_msg":"User: iam::0970d7b7d400f2470fbec00316a03560:user:tf-user13 is not authorized to perform: waf:premiumInstance:create on resource: waf:cn-north-4:0970d7b7d400f2
...
with huaweicloud_waf_dedicated_instance.test,
on terraform_plugin_test.tf line 75, in resource "huaweicloud_waf_dedicated_instance" "test":
75: resource "huaweicloud_waf_dedicated_instance" "test" {
--- PASS: TestAccNotificationTemplate_basic (102.91s)
=== CONT TestAccLogConvergeSwitch_basic
--- FAIL: TestAccWAFAccess_basic (180.03s)
=== CONT TestAccLogConverge_basic
acceptance.go:1479: The cce access config of HW_LTS_LOG_CONVERGE_ORGANIZATION_ID, HW_LTS_LOG_CONVERGE_MANAGEMENT_ACCOUNT_ID, HW_LTS_LOG_CONVERGE_MEMBER_ACCOUNT_ID must be set for the log converge configuration acceptance test
--- SKIP: TestAccLogConverge_basic (0.06s)
=== CONT TestAccKeywordsAlarmRule_basic
=== CONT TestAccLogConvergeSwitch_basic
resource_huaweicloud_lts_log_converge_switch_test.go:31: Step 1/1 error: Error running apply: exit status 1
Error: failed to enable log receiving status (target: true): Bad request with: [PUT https://lts.cn-north-4.myhuaweicloud.com/v1/0970dd7a1300f5672ff2c003c60ae115/lts/log-converge-config/switch?log_converge_switch=true], request_id: f6d331005d69c5a00ed5cb14b6a16b96, error message: {"error_code":"LTS.2503","error_msg":"The LTS service is not trusted."}
with huaweicloud_lts_log_converge_switch.test,
on terraform_plugin_test.tf line 2, in resource "huaweicloud_lts_log_converge_switch" "test":
2: resource "huaweicloud_lts_log_converge_switch" "test" {}
--- FAIL: TestAccLogConvergeSwitch_basic (20.94s)
=== CONT TestAccHostGroup_basic
--- PASS: TestAccLtsStream_basic (127.95s)
=== CONT TestAccDataSourcSearchCriteria_basic
--- PASS: TestAccSearchCriteria_basic (108.81s)
=== CONT TestAccessRule_basic
resource_huaweicloud_lts_access_rule_test.go:50: Step 1/2 error: Error running apply: exit status 1
Error: error creating AomMappingRule cui-rule-1: Bad request with: [POST https://lts.cn-north-4.myhuaweicloud.com/v2/0970dd7a1300f5672ff2c003c60ae115/lts/aom-mapping?isBatch=false], request_id: e8762eccd1bb76a2d437eb160853e259, error message: {"message":{"code":"LTS.0742","details":"AOM mapping rule log group id does not exsit"}}
with huaweicloud_lts_access_rule.accessrule_1,
on terraform_plugin_test.tf line 2, in resource "huaweicloud_lts_access_rule" "accessrule_1":
2: resource "huaweicloud_lts_access_rule" "accessrule_1" {
--- FAIL: TestAccessRule_basic (23.65s)
=== CONT TestAccDatasourceTransfers_basic
--- PASS: TestAccDataSourcSearchCriteria_basic (133.78s)
=== CONT TestAccDatasourceCustomTemplates_basic
--- PASS: TestAccHostGroup_basic (171.68s)
=== CONT TestAccDataSourceStreams_basic
--- PASS: TestAccSQLAlarmRule_basic (324.90s)
=== CONT TestAccDataSourceHostGroups_basic
--- PASS: TestAccLtsTransfer_agency (399.98s)
=== CONT TestAccDataSourceNotificationTemplates_basic
--- PASS: TestAccDatasourceTransfers_basic (189.57s)
=== CONT TestAccDataSourceGroups_basic
--- PASS: TestAccDatasourceCustomTemplates_basic (135.87s)
=== CONT TestAccStructCustomConfig_basic
--- PASS: TestAccDataSourceNotificationTemplates_basic (71.43s)
=== CONT TestAccLtsTransfer_basic
--- PASS: TestAccDataSourceGroups_basic (83.93s)
=== CONT TestAccStructConfig_customTemplate
--- PASS: TestAccKeywordsAlarmRule_basic (339.51s)
=== CONT TestAccStructConfig_basic
--- PASS: TestAccDataSourceHostGroups_basic (160.35s)
=== CONT TestAccDatasourceCceAccesses_basic
--- PASS: TestAccDataSourceStreams_basic (243.60s)
--- PASS: TestAccStructConfig_customTemplate (158.91s)
--- PASS: TestAccStructConfig_basic (161.57s)
--- PASS: TestAccLtsTransfer_basic (199.60s)
--- PASS: TestAccDatasourceCceAccesses_basic (152.21s)
--- PASS: TestAccStructCustomConfig_basic (268.51s)