Skip to content

Commit

Permalink
Add test for vlan-only
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtmc authored and paultyng committed Nov 14, 2021
1 parent 070a686 commit 6959a34
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions internal/provider/resource_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,32 @@ func TestAccNetwork_dhcpRelay(t *testing.T) {
})
}

func TestAccNetwork_vlanOnly(t *testing.T) {
name := acctest.RandomWithPrefix("tfacc")

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
preCheck(t)
},
ProviderFactories: providerFactories,
// TODO: CheckDestroy: ,
Steps: []resource.TestStep{
{
Config: testAccNetworkVlanOnly(name),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("unifi_network.test", "vlan_id", "101"),
),
},
{
ResourceName: "unifi_network.test",
ImportState: true,
ImportStateIdFunc: siteAndIDImportStateIDFunc("unifi_network.test"),
ImportStateVerify: true,
},
},
})
}

// TODO: ipv6 prefix delegation test

func quoteStrings(src []string) []string {
Expand Down Expand Up @@ -500,3 +526,18 @@ resource "unifi_network" "test" {
}
`, name, vlan, dhcpRelay)
}

func testAccNetworkVlanOnly(name string) string {
return fmt.Sprintf(`
resource "unifi_site" "test" {
description = "%[1]s"
}
resource "unifi_network" "test" {
site = unifi_site.test.name
name = "test"
purpose = "vlan-only"
vlan_id = 101
}
`, name)
}

0 comments on commit 6959a34

Please sign in to comment.