@@ -6,12 +6,10 @@ package vsphere
6
6
import (
7
7
"fmt"
8
8
"os"
9
- "regexp"
10
- "strconv"
11
9
"testing"
12
10
13
- "github.com/hashicorp/terraform-plugin-sdk/v2 /helper/resource"
14
- "github.com/hashicorp /terraform-provider-vsphere/vsphere/internal/helper/testhelper"
11
+ "github.com/hashicorp/terraform-plugin-testing /helper/resource"
12
+ "github.com/vmware /terraform-provider-vsphere/vsphere/internal/helper/testhelper"
15
13
)
16
14
17
15
func TestAccDataSourceVSphereHostPciDevice_basic (t * testing.T ) {
@@ -25,30 +23,18 @@ func TestAccDataSourceVSphereHostPciDevice_basic(t *testing.T) {
25
23
{
26
24
Config : testAccDataSourceVSphereHostPciDeviceConfig (),
27
25
Check : resource .ComposeTestCheckFunc (
28
- resource .TestCheckResourceAttrWith (
26
+ resource .TestCheckResourceAttrSet (
29
27
"data.vsphere_host_pci_device.device" ,
30
28
"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
- },
42
29
),
43
30
),
44
31
},
45
32
{
46
33
Config : testAccDataSourceVSphereHostPciDeviceConfig (),
47
34
Check : resource .ComposeTestCheckFunc (
48
- resource .TestMatchResourceAttr (
35
+ resource .TestCheckResourceAttrSet (
49
36
"data.vsphere_host_pci_device.device" ,
50
37
"pci_devices.0.name" ,
51
- regexp .MustCompile ("(.*?)" ),
52
38
),
53
39
),
54
40
},
0 commit comments