Skip to content

Commit

Permalink
ENG-6845: Remove unnecessary PreCheck from Terraform Provider Tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorGFM authored Oct 21, 2021
1 parent 51e86df commit 742d383
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 44 deletions.
67 changes: 47 additions & 20 deletions cyral/data_source_cyral_saml_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,36 @@ package cyral

import (
"fmt"
"os"
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

const (
EnvVarSAMLMetadataURL = "CYRAL_TF_SAML_METADATA_URL"
Base64Doc = "PG1kOkVudGl0eURlc2NyaXB0b3IgeG1sbnM6bWQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDptZXRhZGF0YSIgZW50aXR5SUQ9Imh0dHA6Ly93d3cub2t0YS5jb20vZXhrMXNhZm84a3JFQXA4aTA1ZDciPgo8bWQ6SURQU1NPRGVzY3JpcHRvciBXYW50QXV0aG5SZXF1ZXN0c1NpZ25lZD0iZmFsc2UiIHByb3RvY29sU3VwcG9ydEVudW1lcmF0aW9uPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiPgo8bWQ6S2V5RGVzY3JpcHRvciB1c2U9InNpZ25pbmciPgo8ZHM6S2V5SW5mbyB4bWxuczpkcz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyI+CjxkczpYNTA5RGF0YT4KPGRzOlg1MDlDZXJ0aWZpY2F0ZT5NSUlEcURDQ0FwQ2dBd0lCQWdJR0FYcWJuaktnTUEwR0NTcUdTSWIzRFFFQkN3VUFNSUdVTVFzd0NRWURWUVFHRXdKVlV6RVRNQkVHIEExVUVDQXdLUTJGc2FXWnZjbTVwWVRFV01CUUdBMVVFQnd3TlUyRnVJRVp5WVc1amFYTmpiekVOTUFzR0ExVUVDZ3dFVDJ0MFlURVUgTUJJR0ExVUVD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Glvbj0iaHR0cHM6Ly9kZXYtNjEyNjU3Mjcub2t0YS5jb20vYXBwL2Rldi02MTI2NTcyN190ZXN0XzEvZXhrMXNhZm84a3JFQXA4aTA1ZDcvc3NvL3NhbWwiLz4KPC9tZDpJRFBTU09EZXNjcmlwdG9yPgo8L21kOkVudGl0eURlc2NyaXB0b3I+"
)

func TestAccSAMLConfigurationDataSource(t *testing.T) {
resource.Test(t, resource.TestCase{
ProviderFactories: providerFactories,
PreCheck: func() {
if v := os.Getenv(EnvVarSAMLMetadataURL); v == "" {
t.Skip(fmt.Sprintf(
"Acceptance tests skipped unless env '%s' set", EnvVarSAMLMetadataURL))
}
},
Steps: []resource.TestStep{
{
Config: testAccSAMLConfigurationConfig_EmptyMetadata(),
ExpectError: regexp.MustCompile(`Error: Invalid combination of arguments`),
},
{
Config: testAccSAMLConfigurationConfig_BothMetadataType(Base64Doc),
Config: testAccSAMLConfigurationConfig_BothMetadataType(),
ExpectError: regexp.MustCompile(`Error: Invalid combination of arguments`),
},
{
Config: testAccSAMLConfigurationConfig_MetadataURL(),
Check: testAccSAMLConfigurationCheck_MetadataURL(),
},
{
Config: testAccSAMLConfigurationConfig_MetadataBase64Doc(Base64Doc),
Check: testAccSAMLConfigurationCheck_MetadataBase64Doc(Base64Doc),
Config: testAccSAMLConfigurationConfig_MetadataBase64Doc(),
Check: testAccSAMLConfigurationCheck_MetadataBase64Doc(),
},
},
})
Expand All @@ -51,41 +44,75 @@ func testAccSAMLConfigurationConfig_EmptyMetadata() string {
`
}

func testAccSAMLConfigurationConfig_BothMetadataType(base64Doc string) string {
func testAccSAMLConfigurationConfig_BothMetadataType() string {
return fmt.Sprintf(`
data "cyral_saml_configuration" "test_saml_configuration" {
saml_metadata_url = "%s"
base_64_saml_metadata_document = "%s"
}
`, os.Getenv(EnvVarSAMLMetadataURL), base64Doc)
`, TestMetadataURL, Base64Doc)
}

func testAccSAMLConfigurationConfig_MetadataURL() string {
return fmt.Sprintf(`
data "cyral_saml_configuration" "test_saml_configuration" {
saml_metadata_url = "%s"
}
`, os.Getenv(EnvVarSAMLMetadataURL))
`, TestMetadataURL)
}

func testAccSAMLConfigurationCheck_MetadataURL() resource.TestCheckFunc {
return resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.cyral_saml_configuration.test_saml_configuration",
"saml_metadata_url", os.Getenv(EnvVarSAMLMetadataURL)),
"saml_metadata_url", TestMetadataURL),
resource.TestCheckNoResourceAttr("data.cyral_saml_configuration.test_saml_configuration",
"base_64_saml_metadata_document"),
)
}

func testAccSAMLConfigurationConfig_MetadataBase64Doc(base64Doc string) string {
func testAccSAMLConfigurationConfig_MetadataBase64Doc() string {
return fmt.Sprintf(`
data "cyral_saml_configuration" "test_saml_configuration" {
base_64_saml_metadata_document = "%s"
}
`, base64Doc)
`, Base64Doc)
}

