-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #752 from imjaroiswebdev/TFPROVDEV-77-update-serv-…
…name-validation [TFPROVDEV-77] Update name validation logic for technical services
- Loading branch information
Showing
5 changed files
with
73 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,7 +113,7 @@ func TestAccPagerDutyEscalationPolicy_Basic(t *testing.T) { | |
func TestAccPagerDutyEscalationPolicy_FormatValidation(t *testing.T) { | ||
username := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
email := fmt.Sprintf("%[email protected]", username) | ||
errMessageMatcher := "Name must not be blank, nor contain the characters.*, or any non-printable characters. White spaces at the end are also not allowed." | ||
errMessageMatcher := "Name can not be blank, nor contain the characters.*, or any non-printable characters. Trailing white spaces are not allowed either." | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
|
@@ -150,6 +150,12 @@ func TestAccPagerDutyEscalationPolicy_FormatValidation(t *testing.T) { | |
PlanOnly: true, | ||
ExpectError: regexp.MustCompile(errMessageMatcher), | ||
}, | ||
// Name with non printable characters | ||
{ | ||
Config: testAccCheckPagerDutyEscalationPolicyConfig(username, email, "this name has a non printable\\n character"), | ||
PlanOnly: true, | ||
ExpectError: regexp.MustCompile(errMessageMatcher), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,7 +134,7 @@ func TestAccPagerDutyService_FormatValidation(t *testing.T) { | |
username := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
email := fmt.Sprintf("%[email protected]", username) | ||
escalationPolicy := fmt.Sprintf("tf-%s", acctest.RandString(5)) | ||
errMessageMatcher := "Name must not be blank, nor contain the characters.*, or any non-printable characters. White spaces at the end are also not allowed." | ||
errMessageMatcher := "Name can not be blank, nor contain non-printable characters. Trailing white spaces are not allowed either." | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
|
@@ -153,12 +153,6 @@ func TestAccPagerDutyService_FormatValidation(t *testing.T) { | |
PlanOnly: true, | ||
ExpectError: regexp.MustCompile(errMessageMatcher), | ||
}, | ||
// Name with & in it | ||
{ | ||
Config: testAccCheckPagerDutyServiceConfig(username, email, escalationPolicy, "this name has an ampersand (&)"), | ||
PlanOnly: true, | ||
ExpectError: regexp.MustCompile(errMessageMatcher), | ||
}, | ||
// Name with one white space at the end | ||
{ | ||
Config: testAccCheckPagerDutyServiceConfig(username, email, escalationPolicy, "this name has a white space at the end "), | ||
|
@@ -171,6 +165,12 @@ func TestAccPagerDutyService_FormatValidation(t *testing.T) { | |
PlanOnly: true, | ||
ExpectError: regexp.MustCompile(errMessageMatcher), | ||
}, | ||
// Name with non printable characters | ||
{ | ||
Config: testAccCheckPagerDutyServiceConfig(username, email, escalationPolicy, "this name has a non printable\\n character"), | ||
PlanOnly: true, | ||
ExpectError: regexp.MustCompile(errMessageMatcher), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters