Skip to content

Commit 901e11f

Browse files
mristoktenthirtyam
authored andcommitted
feat(pci-device): modify host_pci_device tests
1 parent ed00409 commit 901e11f

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

vsphere/data_source_vsphere_host_pci_device_test.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ package vsphere
66
import (
77
"fmt"
88
"os"
9-
"regexp"
10-
"strconv"
119
"testing"
1210

1311
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -25,30 +23,18 @@ func TestAccDataSourceVSphereHostPciDevice_basic(t *testing.T) {
2523
{
2624
Config: testAccDataSourceVSphereHostPciDeviceConfig(),
2725
Check: resource.ComposeTestCheckFunc(
28-
resource.TestCheckResourceAttrWith(
26+
resource.TestCheckResourceAttrSet(
2927
"data.vsphere_host_pci_device.device",
3028
"pci_devices.#",
31-
func(value string) error {
32-
valueInt, err := strconv.Atoi(value)
33-
if err != nil {
34-
return err
35-
}
36-
37-
if valueInt <= 0 {
38-
return fmt.Errorf("number of PCI devices should be greater than 0")
39-
}
40-
return nil
41-
},
4229
),
4330
),
4431
},
4532
{
4633
Config: testAccDataSourceVSphereHostPciDeviceConfig(),
4734
Check: resource.ComposeTestCheckFunc(
48-
resource.TestMatchResourceAttr(
35+
resource.TestCheckResourceAttrSet(
4936
"data.vsphere_host_pci_device.device",
5037
"pci_devices.0.name",
51-
regexp.MustCompile("(.*?)"),
5238
),
5339
),
5440
},

0 commit comments

Comments
 (0)