func testAccSAMLConfigurationCheck_MetadataBase64Doc(base64Doc string) resource.TestCheckFunc {
func testAccSAMLConfigurationCheck_MetadataBase64Doc() resource.TestCheckFunc {
return resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.cyral_saml_configuration.test_saml_configuration",
"base_64_saml_metadata_document", base64Doc),
"base_64_saml_metadata_document", Base64Doc),
resource.TestCheckNoResourceAttr("data.cyral_saml_configuration.test_saml_configuration",
"samlMetadataURL"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"disable_using_jwks_url"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"name_id_policy_format"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"hide_on_login_page"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"back_channel_supported"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"disable_post_binding_response"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"disable_post_binding_authn_request"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"disable_post_binding_logout"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"disable_want_authn_requests_signed"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"disable_want_assertions_signed"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"want_assertions_encrypted"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"disable_force_authentication"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"disable_validate_signature"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"single_sign_on_service_url"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"signing_certificate"),
resource.TestCheckResourceAttrSet("data.cyral_saml_configuration.test_saml_configuration",
"allowed_clock_skew"),
)
}
41 changes: 17 additions & 24 deletions cyral/resource_cyral_integration_sso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,20 @@ package cyral

import (
"fmt"
"os"
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

const (
EnvVarSSOURL = "CYRAL_TF_SSO_URL"
TestSingleSignOnURL = "https://some-test-sso-url.com"
)

func TestAccSSOIntegrationResource(t *testing.T) {
samlDisplayName := "tf-test-saml-integration"
resource.Test(t, resource.TestCase{
ProviderFactories: providerFactories,
PreCheck: func() {
if v := os.Getenv(EnvVarSSOURL); v == "" {
t.Skip(fmt.Sprintf(
"Acceptance tests skipped unless env '%s' set", EnvVarSSOURL))
}
},
Steps: []resource.TestStep{
{
Config: testAccSSOIntegrationConfig_EmptySamlp(),
Expand Down Expand Up @@ -109,13 +102,13 @@ func testAccSSOIntegrationConfig_ADFS_DefaultValues() string {
}
}
}
`, os.Getenv(EnvVarSSOURL))
`, TestSingleSignOnURL)
}

func testAccSSOIntegrationCheck_ADFS_DefaultValues() resource.TestCheckFunc {
return resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("cyral_integration_sso_adfs.test_saml_integration",
"samlp.0.config.0.single_sign_on_service_url", os.Getenv(EnvVarSSOURL)),
"samlp.0.config.0.single_sign_on_service_url", TestSingleSignOnURL),
)
}

Expand All @@ -128,13 +121,13 @@ func testAccSSOIntegrationConfig_AAD_DefaultValues() string {
}
}
}
`, os.Getenv(EnvVarSSOURL))
`, TestSingleSignOnURL)
}

func testAccSSOIntegrationCheck_AAD_DefaultValues() resource.TestCheckFunc {
return resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("cyral_integration_sso_aad.test_saml_integration",
"samlp.0.config.0.single_sign_on_service_url", os.Getenv(EnvVarSSOURL)),
"samlp.0.config.0.single_sign_on_service_url", TestSingleSignOnURL),
)
}

Expand All @@ -147,13 +140,13 @@ func testAccSSOIntegrationConfig_Forgerock_DefaultValues() string {
}
}
}
`, os.Getenv(EnvVarSSOURL))
`, TestSingleSignOnURL)
}

