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

pagerduty_incident_workflow_trigger remove value check on conditional and update tests #964

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ghmj2417
Copy link

@ghmj2417 ghmj2417 commented Jan 8, 2025

Fixes #961 and #924

Tested the following resources with a terraform plan and apply
condition key's value set to ""

resource "pagerduty_incident_workflow_trigger" "stakeholders_conditional" {
  type                       = "conditional"
  workflow                   = pagerduty_incident_workflow.notify_stakeholders.id
  services                   = [pagerduty_service.high_urgency.id]
  subscribed_to_all_services = false
  condition                  = ""
}

condition key missing

resource "pagerduty_incident_workflow_trigger" "stakeholders_conditional" {
  type                       = "conditional"
  workflow                   = pagerduty_incident_workflow.notify_stakeholders.id
  services                   = [pagerduty_service.high_urgency.id]
  subscribed_to_all_services = false
}

Test run:
Failures are my user's lack of permissions
Important tests:

  • TestAccPagerDutyIncidentWorkflowTrigger_BasicConditionalAllServices
  • TestAccPagerDutyIncidentWorkflowTrigger_ChangeTypeCausesReplace
  • TestAccPagerDutyIncidentWorkflowTrigger_CannotChangeType

PAGERDUTY_ACC_INCIDENT_WORKFLOWS=1 make testacc TESTARGS="-run PagerDutyIncidentWorkflow"

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run PagerDutyIncidentWorkflow -timeout 120m
?       github.com/PagerDuty/terraform-provider-pagerduty       [no test files]
?       github.com/PagerDuty/terraform-provider-pagerduty/util/apiutil  [no test files]
=== RUN   TestAccDataSourcePagerDutyIncidentWorkflow
--- PASS: TestAccDataSourcePagerDutyIncidentWorkflow (5.66s)
=== RUN   TestAccDataSourcePagerDutyIncidentWorkflow_Missing
--- PASS: TestAccDataSourcePagerDutyIncidentWorkflow_Missing (2.40s)
=== RUN   TestAccPagerDutyIncidentWorkflow_import
--- PASS: TestAccPagerDutyIncidentWorkflow_import (5.18s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_import
    import_pagerduty_incident_workflow_trigger_test.go:18: Step 1/2 error: Error running apply: exit status 1

        Error: POST API call to https://api.pagerduty.com/users failed 403 Forbidden. Code: 2010, Errors: <nil>, Message: Access Denied

          with pagerduty_user.foo,
          on terraform_plugin_test.tf line 13, in resource "pagerduty_user" "foo":
          13: resource "pagerduty_user" "foo" {

--- FAIL: TestAccPagerDutyIncidentWorkflowTrigger_import (3.40s)
=== RUN   TestAccPagerDutyIncidentWorkflow_Basic
--- PASS: TestAccPagerDutyIncidentWorkflow_Basic (7.56s)
=== RUN   TestAccPagerDutyIncidentWorkflow_Team
--- PASS: TestAccPagerDutyIncidentWorkflow_Team (9.41s)
=== RUN   TestAccPagerDutyIncidentWorkflow_InlineInputs
    resource_pagerduty_incident_workflow_test.go:123: Step 1/2 error: Error running apply: exit status 1

        Error: POST API call to https://api.pagerduty.com/incident_workflows failed 404 Not Found. Code: 0, Errors: <nil>, Message:

          with pagerduty_incident_workflow.test,
          on terraform_plugin_test.tf line 12, in resource "pagerduty_incident_workflow" "test":
          12: resource "pagerduty_incident_workflow" "test" {

--- FAIL: TestAccPagerDutyIncidentWorkflow_InlineInputs (2.43s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_BadType
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_BadType (1.64s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_ConditionWithManualType
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_ConditionWithManualType (1.71s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_SubscribedToAllWithInvalidServices
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_SubscribedToAllWithInvalidServices (1.72s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_BasicManual
    resource_pagerduty_incident_workflow_trigger_test.go:137: Step 1/1 error: Error running apply: exit status 1

        Error: POST API call to https://api.pagerduty.com/users failed 403 Forbidden. Code: 2010, Errors: <nil>, Message: Access Denied

          with pagerduty_user.foo,
          on terraform_plugin_test.tf line 13, in resource "pagerduty_user" "foo":
          13: resource "pagerduty_user" "foo" {

--- FAIL: TestAccPagerDutyIncidentWorkflowTrigger_BasicManual (3.25s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_BasicConditionalAllServices
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_BasicConditionalAllServices (11.84s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_ManualWithTeamPermissions
    resource_pagerduty_incident_workflow_trigger_test.go:230: Step 1/5 error: Error running apply: exit status 1

        Error: POST API call to https://api.pagerduty.com/users failed 403 Forbidden. Code: 2010, Errors: <nil>, Message: Access Denied

          with pagerduty_user.foo,
          on terraform_plugin_test.tf line 13, in resource "pagerduty_user" "foo":
          13: resource "pagerduty_user" "foo" {

--- FAIL: TestAccPagerDutyIncidentWorkflowTrigger_ManualWithTeamPermissions (6.14s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_ChangeTypeCausesReplace
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_ChangeTypeCausesReplace (9.04s)
=== RUN   TestAccPagerDutyIncidentWorkflowTrigger_CannotChangeType
--- PASS: TestAccPagerDutyIncidentWorkflowTrigger_CannotChangeType (8.34s)
FAIL
FAIL    github.com/PagerDuty/terraform-provider-pagerduty/pagerduty     79.726s
testing: warning: no tests to run
PASS
ok      github.com/PagerDuty/terraform-provider-pagerduty/pagerdutyplugin       (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/PagerDuty/terraform-provider-pagerduty/util  (cached) [no tests to run]
FAIL
make: *** [GNUmakefile:16: testacc] Error 1

@ghmj2417
Copy link
Author

How do I get this reviewed?

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.

pagerduty_incident_workflow_trigger should not require condition value when type is conditional
1 participant