Skip to content

Commit

Permalink
split up macro/list creation into different steps
Browse files Browse the repository at this point in the history
  • Loading branch information
kmvachhani committed Nov 15, 2024
1 parent 205e6c5 commit 90a4a84
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions sysdig/resource_sysdig_secure_macro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,19 @@ func TestAccMacro(t *testing.T) {
Config: macroAppendToDefault(),
},
{
Config: macroWithMacro(rText(), rText()),
Config: macroWithMacroPart1(rText()),

Check failure on line 46 in sysdig/resource_sysdig_secure_macro_test.go

View workflow job for this annotation

GitHub Actions / Test / Sysdig Secure Acceptance Tests

not enough arguments in call to macroWithMacroPart1
},
{
Config: macroWithMacroAndList(rText(), rText(), rText()),
Config: macroWithMacroPart2(rText()),
},
{
Config: listWithName(rText()),
},
{
Config: macroWithMacroAndListPart1(rText()),
},
{
Config: macroWithMacroAndListPart2(rText()),
},
{
Config: macroWithMinimumEngineVersion(rText()),
Expand Down Expand Up @@ -83,34 +92,43 @@ resource "sysdig_secure_macro" "sample2" {
`
}

func macroWithMacro(name1, name2 string) string {
func macroWithMacroPart1(name1, name2 string) string {
return fmt.Sprintf(`
resource "sysdig_secure_macro" "sample3" {
name = "terraform_test_%s"
condition = "always_true"
}
`, name1)
}

func macroWithMacroPart2(name2 string) string {
return fmt.Sprintf(`
resource "sysdig_secure_macro" "sample4" {
name = "terraform_test_%s"
condition = "never_true and ${sysdig_secure_macro.sample3.name}"
}
`, name1, name2)
`, name2)
}

func macroWithMacroAndList(name1, name2, name3 string) string {
func macroWithMacroAndListPart1(name1 string) string {
return fmt.Sprintf(`
%s
resource "sysdig_secure_macro" "sample5" {
name = "terraform_test_%s"
condition = "fd.name in (${sysdig_secure_list.sample.name})"
}
`, name1)
}

func macroWithMacroAndListPart2(name1 string) string {
return fmt.Sprintf(`
resource "sysdig_secure_macro" "sample6" {
name = "terraform_test_%s"
condition = "never_true and ${sysdig_secure_macro.sample5.name}"
}
`, listWithName(name3), name1, name2)
`, name1)
}

func macroWithMinimumEngineVersion(name string) string {
Expand Down

0 comments on commit 90a4a84

Please sign in to comment.