Skip to content

Commit

Permalink
chore: fix some tests by making them non-parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
fbreckle committed Oct 11, 2024
1 parent a107b8c commit 3a0ba4f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
4 changes: 2 additions & 2 deletions netbox/data_source_netbox_virtual_machines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func TestAccNetboxVirtualMachinesDataSource_basic(t *testing.T) {
testSlug := "vm_ds_basic"
testName := testAccGetTestName(testSlug)
dependencies := testAccNetboxVirtualMachineDataSourceDependencies(testName)
resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -76,7 +76,7 @@ func TestAccNetboxVirtualMachinesDataSource_tags(t *testing.T) {
testSlug := "vm_ds_tags"
testName := testAccGetTestName(testSlug)
dependencies := testAccNetboxVirtualMachineDataSourceDependenciesWithTags(testName)
resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Expand Down
19 changes: 15 additions & 4 deletions netbox/resource_netbox_ip_address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,21 @@ resource "netbox_ip_address" "test" {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"interface_id", "object_type"},
},
},
})
}

func TestAccNetboxIPAddress_cf(t *testing.T) {
testIP := "1.1.1.8/32"
testSlug := "ipaddr_cf"
testName := testAccGetTestName(testSlug)
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccNetboxIPAddressFullDependencies(testName) + fmt.Sprintf(`
resource "netbox_custom_field" "test" {
name = "test"
name = "%s"
type = "text"
weight = 100
content_types = ["ipam.ipaddress"]
Expand All @@ -216,11 +227,11 @@ resource "netbox_ip_address" "test_customfield" {
ip_address = "%s"
status = "active"
custom_fields = {
"${netbox_custom_field.test.name}" = "test-field"
"${netbox_custom_field.test.name}" = "test-field"
}
}`, testIP),
}`, testSlug, testIP),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("netbox_ip_address.test_customfield", "custom_fields.test", "test-field"),
resource.TestCheckResourceAttr("netbox_ip_address.test_customfield", fmt.Sprintf("custom_fields.%s", testSlug), "test-field"),
),
},
{
Expand Down
21 changes: 17 additions & 4 deletions netbox/resource_netbox_prefix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,24 @@ resource "netbox_prefix" "test" {
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccNetboxPrefix_cf(t *testing.T) {
testPrefix := "1.1.2.128/25"
testSlug := "prefix_cf"
testVid := "124"
randomSlug := testAccGetTestName(testSlug)
testDesc := "test cf prefix"
testName := testAccGetTestName(testSlug)
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccNetboxPrefixFullDependencies(testName, randomSlug, testVid) + fmt.Sprintf(`
resource "netbox_custom_field" "test" {
name = "test"
name = "%s"
type = "text"
weight = 100
content_types = ["ipam.prefix"]
Expand All @@ -243,15 +257,14 @@ resource "netbox_prefix" "test" {
prefix = "%s"
description = "%s 2"
status = "active"
tags = [netbox_tag.test.name]
mark_utilized = true
custom_fields = {
"${netbox_custom_field.test.name}" = "test-field"
}
}`, testPrefix, testDesc),
}`, testSlug, testPrefix, testDesc),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("netbox_prefix.test", "custom_fields.test", "test-field"),
resource.TestCheckResourceAttr("netbox_prefix.test", fmt.Sprintf("custom_fields.%s", testSlug), "test-field"),
),
},
{
Expand Down

0 comments on commit 3a0ba4f

Please sign in to comment.