From e997a8056c9cfea02a4bc956b22d9f9db2d3f1d9 Mon Sep 17 00:00:00 2001 From: Lourens de Jager <165963988+lourens-octopus@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:57:56 +1300 Subject: [PATCH] test --- .../resource_git_trigger_test.go | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/octopusdeploy_framework/resource_git_trigger_test.go b/octopusdeploy_framework/resource_git_trigger_test.go index d0b8658c..1fd2211e 100644 --- a/octopusdeploy_framework/resource_git_trigger_test.go +++ b/octopusdeploy_framework/resource_git_trigger_test.go @@ -174,7 +174,7 @@ func testAssertGitTriggerAttributes(expected gitTriggerTestData, prefix string) resource.TestCheckResourceAttr(prefix, "project_id", expected.projectId), resource.TestCheckResourceAttr(prefix, "channel_id", expected.channelId), resource.TestCheckResourceAttr(prefix, "is_disabled", strconv.FormatBool(expected.isDisabled)), - resource.TestCheckResourceAttr(prefix, "sources", convertGitTriggerSourcesToString(expected.sources)), + resource.TestCheckResourceAttr(prefix, "sources.[0]", convertGitTriggerSourceToString(expected.sources[0])), ) } @@ -212,6 +212,25 @@ func convertGitTriggerSourcesToString(sources []gitTriggerSourcesTestData) strin return result } +func convertGitTriggerSourceToString(source gitTriggerSourcesTestData) string { + var result string + + result += fmt.Sprintf(` + { + deployment_action_slug = "%s" + git_dependency_name = "%s" + include_file_paths = [%s] + exclude_file_paths = [%s] + }`, + source.deploymentActionSlug, + source.gitDependencyName, + convertStringSliceToString(source.includeFilePaths), + convertStringSliceToString(source.excludeFilePaths), + ) + + return result +} + func convertStringSliceToString(slice []string) string { return fmt.Sprintf(`"%s"`, strings.Join(slice, `", "`)) }