Skip to content

Commit

Permalink
Fix terraform tests that were failing in the E2E tests report (#454)
Browse files Browse the repository at this point in the history
* Fix repository_conf_auth tests

* Fix integration_logging tests
  • Loading branch information
VictorGFM authored Sep 21, 2023
1 parent 53c5640 commit 0a1434d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cyral/resource_cyral_integration_logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func setupLogsTest(integrationData LoggingIntegration) (string, resource.TestChe
},
),
resource.TestCheckResourceAttr(
integrationELKResourceName,
integrationLogsFullTerraformResourceName,
"fluent_bit.0.skip_validate",
fmt.Sprint(integrationData.FluentBit.SkipValidate),
),
Expand Down
19 changes: 11 additions & 8 deletions cyral/resource_cyral_repository_conf_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ const (
defaultClientTLS = "disable"
defaultRepoTLS = "disable"

defaultAuthType = "ACCESS_TOKEN"
accessTokenAuthType = "ACCESS_TOKEN"
awsIAMAuthType = "AWS_IAM"
defaultAuthType = accessTokenAuthType
)

var authTypes = []string{
accessTokenAuthType,
awsIAMAuthType,
}

type RepositoryConfAuthData struct {
RepoID *string `json:"-"`
AllowNativeAuth bool `json:"allowNativeAuth"`
Expand Down Expand Up @@ -176,11 +183,6 @@ func DeleteConfAuthConfig() ResourceOperationConfig {
}
}

var authTypes = []string{
"ACCESS_TOKEN",
"AWS_IAM",
}

func repositoryConfAuthResourceSchemaV0() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -217,8 +219,9 @@ func repositoryConfAuthResourceSchemaV0() *schema.Resource {
Default: defaultRepoTLS,
},
"auth_type": {
Description: "Authentication type for this repository. List of supported types: " +
supportedTypesMarkdown(authTypes),
Description: fmt.Sprintf("Authentication type for this repository. **Note**: `%s` is currently "+
"only supported by `%s` repo type. List of supported values: %s",
awsIAMAuthType, MongoDB, supportedTypesMarkdown(authTypes)),
Type: schema.TypeString,
Optional: true,
Default: defaultAuthType,
Expand Down
11 changes: 5 additions & 6 deletions cyral/resource_cyral_repository_conf_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ func repositoryConfAuthDependencyConfig() string {
return formatBasicRepositoryIntoConfig(
basicRepositoryResName,
accTestName(repositoryConfAuthResourceName, "repository"),
"mysql",
"http://mysql.local/",
3306,
"mongodb",
"http://mongodb.local/",
27017,
)
}

Expand All @@ -28,6 +28,7 @@ func initialRepositoryConfAuthConfig() RepositoryConfAuthData {
AllowNativeAuth: false,
ClientTLS: "disable",
RepoTLS: "enable",
AuthType: "ACCESS_TOKEN",
}
}

Expand Down Expand Up @@ -67,14 +68,14 @@ func repositoryConfAuthMinimalConfigTest(resName string) resource.TestStep {
RepositoryConfAuthData{
ClientTLS: defaultClientTLS,
RepoTLS: defaultRepoTLS,
AuthType: defaultAuthType,
},
),
}
}

func TestAccRepositoryConfAuthResource(t *testing.T) {
testMinimal := repositoryConfAuthMinimalConfigTest("main_test")

mainTest := setupRepositoryConfAuthTest("main_test", initialRepositoryConfAuthConfig())
mainTestUpdate1 := setupRepositoryConfAuthTest("main_test", update1RepositoryConfAuthConfig())
mainTestUpdate2 := setupRepositoryConfAuthTest("main_test", update2RepositoryConfAuthConfig())
Expand All @@ -83,11 +84,9 @@ func TestAccRepositoryConfAuthResource(t *testing.T) {
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
testMinimal,

mainTest,
mainTestUpdate1,
mainTestUpdate2,

{
ImportState: true,
ImportStateVerify: true,
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/repository_conf_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resource "cyral_repository_conf_auth" "some_resource_name" {
### Optional

- `allow_native_auth` (Boolean) Should the communication allow native authentication?
- `auth_type` (String) Authentication type for this repository. List of supported types:
- `auth_type` (String) Authentication type for this repository. **Note**: `AWS_IAM` is currently only supported by `mongodb` repo type. List of supported values:
- `ACCESS_TOKEN`
- `AWS_IAM`
- `client_tls` (String) Is the repo Client using TLS? Default is "disable".
Expand Down

0 comments on commit 0a1434d

Please sign in to comment.