Skip to content

Commit

Permalink
remove obsolete mock driver
Browse files Browse the repository at this point in the history
The driver got replaced by an enhanced csi-driver-host-path.

"make test-sanity" will now check out the csi-driver-host-path source, build it
and run sanity testing as root. This is needed because in contrast to the mock
driver, the csi-driver-host-path actually does bind mounts.

Some special ways of testing a CSI driver (with credentials and different
endpoints) don't get tested anymore because csi-driver-host-path does not
support those modes of operation.
  • Loading branch information
pohly committed Sep 27, 2021
1 parent 1f60fc5 commit 8a57e46
Show file tree
Hide file tree
Showing 174 changed files with 39 additions and 51,818 deletions.
32 changes: 25 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,41 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This repository builds two commands, mock-driver and csi-sanity,
# but csi-sanity has its own build rules and only mock-driver gets
# published as a container image.
CMDS=mock-driver
# This repository builds one command, csi-sanity, but it has its own build
# rules no image to be published.
CMDS=
all: build build-sanity

include release-tools/build.make

# We have to exclude generic testing of the csi-sanity command because
# the test binary only works in combination with a CSI driver.
# Instead we test with the special ./hack/e2e.sh.
# Instead we test with the special ./hack/e2e.sh and the
# csi-driver-host-path that we build from source.
TEST_GO_FILTER_CMD+=| grep -v /cmd/csi-sanity
.PHONY: test-sanity
test: test-sanity
test-sanity:
test-sanity: bin/hostpathplugin
@ echo; echo "### $@:"
./hack/e2e.sh
if [ $(id -u) = 0 ]; then \
./hack/e2e.sh; \
else \
sudo ./hack/e2e.sh; \
fi

build-sanity:
$(MAKE) -C cmd/csi-sanity all


TEST_HOSTPATH_VERSION=v1.7.3
TEST_HOSTPATH_SOURCE=bin/hostpath-source
TEST_HOSTPATH_REPO=https://github.com/kubernetes-csi/csi-driver-host-path.git
bin/hostpathplugin:
mkdir -p $(@D)
if ! [ -d $(TEST_HOSTPATH_SOURCE) ]; then \
mkdir -p $(dir $(TEST_HOSTPATH_SOURCE)) && \
git clone $(TEST_HOSTPATH_REPO) $(TEST_HOSTPATH_SOURCE); \
fi
cd $(TEST_HOSTPATH_SOURCE) && git checkout $(TEST_HOSTPATH_VERSION)
make -C $(TEST_HOSTPATH_SOURCE) build
ln -fs $(abspath $(TEST_HOSTPATH_SOURCE))/bin/hostpathplugin $@
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![Build Status](https://k8s-testgrid.appspot.com/sig-storage-csi-other#pull-kubernetes-csi-csi-test)](https://k8s-testgrid.appspot.com/sig-storage-csi-other#pull-kubernetes-csi-csi-test)
[![Docker Repository on gcr](https://console.cloud.google.com/gcr/images/k8s-artifacts-prod/US/sig-storage/mock-driver)](https://console.cloud.google.com/gcr/images/k8s-artifacts-prod/US/sig-storage/mock-driver)

# csi-test

Expand All @@ -11,17 +10,6 @@ CO developers can use this framework to create drivers based on the
[Golang mock](https://github.com/golang/mock) framework. Please see
[co_test.go](test/co_test.go) for an example.

### Mock driver for testing

We also provide a container called `k8s.gcr.io/sig-storage/mock-driver` which can be used as an in-memory mock driver.
You will need to setup the environment variable `CSI_ENDPOINT` for the mock driver to know where to create the unix
domain socket.

There is an [example](https://github.com/kubernetes-csi/csi-test/tree/master/mock/example) deployment
for experiment with the mock csi driver.

For more complicated test-cases see [how to use JavaScript hooks from the driver](hooks-howto.md).

## For CSI Driver Tests

To test drivers please take a look at [pkg/sanity](https://github.com/kubernetes-csi/csi-test/tree/master/pkg/sanity).
Expand Down
4 changes: 0 additions & 4 deletions cmd/csi-sanity/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This repository builds two commands, mock-driver and csi-sanity,
# but csi-sanity has its own build rules and only mock-driver gets
# published as a container image.

APP_NAME := csi-sanity
VER :=$(shell git describe)
RELEASEVER := $(shell git describe --abbrev=0)
Expand Down
24 changes: 0 additions & 24 deletions cmd/mock-driver/Dockerfile

This file was deleted.

227 changes: 0 additions & 227 deletions cmd/mock-driver/main.go

This file was deleted.

5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ require (
github.com/nxadm/tail v1.4.5 // indirect
github.com/onsi/ginkgo v1.14.2
github.com/onsi/gomega v1.10.4
github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac
github.com/sirupsen/logrus v1.7.0
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 // indirect
golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d // indirect
golang.org/x/text v0.3.4 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto v0.0.0-20201209185603-f92720507ed4 // indirect
google.golang.org/grpc v1.34.0
gopkg.in/sourcemap.v1 v1.0.5 // indirect
gopkg.in/yaml.v2 v2.4.0
k8s.io/klog/v2 v2.4.0
)
12 changes: 0 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht
github.com/container-storage-interface/spec v1.5.0 h1:lvKxe3uLgqQeVQcrnL2CPQKISoKjTJxojEs9cBk+HXo=
github.com/container-storage-interface/spec v1.5.0/go.mod h1:8K96oQNkJ7pFcC2R9Z1ynGGBB1I93kcS6PGg3SsOk8s=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
Expand Down Expand Up @@ -53,16 +51,9 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.4 h1:NiTx7EEvBzu9sFOD1zORteLSt3o8gnlvZZwSE9TnY9U=
github.com/onsi/gomega v1.10.4/go.mod h1:g/HbgYopi++010VEqkFgJHKC09uJiW9UkXvMUuKHUCQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac h1:kYPjbEN6YPYWWHI6ky1J813KzIq/8+Wg4TO4xU7A/KU=
github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY=
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down Expand Up @@ -90,7 +81,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down Expand Up @@ -141,8 +131,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI=
gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78=
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.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
Loading

0 comments on commit 8a57e46

Please sign in to comment.