Skip to content

Commit da94a9e

Browse files
committed
Adding unit-tests
Signed-off-by: Sebastian Sch <sebassch@gmail.com>
1 parent b9fef2e commit da94a9e

32 files changed

+2778
-349
lines changed

cmd/sriov-network-config-daemon/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func (s *ServiceConfig) phasePre() error {
194194

195195
func (s *ServiceConfig) phasePost() error {
196196
s.log.V(0).Info("check result of the Pre phase")
197-
prePhaseResult, _, err := s.hostHelper.ReadSriovResult()
197+
prePhaseResult, err := s.hostHelper.ReadSriovResult()
198198
if err != nil {
199199
return fmt.Errorf("failed to read result of the pre phase: %v", err)
200200
}

cmd/sriov-network-config-daemon/service_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ var _ = Describe("Service", func() {
223223
Name: "enp216s0f0np0",
224224
}}, nil)
225225
hostHelpers.EXPECT().DiscoverBridges().Return(sriovnetworkv1.Bridges{}, nil)
226-
hostHelpers.EXPECT().ReadSriovResult().Return(getTestResultFileContent("InProgress", ""), false, nil)
226+
hostHelpers.EXPECT().ReadSriovResult().Return(getTestResultFileContent("InProgress", ""), nil)
227227
hostHelpers.EXPECT().ReadConfFile().Return(getTestSriovInterfaceConfig(0), nil)
228228
hostHelpers.EXPECT().ReadSriovSupportedNics().Return(testSriovSupportedNicIDs, nil)
229229
hostHelpers.EXPECT().WriteSriovResult(&hosttypes.SriovResult{SyncStatus: consts.SyncStatusSucceeded})
@@ -238,7 +238,7 @@ var _ = Describe("Service", func() {
238238
phaseArg = PhasePost
239239
hostHelpers.EXPECT().ReadConfFile().Return(getTestSriovInterfaceConfig(1), nil)
240240
hostHelpers.EXPECT().ReadSriovSupportedNics().Return(testSriovSupportedNicIDs, nil)
241-
hostHelpers.EXPECT().ReadSriovResult().Return(getTestResultFileContent("InProgress", ""), false, nil)
241+
hostHelpers.EXPECT().ReadSriovResult().Return(getTestResultFileContent("InProgress", ""), nil)
242242
hostHelpers.EXPECT().WriteSriovResult(&hosttypes.SriovResult{SyncStatus: consts.SyncStatusSucceeded})
243243

244244
Expect(runServiceCmd(&cobra.Command{}, []string{})).NotTo(HaveOccurred())
@@ -249,7 +249,7 @@ var _ = Describe("Service", func() {
249249
phaseArg = PhasePost
250250
hostHelpers.EXPECT().ReadConfFile().Return(getTestSriovInterfaceConfig(1), nil)
251251
hostHelpers.EXPECT().ReadSriovSupportedNics().Return(testSriovSupportedNicIDs, nil)
252-
hostHelpers.EXPECT().ReadSriovResult().Return(getTestResultFileContent("Failed", "pretest"), false, nil)
252+
hostHelpers.EXPECT().ReadSriovResult().Return(getTestResultFileContent("Failed", "pretest"), nil)
253253
hostHelpers.EXPECT().WriteSriovResult(&hosttypes.SriovResult{SyncStatus: consts.SyncStatusFailed, LastSyncError: "post: unexpected result of the pre phase: Failed, syncError: pretest"})
254254

255255
Expect(runServiceCmd(&cobra.Command{}, []string{})).To(HaveOccurred())

go.mod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ require (
2424
github.com/onsi/ginkgo/v2 v2.22.1
2525
github.com/onsi/gomega v1.36.2
2626
github.com/openshift-kni/k8sreporter v1.0.4
27-
github.com/openshift/api v0.0.0-20250129172457-b1a9b9a2e7fe
27+
github.com/openshift/api v0.0.0-20250227152946-1ee1ef831100
2828
github.com/openshift/client-go v0.0.0-20250125113824-8e1f0b8fa9a7
29-
github.com/openshift/machine-config-operator v0.0.1-0.20250304041132-19ba3dda6e7a
29+
github.com/openshift/machine-config-operator v0.0.1-0.20250320230514-53e78f3692ee
3030
github.com/ovn-org/libovsdb v0.6.1-0.20240125124854-03f787b1a892
3131
github.com/pkg/errors v0.9.1
3232
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.74.0
@@ -62,7 +62,7 @@ require (
6262
github.com/Mellanox/sriovnet v1.0.3 // indirect
6363
github.com/StackExchange/wmi v1.2.1 // indirect
6464
github.com/ajeddeloh/go-json v0.0.0-20200220154158-5ae607161559 // indirect
65-
github.com/aws/aws-sdk-go v1.45.20 // indirect
65+
github.com/aws/aws-sdk-go v1.55.5 // indirect
6666
github.com/beorn7/perks v1.0.1 // indirect
6767
github.com/blang/semver/v4 v4.0.0 // indirect
6868
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
@@ -137,14 +137,14 @@ require (
137137
github.com/samber/lo v1.47.0 // indirect
138138
github.com/shopspring/decimal v1.2.0 // indirect
139139
github.com/spf13/afero v1.11.0 // indirect
140-
github.com/spf13/cast v1.5.1 // indirect
140+
github.com/spf13/cast v1.7.0 // indirect
141141
github.com/spf13/pflag v1.0.6 // indirect
142142
github.com/stretchr/objx v0.5.2 // indirect
143143
github.com/vincent-petithory/dataurl v1.0.0 // indirect
144144
github.com/x448/float16 v0.8.4 // indirect
145145
github.com/xlab/treeprint v1.2.0 // indirect
146-
go.opentelemetry.io/otel v1.29.0 // indirect
147-
go.opentelemetry.io/otel/trace v1.29.0 // indirect
146+
go.opentelemetry.io/otel v1.31.0 // indirect
147+
go.opentelemetry.io/otel/trace v1.31.0 // indirect
148148
go.uber.org/multierr v1.11.0 // indirect
149149
go4.org v0.0.0-20200104003542-c7e774b10ea0 // indirect
150150
golang.org/x/crypto v0.32.0 // indirect
@@ -157,8 +157,8 @@ require (
157157
golang.org/x/time v0.9.0 // indirect
158158
golang.org/x/tools v0.29.0 // indirect
159159
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
160-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
161-
google.golang.org/grpc v1.66.2 // indirect
160+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect
161+
google.golang.org/grpc v1.69.4 // indirect
162162
google.golang.org/protobuf v1.36.4 // indirect
163163
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
164164
gopkg.in/inf.v0 v0.9.1 // indirect

0 commit comments

Comments
 (0)