Skip to content

Commit cc7ba6f

Browse files
committed
mock: Support for quay.io/k8scsi/mock-driver
1 parent 57aeb5f commit cc7ba6f

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99

1010
# Output of the go coverage tool, specifically when used with LiteIDE
1111
*.out
12+
bin/mock
1213
cmd/csi-sanity/csi-sanity

.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ script:
77
- go vet $(go list ./... | grep -v vendor)
88
- go test $(go list ./... | grep -v vendor | grep -v "cmd/csi-sanity")
99
- ./hack/e2e.sh
10+
after_success:
11+
- if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
12+
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" quay.io;
13+
make push;
14+
fi

Dockerfile.mock

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM alpine
2+
LABEL maintainers="Kubernetes Authors"
3+
LABEL description="CSI Mock Driver"
4+
5+
COPY ./bin/mock mock
6+
ENTRYPOINT ["/mock"]

Makefile

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2018 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
IMAGE_NAME = quay.io/k8scsi/mock-driver
16+
IMAGE_VERSION = canary
17+
18+
ifdef V
19+
TESTARGS = -v -args -alsologtostderr -v 5
20+
else
21+
TESTARGS =
22+
endif
23+
24+
all: mock
25+
26+
mock:
27+
mkdir -p bin
28+
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o ./bin/mock ./mock/main.go
29+
30+
clean:
31+
rm -rf bin
32+
33+
container: mock
34+
docker build -f Dockerfile.mock -t $(IMAGE_NAME):$(IMAGE_VERSION) .
35+
36+
push: container
37+
docker push $(IMAGE_NAME):$(IMAGE_VERSION)

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
[![Build Status](https://travis-ci.org/kubernetes-csi/csi-test.svg?branch=master)](https://travis-ci.org/kubernetes-csi/csi-test)
2+
[![Docker Repository on Quay](https://quay.io/repository/k8scsi/mock-driver/status "Docker Repository on
3+
Quay")](https://quay.io/repository/k8scsi/mock-driver)
4+
25
# csi-test
36
csi-test houses packages and libraries to help test CSI client and plugins.
47

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

13+
### Mock driver for testing
14+
We also provide a container called `quay.io/k8scsi/mock-driver:canary` which can be used as an in-memory mock driver.
15+
It follows the same release cycle as other containers, so the latest release is `quay.io/k8scsi/mock-driver:v0.2.0`.
16+
17+
You will need to setup the environment variable `CSI_ENDPOINT` for the mock driver to know where to create the unix
18+
domain socket.
19+
1020
## For CSI Driver Tests
1121
To test drivers please take a look at [pkg/sanity](https://github.com/kubernetes-csi/csi-test/tree/master/pkg/sanity).
1222
This package and [csi-sanity](https://github.com/kubernetes-csi/csi-test/tree/master/cmd/csi-sanity) are meant to test

0 commit comments

Comments
 (0)