Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ require (
github.com/google/uuid v1.6.0
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-version v1.7.0
github.com/jaypipes/ghw v0.16.0
github.com/jaypipes/pcidb v1.0.1
github.com/jaypipes/ghw v0.23.0
github.com/jaypipes/pcidb v1.1.1
github.com/jinzhu/copier v0.4.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/onsi/ginkgo v1.16.5
Expand Down Expand Up @@ -74,7 +74,7 @@ require (
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
Expand All @@ -91,7 +91,6 @@ require (
require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
Expand Down Expand Up @@ -140,7 +139,6 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand Down Expand Up @@ -175,7 +173,7 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/driver/postgres v1.3.5 // indirect
gorm.io/gorm v1.25.8 // indirect
howett.net/plist v1.0.0 // indirect
howett.net/plist v1.0.2-0.20250314012144-ee69052608d9 // indirect
k8s.io/api v0.34.3 // indirect
k8s.io/apimachinery v0.34.3 // indirect
k8s.io/client-go v0.34.3 // indirect
Expand Down
20 changes: 8 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt
github.com/PuerkitoBio/rehttp v1.4.0 h1:rIN7A2s+O9fmHUM1vUcInvlHj9Ysql4hE+Y0wcl/xk8=
github.com/PuerkitoBio/rehttp v1.4.0/go.mod h1:LUwKPoDbDIA2RL5wYZCNsQ90cx4OJ4AWBmq6KzWZL1s=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/alessio/shellescape v1.4.2 h1:MHPfaU+ddJ0/bYWpgIeUnQUqKrlJ1S7BfEYPM4uEoM0=
Expand Down Expand Up @@ -185,7 +183,6 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU=
Expand Down Expand Up @@ -365,10 +362,10 @@ github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76
github.com/jackc/pgx/v4 v4.18.3 h1:dE2/TrEsGX3RBprb3qryqSV9Y60iZN1C6i8IrmW9/BA=
github.com/jackc/pgx/v4 v4.18.3/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw=
github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jaypipes/ghw v0.16.0 h1:3HurCTS38VNpeQLo5fIdZsySuo/qAfpPSJ5t05QBFPM=
github.com/jaypipes/ghw v0.16.0/go.mod h1:In8SsaDqlb1oTyrbmTC14uy+fbBMvp+xdqX51MidlD8=
github.com/jaypipes/pcidb v1.0.1 h1:WB2zh27T3nwg8AE8ei81sNRb9yWBii3JGNJtT7K9Oic=
github.com/jaypipes/pcidb v1.0.1/go.mod h1:6xYUz/yYEyOkIkUt2t2J2folIuZ4Yg6uByCGFXMCeE4=
github.com/jaypipes/ghw v0.23.0 h1:WOL4hpLcIu1kIm+z5Oz19Tk1HNw/Sncrx/6GS8O0Kl0=
github.com/jaypipes/ghw v0.23.0/go.mod h1:fUNUjMZ0cjahKo+/u+32m9FutIx53Nkbi0Ti0m7j5HY=
github.com/jaypipes/pcidb v1.1.1 h1:QmPhpsbmmnCwZmHeYAATxEaoRuiMAJusKYkUncMC0ro=
github.com/jaypipes/pcidb v1.1.1/go.mod h1:x27LT2krrUgjf875KxQXKB0Ha/YXLdZRVmw6hH0G7g8=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
Expand Down Expand Up @@ -421,7 +418,6 @@ github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvls
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k=
github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58=
github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
Expand Down Expand Up @@ -600,8 +596,9 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80=
go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=
Expand Down Expand Up @@ -1051,7 +1048,6 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand All @@ -1078,8 +1074,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
howett.net/plist v1.0.2-0.20250314012144-ee69052608d9 h1:eeH1AIcPvSc0Z25ThsYF+Xoqbn0CI/YnXVYoTLFdGQw=
howett.net/plist v1.0.2-0.20250314012144-ee69052608d9/go.mod h1:fyFX5Hj5tP1Mpk8obqA9MZgXT416Q5711SDT7dQLTLk=
k8s.io/api v0.23.0/go.mod h1:8wmDdLBHBNxtOIytwLstXt5E9PddnZb0GaMcqsvDBpg=
k8s.io/api v0.34.3 h1:D12sTP257/jSH2vHV2EDYrb16bS7ULlHpdNdNhEw2S4=
k8s.io/api v0.34.3/go.mod h1:PyVQBF886Q5RSQZOim7DybQjAbVs8g7gwJNhGtY5MBk=
Expand Down
2 changes: 1 addition & 1 deletion src/inventory/disks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func incrementFileInfoNameCall(dependencies *util.MockIDependencies, id string)
}

func mockFetchDisks(dependencies *util.MockIDependencies, error error, disks ...*ghw.Disk) {
dependencies.On("Block", ghw.WithChroot("/host")).Return(&ghw.BlockInfo{Disks: disks}, error).Once()
dependencies.On("Block", mock.AnythingOfType("config.Modifier")).Return(&ghw.BlockInfo{Disks: disks}, error).Once()
}

// mockGetPathFromDev Mocks the dependency call that try to locate the disk at /dev/diskName used by disks.getPath.
Expand Down
47 changes: 24 additions & 23 deletions src/inventory/system_vendor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
. "github.com/onsi/gomega"
"github.com/openshift/assisted-installer-agent/src/util"
"github.com/openshift/assisted-service/models"
"github.com/stretchr/testify/mock"
)

var _ = Describe("System vendor test", func() {
Expand All @@ -23,17 +24,17 @@ var _ = Describe("System vendor test", func() {
})

It("Product error", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(nil, fmt.Errorf("Just an error")).Once()
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(nil, fmt.Errorf("Just an error")).Once()
ret := GetVendor(dependencies)
Expect(ret).To(Equal(&models.SystemVendor{}))
})
It("Product OK", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Name: "A Name",
SerialNumber: "A Serial Number",
Vendor: "A Vendor",
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(&ghw.ChassisInfo{
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(&ghw.ChassisInfo{
AssetTag: "An Asset Tag",
}, nil).Once()
dependencies.On("Execute", "systemd-detect-virt", "--vm").Return("none", "", 0).Once()
Expand All @@ -46,49 +47,49 @@ var _ = Describe("System vendor test", func() {
}))
})
It("Bare metal virtualization detection", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Name: "A Name",
SerialNumber: "A Serial Number",
Vendor: "A Vendor",
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(&ghw.ChassisInfo{
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(&ghw.ChassisInfo{
AssetTag: "An Asset Tag",
}, nil).Once()
dependencies.On("Execute", "systemd-detect-virt", "--vm").Return("none", "", 0).Once()
systemVendor := GetVendor(dependencies)
Expect(systemVendor.Virtual).ShouldNot(BeTrue())
})
It("Virtual machine detection", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Name: "A Name",
SerialNumber: "A Serial Number",
Vendor: "A Vendor",
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(&ghw.ChassisInfo{
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(&ghw.ChassisInfo{
AssetTag: "An Asset Tag",
}, nil).Once()
dependencies.On("Execute", "systemd-detect-virt", "--vm").Return("anyvirt", "", 0).Once()
systemVendor := GetVendor(dependencies)
Expect(systemVendor.Virtual).Should(BeTrue())
})
It("Virtual machine error on detection", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Name: "A Name",
SerialNumber: "A Serial Number",
Vendor: "A Vendor",
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(&ghw.ChassisInfo{
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(&ghw.ChassisInfo{
AssetTag: "An Asset Tag",
}, nil).Once()
dependencies.On("Execute", "systemd-detect-virt", "--vm").Return("", "an error", 1).Once()
systemVendor := GetVendor(dependencies)
Expect(systemVendor.Virtual).ShouldNot(BeTrue())
})
It("oVirt product detection", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Family: "oVirt",
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(&ghw.ChassisInfo{
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(&ghw.ChassisInfo{
AssetTag: "An Asset Tag",
}, nil).Once()
dependencies.On("Execute", "systemd-detect-virt", "--vm").Return("ovirt", "", 0).Once()
Expand All @@ -100,35 +101,35 @@ var _ = Describe("System vendor test", func() {
}))
})
It("Chassis error", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Name: "A Name",
SerialNumber: "A Serial Number",
Vendor: "A Vendor",
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(nil, fmt.Errorf("Just an error")).Once()
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(nil, fmt.Errorf("Just an error")).Once()
ret := GetVendor(dependencies)
Expect(ret).To(Equal(&models.SystemVendor{}))
})
It("Oracle Cloud detection", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Name: "A Name",
SerialNumber: "A Serial Number",
Vendor: "A Vendor",
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(&ghw.ChassisInfo{
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(&ghw.ChassisInfo{
AssetTag: "OracleCloud.com",
}, nil).Once()
dependencies.On("Execute", "systemd-detect-virt", "--vm").Return("none", "", 0).Once()
systemVendor := GetVendor(dependencies)
Expect(systemVendor.Manufacturer).Should(Equal("OracleCloud.com"))
})
It("s390x zVM node detection", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Name: ghwutil.UNKNOWN,
SerialNumber: ghwutil.UNKNOWN,
Vendor: ghwutil.UNKNOWN,
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(&ghw.ChassisInfo{
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(&ghw.ChassisInfo{
AssetTag: "An Asset Tag",
}, nil).Once()
dependencies.On("Execute", "systemd-detect-virt", "--vm").Return("zvm", "", 0).Once()
Expand All @@ -139,12 +140,12 @@ var _ = Describe("System vendor test", func() {
Expect(systemVendor.ProductName).Should(Equal("z/VM 7.2.0"))
})
It("s390x KVM node detection", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Name: ghwutil.UNKNOWN,
SerialNumber: ghwutil.UNKNOWN,
Vendor: ghwutil.UNKNOWN,
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(&ghw.ChassisInfo{
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(&ghw.ChassisInfo{
AssetTag: "An Asset Tag",
}, nil).Once()
dependencies.On("Execute", "systemd-detect-virt", "--vm").Return("kvm", "", 0).Once()
Expand All @@ -155,12 +156,12 @@ var _ = Describe("System vendor test", func() {
Expect(systemVendor.ProductName).Should(Equal("KVM/Linux"))
})
It("s390x LPAR node detection", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Name: ghwutil.UNKNOWN,
SerialNumber: ghwutil.UNKNOWN,
Vendor: ghwutil.UNKNOWN,
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(&ghw.ChassisInfo{
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(&ghw.ChassisInfo{
AssetTag: "An Asset Tag",
}, nil).Once()
dependencies.On("Execute", "systemd-detect-virt", "--vm").Return("", "", 0).Once()
Expand All @@ -171,12 +172,12 @@ var _ = Describe("System vendor test", func() {
Expect(systemVendor.ProductName).Should(Equal("LPAR"))
})
It("s390x LPAR node detection (glitch during detect virt)", func() {
dependencies.On("Product", ghw.WithChroot("/host")).Return(&ghw.ProductInfo{
dependencies.On("Product", mock.AnythingOfType("config.Modifier")).Return(&ghw.ProductInfo{
Name: ghwutil.UNKNOWN,
SerialNumber: ghwutil.UNKNOWN,
Vendor: ghwutil.UNKNOWN,
}, nil).Once()
dependencies.On("Chassis", ghw.WithChroot("/host")).Return(&ghw.ChassisInfo{
dependencies.On("Chassis", mock.AnythingOfType("config.Modifier")).Return(&ghw.ChassisInfo{
AssetTag: "An Asset Tag",
}, nil).Once()
dependencies.On("Execute", "systemd-detect-virt", "--vm").Return("", "an error", 1).Once()
Expand Down
8 changes: 4 additions & 4 deletions src/scanners/machine_uuid_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func disableGHWWarnings() {

//go:generate mockery --name SerialDiscovery --inpackage
type SerialDiscovery interface {
Product(opts ...*ghw.WithOption) (*ghw.ProductInfo, error)
Baseboard(opts ...*ghw.WithOption) (*ghw.BaseboardInfo, error)
Product(opts ...any) (*ghw.ProductInfo, error)
Baseboard(opts ...any) (*ghw.BaseboardInfo, error)
}

type GHWSerialDiscovery struct{}
Expand All @@ -57,11 +57,11 @@ func NewGHWSerialDiscovery() *GHWSerialDiscovery {
return &GHWSerialDiscovery{}
}

func (g *GHWSerialDiscovery) Product(opts ...*ghw.WithOption) (*ghw.ProductInfo, error) {
func (g *GHWSerialDiscovery) Product(opts ...any) (*ghw.ProductInfo, error) {
return ghw.Product(opts...)
}

func (g *GHWSerialDiscovery) Baseboard(opts ...*ghw.WithOption) (*ghw.BaseboardInfo, error) {
func (g *GHWSerialDiscovery) Baseboard(opts ...any) (*ghw.BaseboardInfo, error) {
return ghw.Baseboard(opts...)
}

Expand Down
Loading