Skip to content

Commit

Permalink
fix ip_filter acc test - delete resource after creation to avoid conf…
Browse files Browse the repository at this point in the history
…lict during next run
  • Loading branch information
vojindj committed Sep 16, 2024
1 parent de61a83 commit 62da185
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions sysdig/resource_sysdig_ip_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ package sysdig_test

import (
"fmt"
"github.com/draios/terraform-provider-sysdig/sysdig"
"testing"

"github.com/draios/terraform-provider-sysdig/sysdig"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand All @@ -22,22 +23,30 @@ func TestAccSysdigIpFilter_fullLifecycle(t *testing.T) {
Steps: []resource.TestStep{
{
// Create resource
Config: createIPFilter("192.168.1.0/24", "Initial note", true),
Config: createIPFilter("192.169.1.0/24", "Initial note", true),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("sysdig_ip_filter.test", "ip_range", "192.168.1.0/24"),
resource.TestCheckResourceAttr("sysdig_ip_filter.test", "ip_range", "192.169.1.0/24"),
resource.TestCheckResourceAttr("sysdig_ip_filter.test", "note", "Initial note"),
resource.TestCheckResourceAttr("sysdig_ip_filter.test", "enabled", "true"),
),
},
{
// Update resource
Config: createIPFilter("192.168.2.0/24", "Updated note", false),
Config: createIPFilter("192.169.2.0/24", "Updated note", false),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("sysdig_ip_filter.test", "ip_range", "192.168.2.0/24"),
resource.TestCheckResourceAttr("sysdig_ip_filter.test", "ip_range", "192.169.2.0/24"),
resource.TestCheckResourceAttr("sysdig_ip_filter.test", "note", "Updated note"),
resource.TestCheckResourceAttr("sysdig_ip_filter.test", "enabled", "false"),
),
},
{
// Delete resource
Config: "",
RefreshState: true,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckNoResourceExists("sysdig_ip_filter.test"),

Check failure on line 47 in sysdig/resource_sysdig_ip_filter_test.go

View workflow job for this annotation

GitHub Actions / Test / Sysdig Secure Acceptance Tests

undefined: resource.TestCheckNoResourceExists

Check failure on line 47 in sysdig/resource_sysdig_ip_filter_test.go

View workflow job for this annotation

GitHub Actions / Test / Sysdig Monitor Acceptance Tests

undefined: resource.TestCheckNoResourceExists
),
},
},
})
}
Expand Down

0 comments on commit 62da185

Please sign in to comment.