Skip to content

Commit

Permalink
Merge pull request #771 from zeeke/us/e2e-filter-devices
Browse files Browse the repository at this point in the history
Refactor some conformance tests to use `SRIOV_NODE_AND_DEVICE_NAME_FILTER`
  • Loading branch information
zeeke authored Sep 19, 2024
2 parents aecb4bb + 85feccd commit 60c6404
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 @@ -1068,9 +1068,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 @@ -230,9 +230,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 60c6404

Please sign in to comment.