test: fix hardware test not to require PCI devices

On e.g. Azure VMs there are non reported.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Andrey Smirnov 2024-06-03 17:20:42 +04:00
parent 9fcc9b8415
commit 30860210cc
No known key found for this signature in database
GPG Key ID: FE042E3D4085A811

View File

@ -63,11 +63,17 @@ func (suite *HardwareSuite) TestSystemInformation() {
func (suite *HardwareSuite) TestHardwareInfo() {
node := suite.RandomDiscoveredNodeInternalIP()
for _, resourceType := range []resource.Type{
resourceList := []resource.Type{
hardware.MemoryModuleType,
hardware.ProcessorType,
hardware.PCIDeviceType,
} {
}
if suite.Cluster != nil {
// cloud VMs might not publish PCI devices
resourceList = append(resourceList, hardware.PCIDeviceType)
}
for _, resourceType := range resourceList {
items, err := suite.Client.COSI.List(client.WithNode(suite.ctx, node), resource.NewMetadata(hardware.NamespaceName, resourceType, "", resource.VersionUndefined))
suite.Require().NoError(err)