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

Address name format validation on Escalation Policies #712

Conversation

imjaroiswebdev
Copy link
Contributor

Close #699

Address name format validation on Escalation Policies, following the next pattern "Name can't be blank neither contain '\', '/', '&', '<', '>', nor non-printable characters.", to match API field validation during plan.

Additionally refactor name format validation for Service into a reusable util, which is being used and tested for EP and Service.

New tests cases introduced...

$ make testacc TESTARGS="-run TestAccPagerDutyEscalationPolicy_FormatValidation"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccPagerDutyEscalationPolicy_FormatValidation -timeout 120m
?       github.com/terraform-providers/terraform-provider-pagerduty     [no test files]
=== RUN   TestAccPagerDutyEscalationPolicy_FormatValidation
--- PASS: TestAccPagerDutyEscalationPolicy_FormatValidation (0.39s)
PASS
ok      github.com/terraform-providers/terraform-provider-pagerduty/pagerduty   1.365s

$ make testacc TESTARGS="-run TestAccPagerDutyService_FormatValidation"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccPagerDutyService_FormatValidation -timeout 120m
?       github.com/terraform-providers/terraform-provider-pagerduty     [no test files]
=== RUN   TestAccPagerDutyService_FormatValidation
--- PASS: TestAccPagerDutyService_FormatValidation (0.39s)
PASS
ok      github.com/terraform-providers/terraform-provider-pagerduty/pagerduty   0.976s

Addiontally refactor name format validation for Service into a reusable util, which is being used and tested for EP and Service
@imjaroiswebdev imjaroiswebdev merged commit 30c5e09 into PagerDuty:master Jul 12, 2023
1 check passed
@drastawi
Copy link
Contributor

drastawi commented Aug 1, 2023

@imjaroiswebdev the other use case I saw frequently is the whitespace at the end of a resource name.

@imjaroiswebdev imjaroiswebdev deleted the issue-699-ep-format-valid-rule-for-scpecial-chars branch August 21, 2023 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rules for special characters consistent with the API
2 participants