mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-01 11:02:59 +00:00
chore(vm): refactoring: extract network code Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
package network
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
|
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/test"
|
|
)
|
|
|
|
func TestNetworkSchema(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
s := Schema()
|
|
|
|
test.AssertComputedAttributes(t, s, []string{
|
|
mkIPv4Addresses,
|
|
mkIPv6Addresses,
|
|
mkMACAddresses,
|
|
mkNetworkInterfaceNames,
|
|
})
|
|
|
|
test.AssertValueTypes(t, s, map[string]schema.ValueType{
|
|
mkIPv4Addresses: schema.TypeList,
|
|
mkIPv6Addresses: schema.TypeList,
|
|
mkMACAddresses: schema.TypeList,
|
|
mkNetworkInterfaceNames: schema.TypeList,
|
|
})
|
|
|
|
deviceSchema := test.AssertNestedSchemaExistence(
|
|
t,
|
|
s,
|
|
MkNetworkDevice,
|
|
)
|
|
|
|
test.AssertOptionalArguments(t, deviceSchema, []string{
|
|
mkNetworkDeviceBridge,
|
|
mkNetworkDeviceEnabled,
|
|
mkNetworkDeviceMACAddress,
|
|
mkNetworkDeviceModel,
|
|
mkNetworkDeviceRateLimit,
|
|
mkNetworkDeviceVLANID,
|
|
mkNetworkDeviceMTU,
|
|
})
|
|
|
|
test.AssertValueTypes(t, deviceSchema, map[string]schema.ValueType{
|
|
mkNetworkDeviceBridge: schema.TypeString,
|
|
mkNetworkDeviceEnabled: schema.TypeBool,
|
|
mkNetworkDeviceMACAddress: schema.TypeString,
|
|
mkNetworkDeviceModel: schema.TypeString,
|
|
mkNetworkDeviceRateLimit: schema.TypeFloat,
|
|
mkNetworkDeviceVLANID: schema.TypeInt,
|
|
mkNetworkDeviceMTU: schema.TypeInt,
|
|
})
|
|
}
|