func testAccSSOIntegrationCheck_Forgerock_DefaultValues() resource.TestCheckFunc {
return resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("cyral_integration_sso_forgerock.test_saml_integration",
"samlp.0.config.0.single_sign_on_service_url", os.Getenv(EnvVarSSOURL)),
"samlp.0.config.0.single_sign_on_service_url", TestSingleSignOnURL),
)
}

Expand All @@ -166,13 +159,13 @@ func testAccSSOIntegrationConfig_GSuite_DefaultValues() string {
}
}
}
`, os.Getenv(EnvVarSSOURL))
`, TestSingleSignOnURL)
}

func testAccSSOIntegrationCheck_GSuite_DefaultValues() resource.TestCheckFunc {
return resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("cyral_integration_sso_gsuite.test_saml_integration",
"samlp.0.config.0.single_sign_on_service_url", os.Getenv(EnvVarSSOURL)),
"samlp.0.config.0.single_sign_on_service_url", TestSingleSignOnURL),
)
}

Expand All @@ -185,13 +178,13 @@ func testAccSSOIntegrationConfig_PingOne_DefaultValues() string {
}
}
}
`, os.Getenv(EnvVarSSOURL))
`, TestSingleSignOnURL)
}

func testAccSSOIntegrationCheck_PingOne_DefaultValues() resource.TestCheckFunc {
return resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("cyral_integration_sso_ping_one.test_saml_integration",
"samlp.0.config.0.single_sign_on_service_url", os.Getenv(EnvVarSSOURL)),
"samlp.0.config.0.single_sign_on_service_url", TestSingleSignOnURL),
)
}

Expand All @@ -204,13 +197,13 @@ func testAccSSOIntegrationConfig_Okta_DefaultValues() string {
}
}
}
`, os.Getenv(EnvVarSSOURL))
`, TestSingleSignOnURL)
}

func testAccSSOIntegrationCheck_Okta_DefaultValues() resource.TestCheckFunc {
return resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("cyral_integration_sso_okta.test_saml_integration",
"samlp.0.config.0.single_sign_on_service_url", os.Getenv(EnvVarSSOURL)),
"samlp.0.config.0.single_sign_on_service_url", TestSingleSignOnURL),
)
}

Expand All @@ -226,7 +219,7 @@ func testAccSSOIntegrationConfig_Updated(samlDisplayName string) string {
}
}
}
`, samlDisplayName, os.Getenv(EnvVarSSOURL))
`, samlDisplayName, TestSingleSignOnURL)
}

func testAccSSOIntegrationCheck_Updated(samlDisplayName string) resource.TestCheckFunc {
Expand All @@ -236,7 +229,7 @@ func testAccSSOIntegrationCheck_Updated(samlDisplayName string) resource.TestChe
resource.TestCheckResourceAttr("cyral_integration_sso_okta.test_saml_integration",
"samlp.0.disabled", "true"),
resource.TestCheckResourceAttr("cyral_integration_sso_okta.test_saml_integration",
"samlp.0.config.0.single_sign_on_service_url", os.Getenv(EnvVarSSOURL)),
"samlp.0.config.0.single_sign_on_service_url", TestSingleSignOnURL),
resource.TestCheckResourceAttr("cyral_integration_sso_okta.test_saml_integration",
"samlp.0.config.0.back_channel_supported", "true"),
)
Expand All @@ -252,7 +245,7 @@ func testAccSSOIntegrationConfig_NotEmptyAlias() string {
}
}
}
`, os.Getenv(EnvVarSSOURL))
`, TestSingleSignOnURL)
}

func testAccSSOIntegrationCheck_NotEmptyAlias() resource.TestCheckFunc {
Expand All @@ -263,6 +256,6 @@ func testAccSSOIntegrationCheck_NotEmptyAlias() resource.TestCheckFunc {
"cyral_integration_sso_okta.test_saml_integration", "id",
"cyral_integration_sso_okta.test_saml_integration", "draft_alias"),
resource.TestCheckResourceAttr("cyral_integration_sso_okta.test_saml_integration",
"samlp.0.config.0.single_sign_on_service_url", os.Getenv(EnvVarSSOURL)),
"samlp.0.config.0.single_sign_on_service_url", TestSingleSignOnURL),
)
}

0 comments on commit 742d383

Please sign in to comment.