mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-01 11:02:59 +00:00
* cleanup 1
* continue refactoring
* more refactoring
* move VMs under nodes
* move container and other apis under nodes
* cleanups
* enabled revive.exported linter & add comments to exported stuff
* enable godot linter
* enable wsl linter
* enable thelper linter
* enable govet linter
* cleanup after rebase
* cleanup after rebase
* extract SSH ops into a separate interface
* fix linter error
* move ssh code to its own package
* cleaning up VirtualEnvironmentClient receivers
* on the finish line
* not sure what else I forgot... 🤔
* fix ssh connection and upload
* renaming client interfaces
* final cleanups
78 lines
2.4 KiB
Go
78 lines
2.4 KiB
Go
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
package resource
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
|
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/test"
|
|
)
|
|
|
|
// TestHostsInstantiation tests whether the Hosts instance can be instantiated.
|
|
func TestHostsInstantiation(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
s := Hosts()
|
|
if s == nil {
|
|
t.Fatalf("Cannot instantiate Hosts")
|
|
}
|
|
}
|
|
|
|
// TestHostsSchema tests the Hosts schema.
|
|
func TestHostsSchema(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
s := Hosts()
|
|
|
|
test.AssertRequiredArguments(t, s, []string{
|
|
mkResourceVirtualEnvironmentHostsEntry,
|
|
mkResourceVirtualEnvironmentHostsNodeName,
|
|
})
|
|
|
|
test.AssertComputedAttributes(t, s, []string{
|
|
mkResourceVirtualEnvironmentHostsAddresses,
|
|
mkResourceVirtualEnvironmentHostsDigest,
|
|
mkResourceVirtualEnvironmentHostsEntries,
|
|
mkResourceVirtualEnvironmentHostsHostnames,
|
|
})
|
|
|
|
test.AssertValueTypes(t, s, map[string]schema.ValueType{
|
|
mkResourceVirtualEnvironmentHostsAddresses: schema.TypeList,
|
|
mkResourceVirtualEnvironmentHostsDigest: schema.TypeString,
|
|
mkResourceVirtualEnvironmentHostsEntries: schema.TypeList,
|
|
mkResourceVirtualEnvironmentHostsEntry: schema.TypeList,
|
|
mkResourceVirtualEnvironmentHostsHostnames: schema.TypeList,
|
|
mkResourceVirtualEnvironmentHostsNodeName: schema.TypeString,
|
|
})
|
|
|
|
entriesSchema := test.AssertNestedSchemaExistence(t, s, mkResourceVirtualEnvironmentHostsEntries)
|
|
|
|
test.AssertComputedAttributes(t, entriesSchema, []string{
|
|
mkResourceVirtualEnvironmentHostsEntriesAddress,
|
|
mkResourceVirtualEnvironmentHostsEntriesHostnames,
|
|
})
|
|
|
|
test.AssertValueTypes(t, entriesSchema, map[string]schema.ValueType{
|
|
mkResourceVirtualEnvironmentHostsEntriesAddress: schema.TypeString,
|
|
mkResourceVirtualEnvironmentHostsEntriesHostnames: schema.TypeList,
|
|
})
|
|
|
|
entrySchema := test.AssertNestedSchemaExistence(t, s, mkResourceVirtualEnvironmentHostsEntry)
|
|
|
|
test.AssertRequiredArguments(t, entrySchema, []string{
|
|
mkResourceVirtualEnvironmentHostsEntryAddress,
|
|
mkResourceVirtualEnvironmentHostsEntryHostnames,
|
|
})
|
|
|
|
test.AssertValueTypes(t, entrySchema, map[string]schema.ValueType{
|
|
mkResourceVirtualEnvironmentHostsEntryAddress: schema.TypeString,
|
|
mkResourceVirtualEnvironmentHostsEntryHostnames: schema.TypeList,
|
|
})
|
|
}
|