-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Conversation
There was a problem hiding this 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?
azurerm/resource_arm_sql_server.go
Outdated
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: validateAzureRmSQLDBAccountName, |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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?
|
There was a problem hiding this 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 :)
azurerm/validators_test.go
Outdated
|
||
if len(errors) != tc.ErrCount { | ||
t.Fatalf("Expected the AzureRM SQL Server Name to trigger a validation error for '%s'", tc.Value) | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do!
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! |
This PR adds validation to sql server name. From #314