mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-03 20:12:59 +00:00
* feat(vm): Add a bare minimum VM datasource * fix linter errors * fix doc * add lookup across all nodes in the cluster, add filter by tags * stable vm list * fix linter errors * pr feedback: switch to dynamic id for vms * add datasource examples * add unit tests * Update virtual_environment_vms.md
42 lines
1.3 KiB
Go
42 lines
1.3 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 proxmoxtf
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
)
|
|
|
|
// TestDataSourceVirtualEnvironmentVMInstantiation tests whether the dataSourceVirtualEnvironmentVM instance can be instantiated.
|
|
func TestDataSourceVirtualEnvironmentVMInstantiation(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
s := dataSourceVirtualEnvironmentVM()
|
|
|
|
if s == nil {
|
|
t.Fatalf("Cannot instantiate dataSourceVirtualEnvironmentVM")
|
|
}
|
|
}
|
|
|
|
// TestDataSourceVirtualEnvironmentVMSchema tests the dataSourceVirtualEnvironmentVM schema.
|
|
func TestDataSourceVirtualEnvironmentVMSchema(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
s := dataSourceVirtualEnvironmentVM()
|
|
|
|
testComputedAttributes(t, s, []string{
|
|
mkDataSourceVirtualEnvironmentVMName,
|
|
mkDataSourceVirtualEnvironmentVMTags,
|
|
})
|
|
|
|
testValueTypes(t, s, map[string]schema.ValueType{
|
|
mkDataSourceVirtualEnvironmentVMName: schema.TypeString,
|
|
mkDataSourceVirtualEnvironmentVMNodeName: schema.TypeString,
|
|
mkDataSourceVirtualEnvironmentVMTags: schema.TypeList,
|
|
mkDataSourceVirtualEnvironmentVMVMID: schema.TypeInt,
|
|
})
|
|
}
|