Skip to content

Commit 22a37cd

Browse files
committed
pkg/topology: get sysfs parsing from containers/nri-plugins
A proper upstream for the sysfs topology parsing is containers/nri-plugins se we can drop the duplicated code. At the same time, we no longer need to carry scripts/ttar and the sys.ttar unpacking for the tests because the remaining testdata becomes easier to maintain (the original testdata contained PCI BDF paths that trigged issues). Signed-off-by: Mikko Ylinen <[email protected]>
1 parent 0e1933c commit 22a37cd

File tree

13 files changed

+19
-1106
lines changed

13 files changed

+19
-1106
lines changed

Makefile

+3-11
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
2626
OLM_MANIFESTS = deployments/operator/manifests
2727
BUNDLE_DIR = community-operators/operators/intel-device-plugins-operator/$(TAG)
2828

29-
TESTDATA_DIR = pkg/topology/testdata
30-
3129
EXTRA_BUILD_ARGS += --build-arg GOLICENSES_VERSION=$(GOLICENSES_VERSION)
3230

3331
pkgs = $(shell $(GO) list ./... | grep -v vendor | grep -v e2e | grep -v envtest)
@@ -50,13 +48,7 @@ go-mod-tidy:
5048
$(GO) mod download all
5149
@report=`$(GO) mod tidy -v 2>&1` ; if [ -n "$$report" ]; then echo "$$report"; exit 1; fi
5250

53-
update-fixture:
54-
@scripts/ttar -C $(TESTDATA_DIR) -c -f $(TESTDATA_DIR)/sys.ttar sys/
55-
56-
fixture:
57-
@scripts/ttar --recursive-unlink -C $(TESTDATA_DIR) -x -f $(TESTDATA_DIR)/sys.ttar
58-
59-
test: fixture
51+
test:
6052
ifndef WHAT
6153
@$(GO) test -tags $(BUILDTAGS) -race -coverprofile=coverage.txt -covermode=atomic $(pkgs)
6254
else
@@ -68,7 +60,7 @@ else
6860
exit $$rc
6961
endif
7062

71-
test-with-kind: fixture intel-sgx-admissionwebhook intel-fpga-admissionwebhook intel-deviceplugin-operator install-tools
63+
test-with-kind: intel-sgx-admissionwebhook intel-fpga-admissionwebhook intel-deviceplugin-operator install-tools
7264
# Build a Cluster with KinD & Load Images & Install Cert-Manager
7365
kind create cluster
7466
kind load docker-image $(REG)intel-sgx-admissionwebhook:$(TAG)
@@ -241,7 +233,7 @@ check-github-actions:
241233
jq -e '$(images_json) - [$(skip_images)] - .jobs.image.strategy.matrix.image == []' > /dev/null || \
242234
(echo "Make sure all images are listed in .github/workflows/ci.yaml"; exit 1)
243235

244-
.PHONY: all format test lint build images $(cmds) $(images) lock-images vendor pre-pull set-version check-github-actions envtest fixture update-fixture install-tools test-image-base-layer
236+
.PHONY: all format test lint build images $(cmds) $(images) lock-images vendor pre-pull set-version check-github-actions envtest install-tools test-image-base-layer
245237

246238
SPHINXOPTS =
247239
SPHINXBUILD = sphinx-build

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/intel/intel-device-plugins-for-kubernetes
33
go 1.20
44

55
require (
6+
github.com/containers/nri-plugins/pkg/topology v0.0.0-20230417061637-0847843000f8
67
github.com/fsnotify/fsnotify v1.6.0
78
github.com/go-ini/ini v1.67.0
89
github.com/go-logr/logr v1.2.4

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH
7171
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
7272
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
7373
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
74+
github.com/containers/nri-plugins/pkg/topology v0.0.0-20230417061637-0847843000f8 h1:fcv6mtBBQd+woQSqZN1QJ1g91TRwUNNijj1WKjqub5Q=
75+
github.com/containers/nri-plugins/pkg/topology v0.0.0-20230417061637-0847843000f8/go.mod h1:XHuUl2t6TVLTfGsy8+w3MdxOjSn2hN0lc1PuaxOEFEc=
7476
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
7577
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
7678
github.com/coreos/go-systemd/v22 v22.4.0 h1:y9YHcjnjynCd/DVbg5j9L/33jQM3MxJlbj/zWskzfGU=

pkg/topology/testdata/sys.ttar

-125
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0-7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1,2,3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0-7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0-7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4,5,6

0 commit comments

Comments
 (0)