Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
lourens-octopus committed Dec 5, 2024
1 parent de5bb07 commit e997a80
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion octopusdeploy_framework/resource_git_trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])),
)
}

Expand Down Expand Up @@ -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, `", "`))
}

0 comments on commit e997a80

Please sign in to comment.