From c714e08973ea046eca1ba3ba5741ee46e8ceddf0 Mon Sep 17 00:00:00 2001 From: Meet Rathod Date: Thu, 15 Jun 2023 12:37:20 +0530 Subject: [PATCH] Fix trigger tests (#582) * Fix trigger tests * Update docs * Update docs * Update docs --- docs/resources/platform_triggers.md | 35 ++++++++--------- .../harness_platform_triggers/resource.tf | 35 ++++++++--------- .../triggers/data_source_triggers_test.go | 38 +++++++++---------- .../triggers/resource_triggers_test.go | 38 +++++++++---------- 4 files changed, 74 insertions(+), 72 deletions(-) diff --git a/docs/resources/platform_triggers.md b/docs/resources/platform_triggers.md index 40aa938a9..97fb91758 100644 --- a/docs/resources/platform_triggers.md +++ b/docs/resources/platform_triggers.md @@ -26,34 +26,35 @@ resource "harness_platform_triggers" "example" { target_id = "pipelineIdentifier" yaml = <<-EOT trigger: - name: "name" - identifier: "identifier" + name: name + identifier: identifier enabled: true description: "" tags: {} - projectIdentifier: "projectIdentifier" - orgIdentifier: "orgIdentifer" - pipelineIdentifier: "pipelineIdentifier" + projectIdentifier: projectIdentifier + orgIdentifier: orgIdentifer + pipelineIdentifier: pipelineIdentifier source: - type: "Webhook" + type: Webhook spec: - type: "Github" + type: Github spec: - type: "Push" + type: Push spec: - connectorRef: "account.TestAccResourceConnectorGithub_Ssh_IZBeG" + connectorRef: account.TestAccResourceConnectorGithub_Ssh_IZBeG autoAbortPreviousExecutions: false payloadConditions: - - key: "changedFiles" - operator: "Equals" - value: "value" - - key: "targetBranch" - operator: "Equals" - value: "value" + - key: changedFiles + operator: Equals + value: value + - key: targetBranch + operator: Equals + value: value headerConditions: [] - repoName: "repoName" + repoName: repoName actions: [] - inputYaml: "pipeline: {}\n" + inputYaml: | + pipeline: {}\n EOT } ``` diff --git a/examples/resources/harness_platform_triggers/resource.tf b/examples/resources/harness_platform_triggers/resource.tf index 954da7c4d..107e60e88 100644 --- a/examples/resources/harness_platform_triggers/resource.tf +++ b/examples/resources/harness_platform_triggers/resource.tf @@ -6,33 +6,34 @@ resource "harness_platform_triggers" "example" { target_id = "pipelineIdentifier" yaml = <<-EOT trigger: - name: "name" - identifier: "identifier" + name: name + identifier: identifier enabled: true description: "" tags: {} - projectIdentifier: "projectIdentifier" - orgIdentifier: "orgIdentifer" - pipelineIdentifier: "pipelineIdentifier" + projectIdentifier: projectIdentifier + orgIdentifier: orgIdentifer + pipelineIdentifier: pipelineIdentifier source: - type: "Webhook" + type: Webhook spec: - type: "Github" + type: Github spec: - type: "Push" + type: Push spec: - connectorRef: "account.TestAccResourceConnectorGithub_Ssh_IZBeG" + connectorRef: account.TestAccResourceConnectorGithub_Ssh_IZBeG autoAbortPreviousExecutions: false payloadConditions: - - key: "changedFiles" - operator: "Equals" - value: "value" - - key: "targetBranch" - operator: "Equals" - value: "value" + - key: changedFiles + operator: Equals + value: value + - key: targetBranch + operator: Equals + value: value headerConditions: [] - repoName: "repoName" + repoName: repoName actions: [] - inputYaml: "pipeline: {}\n" + inputYaml: | + pipeline: {}\n EOT } diff --git a/internal/service/platform/triggers/data_source_triggers_test.go b/internal/service/platform/triggers/data_source_triggers_test.go index 29825fa98..209d35860 100644 --- a/internal/service/platform/triggers/data_source_triggers_test.go +++ b/internal/service/platform/triggers/data_source_triggers_test.go @@ -92,37 +92,37 @@ EOT name = "%[2]s" target_id = harness_platform_pipeline.pipeline.id yaml = <<-EOT - --- trigger: - name: "%[2]s" - identifier: "%[1]s" + name: %[2]s + identifier: %[1]s enabled: true description: "" tags: {} - projectIdentifier: "${harness_platform_project.test.id}" - orgIdentifier: "${harness_platform_project.test.org_id}" - pipelineIdentifier: "${harness_platform_pipeline.pipeline.id}" + projectIdentifier: ${harness_platform_project.test.id} + orgIdentifier: ${harness_platform_project.test.org_id} + pipelineIdentifier: ${harness_platform_pipeline.pipeline.id} source: - type: "Webhook" - pollInterval: "0" + type: Webhook + pollInterval: 0 spec: - type: "Github" + type: Github spec: - type: "Push" + type: Push spec: - connectorRef: "account.Jajoo" + connectorRef: account.Jajoo autoAbortPreviousExecutions: false payloadConditions: - - key: "changedFiles" - operator: "Equals" - value: "fjjfjfjf" - - key: "targetBranch" - operator: "Equals" - value: "fhfhfh" + - key: changedFiles + operator: Equals + value: fjjfjfjf + - key: targetBranch + operator: Equals + value: fhfhfh headerConditions: [] - repoName: "gfgfgf" + repoName: gfgfgf actions: [] - inputYaml: "pipeline: {}\n" + inputYaml: | + pipeline: {}\n EOT } diff --git a/internal/service/platform/triggers/resource_triggers_test.go b/internal/service/platform/triggers/resource_triggers_test.go index bd20ca576..041c2451c 100644 --- a/internal/service/platform/triggers/resource_triggers_test.go +++ b/internal/service/platform/triggers/resource_triggers_test.go @@ -181,37 +181,37 @@ EOT name = "%[2]s" target_id = harness_platform_pipeline.pipeline.id yaml = <<-EOT - --- trigger: - name: "%[2]s" - identifier: "%[1]s" + name: %[2]s + identifier: %[1]s enabled: true description: "" tags: {} - projectIdentifier: "${harness_platform_project.test.id}" - orgIdentifier: "${harness_platform_project.test.org_id}" - pipelineIdentifier: "${harness_platform_pipeline.pipeline.id}" + projectIdentifier: ${harness_platform_project.test.id} + orgIdentifier: ${harness_platform_project.test.org_id} + pipelineIdentifier: ${harness_platform_pipeline.pipeline.id} source: - type: "Webhook" - pollInterval: "0" + type: Webhook + pollInterval: 0 spec: - type: "Github" + type: Github spec: - type: "Push" + type: Push spec: - connectorRef: "account.Jajoo" + connectorRef: account.Jajoo autoAbortPreviousExecutions: false payloadConditions: - - key: "changedFiles" - operator: "Equals" - value: "fjjfjfjf" - - key: "targetBranch" - operator: "Equals" - value: "fhfhfh" + - key: changedFiles + operator: Equals + value: fjjfjfjf + - key: targetBranch + operator: Equals + value: fhfhfh headerConditions: [] - repoName: "gfgfgf" + repoName: gfgfgf actions: [] - inputYaml: "pipeline: {}\n" + inputYaml: | + pipeline: {}\n EOT } `, id, name)