Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation to sql server name #323

Merged
merged 5 commits into from
Sep 12, 2017
Merged

Add validation to sql server name #323

merged 5 commits into from
Sep 12, 2017

Conversation

mbfrahry
Copy link
Member

This PR adds validation to sql server name. From #314

make testacc TEST=./azurerm TESTARGS="-run=TestAccAzureRMSqlServer_upperCaseName"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./azurerm -v -run=TestAccAzureRMSqlServer_upperCaseName -timeout 120m
=== RUN   TestAccAzureRMSqlServer_upperCaseName
--- PASS: TestAccAzureRMSqlServer_upperCaseName (0.02s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	0.034s

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we update the acceptance test for this to be a unit test with multiple examples?

Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateAzureRmSQLDBAccountName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given this is validating the server name, would this make more sense asvalidateSQLServerName?

@@ -74,6 +75,23 @@ func TestAccAzureRMSqlServer_basic(t *testing.T) {
})
}

func TestAccAzureRMSqlServer_upperCaseName(t *testing.T) {
ri := acctest.RandInt()
config := testAccAzureRMSqlServer_upperCaseName(ri, testLocation())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whilst this works, could we swap this out for some unit tests with both valid and invalid examples?, ala this?

@mbfrahry
Copy link
Member Author

make testacc TEST=./azurerm TESTARGS="-run=TestDBAccountName_validation"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./azurerm -v -run=TestDBAccountName_validation -timeout 120m
=== RUN   TestDBAccountName_validation
--- PASS: TestDBAccountName_validation (0.00s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	0.017s```

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor nit - otherwise LGTM :)


if len(errors) != tc.ErrCount {
t.Fatalf("Expected the AzureRM SQL Server Name to trigger a validation error for '%s'", tc.Value)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this secondary validation function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do!

@mbfrahry mbfrahry merged commit 36fd0ca into master Sep 12, 2017
@mbfrahry mbfrahry deleted the b-sql-server branch September 12, 2017 20:24
@ghost
Copy link

ghost commented Apr 1, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants