-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Improved existing acceptance tests (#301)
* feat: Improved existing acceptance tests * feat: Improved integration tests
- Loading branch information
Showing
33 changed files
with
524 additions
and
253 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
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package zia | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
var edmProjectNames = []string{ | ||
"BD_EDM_TEMPLATE01", "BD_EDM_TEMPLATE02", | ||
} | ||
|
||
func TestAccDataSourceDLPEDMSchema_Basic(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckDataSourceDLPEDMSchema_basic(), | ||
Check: resource.ComposeTestCheckFunc( | ||
generateDLPEDMSchemaChecks()..., | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func generateDLPEDMSchemaChecks() []resource.TestCheckFunc { | ||
var checks []resource.TestCheckFunc | ||
for _, name := range edmProjectNames { | ||
resourceName := createValidResourceName(name) | ||
checkName := fmt.Sprintf("data.zia_dlp_edm_schema.%s", resourceName) | ||
checks = append(checks, resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet(checkName, "id"), | ||
resource.TestCheckResourceAttrSet(checkName, "project_name"), | ||
)) | ||
} | ||
return checks | ||
} | ||
|
||
func testAccCheckDataSourceDLPEDMSchema_basic() string { | ||
var configs string | ||
for _, name := range edmProjectNames { | ||
resourceName := createValidResourceName(name) | ||
configs += fmt.Sprintf(` | ||
data "zia_dlp_edm_schema" "%s" { | ||
project_name = "%s" | ||
} | ||
`, resourceName, name) | ||
} | ||
return configs | ||
} |
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,53 @@ | ||
package zia | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
var idmProfileLiteNames = []string{ | ||
"BD_IDM_TEMPLATE01", | ||
} | ||
|
||
func TestAccDataSourceDLPIDMProfileLite_Basic(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckDataSourceDLPIDMProfileLite_basic(), | ||
Check: resource.ComposeTestCheckFunc( | ||
generateDLPIDMProfileLiteChecks()..., | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func generateDLPIDMProfileLiteChecks() []resource.TestCheckFunc { | ||
var checks []resource.TestCheckFunc | ||
for _, name := range idmProfileLiteNames { | ||
resourceName := createValidResourceName(name) | ||
checkName := fmt.Sprintf("data.zia_dlp_idm_profile_lite.%s", resourceName) | ||
checks = append(checks, resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet(checkName, "id"), | ||
resource.TestCheckResourceAttrSet(checkName, "template_name"), | ||
)) | ||
} | ||
return checks | ||
} | ||
|
||
func testAccCheckDataSourceDLPIDMProfileLite_basic() string { | ||
var configs string | ||
for _, name := range idmProfileLiteNames { | ||
resourceName := createValidResourceName(name) | ||
configs += fmt.Sprintf(` | ||
data "zia_dlp_idm_profile_lite" "%s" { | ||
template_name = "%s" | ||
} | ||
`, resourceName, name) | ||
} | ||
return configs | ||
} |
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,53 @@ | ||
package zia | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
var idmProfileNames = []string{ | ||
"BD_IDM_TEMPLATE01", | ||
} | ||
|
||
func TestAccDataSourceDLPIDMProfiles_Basic(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckDataSourceDLPIDMProfiles_basic(), | ||
Check: resource.ComposeTestCheckFunc( | ||
generateDLPIDMProfilesChecks()..., | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func generateDLPIDMProfilesChecks() []resource.TestCheckFunc { | ||
var checks []resource.TestCheckFunc | ||
for _, name := range idmProfileNames { | ||
resourceName := createValidResourceName(name) | ||
checkName := fmt.Sprintf("data.zia_dlp_idm_profiles.%s", resourceName) | ||
checks = append(checks, resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet(checkName, "id"), | ||
resource.TestCheckResourceAttrSet(checkName, "profile_name"), | ||
)) | ||
} | ||
return checks | ||
} | ||
|
||
func testAccCheckDataSourceDLPIDMProfiles_basic() string { | ||
var configs string | ||
for _, name := range idmProfileNames { | ||
resourceName := createValidResourceName(name) | ||
configs += fmt.Sprintf(` | ||
data "zia_dlp_idm_profiles" "%s" { | ||
profile_name = "%s" | ||
} | ||
`, resourceName, name) | ||
} | ||
return configs | ||
} |
Oops, something went wrong.