From 62cf640032ab2172b24f755efa9b3ad0774e01b6 Mon Sep 17 00:00:00 2001 From: mristok Date: Mon, 30 Oct 2023 15:22:47 -0500 Subject: [PATCH] feat(pci-device): modify host_pci_device tests --- ...data_source_vsphere_host_pci_device_test.go | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/vsphere/data_source_vsphere_host_pci_device_test.go b/vsphere/data_source_vsphere_host_pci_device_test.go index 79870b4a2..5f03dec1a 100644 --- a/vsphere/data_source_vsphere_host_pci_device_test.go +++ b/vsphere/data_source_vsphere_host_pci_device_test.go @@ -6,8 +6,6 @@ package vsphere import ( "fmt" "os" - "regexp" - "strconv" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -25,30 +23,18 @@ func TestAccDataSourceVSphereHostPciDevice_basic(t *testing.T) { { Config: testAccDataSourceVSphereHostPciDeviceConfig(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrWith( + resource.TestCheckResourceAttrSet( "data.vsphere_host_pci_device.device", "pci_devices.#", - func(value string) error { - valueInt, err := strconv.Atoi(value) - if err != nil { - return err - } - - if valueInt <= 0 { - return fmt.Errorf("number of PCI devices should be greater than 0") - } - return nil - }, ), ), }, { Config: testAccDataSourceVSphereHostPciDeviceConfig(), Check: resource.ComposeTestCheckFunc( - resource.TestMatchResourceAttr( + resource.TestCheckResourceAttrSet( "data.vsphere_host_pci_device.device", "pci_devices.0.name", - regexp.MustCompile("(.*?)"), ), ), },