Skip to content

Commit 67d2224

Browse files
Added test to cover custom field filter
Signed-off-by: Christopher Svensson <christopher.svensson@stegra.com>
1 parent 2c1790e commit 67d2224

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

netbox/data_source_netbox_prefix_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,20 @@ resource "netbox_prefix" "test" {
165165
data "netbox_prefix" "test_output" {
166166
depends_on = [netbox_prefix.test]
167167
prefix = "%[2]s"
168-
}`, testField, testPrefix),
168+
}
169+
170+
data "netbox_prefix" "by_custom_fields" {
171+
depends_on = [netbox_prefix.test]
172+
custom_fields = {
173+
"${netbox_custom_field.test.name}" = "test value"
174+
}
175+
}
176+
`, testField, testPrefix),
169177
Check: resource.ComposeTestCheckFunc(
170178
resource.TestCheckResourceAttr("data.netbox_prefix.test_output", "status", "active"),
171179
resource.TestCheckResourceAttr("data.netbox_prefix.test_output", "prefix", testPrefix),
172180
resource.TestCheckResourceAttr("data.netbox_prefix.test_output", "custom_fields."+testField, "test value"),
181+
resource.TestCheckResourceAttrPair("data.netbox_prefix.by_custom_fields", "id", "netbox_prefix.test", "id"),
173182
),
174183
},
175184
},

0 commit comments

Comments
 (0)