Skip to content

Commit

Permalink
pkg/topology: get sysfs parsing from containers/nri-plugins
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mythi committed Apr 17, 2023
1 parent aca1ee1 commit 104161b
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 1,106 deletions.
14 changes: 3 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
OLM_MANIFESTS = deployments/operator/manifests
BUNDLE_DIR = community-operators/operators/intel-device-plugins-operator/$(TAG)

TESTDATA_DIR = pkg/topology/testdata

EXTRA_BUILD_ARGS += --build-arg GOLICENSES_VERSION=$(GOLICENSES_VERSION)

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

update-fixture:
@scripts/ttar -C $(TESTDATA_DIR) -c -f $(TESTDATA_DIR)/sys.ttar sys/

fixture:
@scripts/ttar --recursive-unlink -C $(TESTDATA_DIR) -x -f $(TESTDATA_DIR)/sys.ttar

test: fixture
test:
ifndef WHAT
@$(GO) test -tags $(BUILDTAGS) -race -coverprofile=coverage.txt -covermode=atomic $(pkgs)
else
Expand All @@ -68,7 +60,7 @@ else
exit $$rc
endif

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

.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
.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

SPHINXOPTS =
SPHINXBUILD = sphinx-build
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/intel/intel-device-plugins-for-kubernetes
go 1.20

require (
github.com/containers/nri-plugins/pkg/topology v0.0.0-20230417061637-0847843000f8
github.com/fsnotify/fsnotify v1.6.0
github.com/go-ini/ini v1.67.0
github.com/go-logr/logr v1.2.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/containers/nri-plugins/pkg/topology v0.0.0-20230417061637-0847843000f8 h1:fcv6mtBBQd+woQSqZN1QJ1g91TRwUNNijj1WKjqub5Q=
github.com/containers/nri-plugins/pkg/topology v0.0.0-20230417061637-0847843000f8/go.mod h1:XHuUl2t6TVLTfGsy8+w3MdxOjSn2hN0lc1PuaxOEFEc=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
125 changes: 0 additions & 125 deletions pkg/topology/testdata/sys.ttar

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0-7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1,2,3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0-7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0-7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4,5,6
Loading

0 comments on commit 104161b

Please sign in to comment.