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

Support all DX connection speeds #6057

Merged
merged 1 commit into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion aws/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,15 @@ func validateCognitoUserPoolDomain(v interface{}, k string) (ws []string, errors
}

func validateDxConnectionBandWidth() schema.SchemaValidateFunc {
return validation.StringInSlice([]string{"1Gbps", "10Gbps"}, false)
return validation.StringInSlice([]string{
"1Gbps",
"10Gbps",
"50Mbps",
"100Mbps",
"200Mbps",
"300Mbps",
"400Mbps",
"500Mbps"}, false)
}

func validateKmsKey(v interface{}, k string) (ws []string, errors []error) {
Expand Down
35 changes: 35 additions & 0 deletions aws/validators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2979,3 +2979,38 @@ func TestValidateCloudFrontPublicKeyNamePrefix(t *testing.T) {
}
}
}

func TestValidateDxConnectionBandWidth(t *testing.T) {
validBandwidths := []string{
"1Gbps",
"10Gbps",
"50Mbps",
"100Mbps",
"200Mbps",
"300Mbps",
"400Mbps",
"500Mbps",
}
for _, v := range validBandwidths {
_, errors := validateDxConnectionBandWidth()(v, "bandwidth")
if len(errors) != 0 {
t.Fatalf("%q should be a valid bandwidth: %q", v, errors)
}
}

invalidBandwidths := []string{
"1Tbps",
"100Gbps",
"10GBpS",
"42Mbps",
"0",
"???",
"a lot",
}
for _, v := range invalidBandwidths {
_, errors := validateDxConnectionBandWidth()(v, "bandwidth")
if len(errors) == 0 {
t.Fatalf("%q should be an invalid bandwidth", v)
}
}
}