Skip to content

Commit

Permalink
feat(pci-device): modify host_pci_device tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mristok committed Oct 30, 2023
1 parent da35003 commit 62cf640
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions vsphere/data_source_vsphere_host_pci_device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ package vsphere
import (
"fmt"
"os"
"regexp"
"strconv"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand All @@ -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("(.*?)"),
),
),
},
Expand Down

0 comments on commit 62cf640

Please sign in to comment.