Skip to content

Commit

Permalink
Refactor some conformance tests to utilize SRIOV_NODE_AND_DEVICE_NAME…
Browse files Browse the repository at this point in the history
…_FILTER variable
  • Loading branch information
evgenLevin authored and zeeke committed Sep 4, 2024
1 parent c5b82f3 commit 85feccd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions test/conformance/tests/test_sriov_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,9 +1060,11 @@ var _ = Describe("[sriov] operator", func() {

findSriovDevice := func(vendorID, deviceID string) (string, sriovv1.InterfaceExt) {
for _, node := range sriovInfos.Nodes {
for _, nic := range sriovInfos.States[node].Status.Interfaces {
devices, err := sriovInfos.FindSriovDevices(node)
Expect(err).ToNot(HaveOccurred())
for _, nic := range devices {
if vendorID != "" && deviceID != "" && nic.Vendor == vendorID && nic.DeviceID == deviceID {
return node, nic
return node, *nic
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions test/util/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,14 @@ func (n *EnabledNodes) FindOneSriovNodeAndDevice() (string, *sriovv1.InterfaceEx
// FindOneVfioSriovDevice retrieves a node with a valid sriov device for vfio
func (n *EnabledNodes) FindOneVfioSriovDevice() (string, sriovv1.InterfaceExt) {
for _, node := range n.Nodes {
for _, nic := range n.States[node].Status.Interfaces {
devices, err := n.FindSriovDevices(node)
if err != nil {
return "", sriovv1.InterfaceExt{}
}

for _, nic := range devices {
if nic.Vendor == intelVendorID && sriovv1.IsSupportedModel(nic.Vendor, nic.DeviceID) && nic.TotalVfs != 0 {
return node, nic
return node, *nic
}
}
}
Expand Down

0 comments on commit 85feccd

Please sign in to comment.