Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

Commit e8f04fe

Browse files
authored
WIP: New E2E test suite (#104)
Ginkgo based e2e test suite. NOTE: missing the following tests: - Multi-master backup restore test - Upgrade test
1 parent 3a9760c commit e8f04fe

File tree

464 files changed

+39059
-2996
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

464 files changed

+39059
-2996
lines changed

Gopkg.lock

Lines changed: 431 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 1 addition & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,16 @@ USE_GLOBAL_NAMESPACE ?= false
1616

1717
ifdef WERCKER
1818
# Insert swear words about mysql group replication and hostname length. Arghh..
19-
NEW_NAMESPACE ?= e2e-$(shell echo ${WERCKER_GIT_COMMIT} | fold -w 8 | head -n1)
2019
VERSION := ${WERCKER_GIT_COMMIT}
21-
E2E_FUNC := e2efunc-wercker
22-
E2E_NON_BUFFERED_LOGS ?= false
2320
else
2421
NEW_NAMESPACE ?= e2e-${USER}
2522
VERSION := ${USER}-$(shell date +%Y%m%d%H%M%S)
26-
E2E_FUNC := e2efunc-docker
27-
E2E_NON_BUFFERED_LOGS ?= true
2823
endif
2924

30-
E2E_PARALLEL ?= 10
3125
ROOT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
3226
PKG := github.com/oracle/mysql-operator
3327
REGISTRY := wcr.io/oracle
3428
SRC_DIRS := cmd pkg test/examples
35-
TEST_E2E_IMAGE := wcr.io/oracle/mysql-operator-ci-e2e:1.0.0
3629
REGISTRY_STRING := $(subst /,_,$(REGISTRY))
3730
CMD_DIRECTORIES := $(sort $(dir $(wildcard ./cmd/*/)))
3831
COMMANDS := $(CMD_DIRECTORIES:./cmd/%/=%)
@@ -42,6 +35,7 @@ PUSH_FILES := $(addprefix .push-$(REGISTRY_STRING)-,$(addsuffix -$(VERSION)
4235
ARCH := amd64
4336
OS := linux
4437
UNAME_S := $(shell uname -s)
38+
4539
ifeq ($(UNAME_S),Darwin)
4640
# Cross-compiling from OSX to linux, go install puts the binaries in $GOPATH/bin/$GOOS_$GOARCH
4741
BINARIES := $(addprefix $(GOPATH)/bin/$(OS)_$(ARCH)/,$(COMMANDS))
@@ -57,29 +51,6 @@ endif
5751
.PHONY: all
5852
all: build
5953

60-
.PHONY:e2econfig
61-
e2econfig:
62-
ifndef KUBECONFIG
63-
ifndef KUBECONFIG_VAR
64-
$(error "KUBECONFIG or KUBECONFIG_VAR must be defined")
65-
else
66-
$(eval KUBECONFIG:=/tmp/kubeconf-$(shell date +'%d%m%y%H%M%S%N').conf)
67-
$(eval export KUBECONFIG)
68-
$(shell echo "$${KUBECONFIG_VAR}" | openssl enc -base64 -d -A > $(KUBECONFIG))
69-
endif
70-
endif
71-
72-
ifndef CLUSTER_INSTANCE_SSH_KEY
73-
ifndef CLUSTER_INSTANCE_SSH_KEY_VAR
74-
$(error "CLUSTER_INSTANCE_SSH_KEY or CLUSTER_INSTANCE_SSH_KEY_VAR must be defined")
75-
else
76-
$(eval CLUSTER_INSTANCE_SSH_KEY:=/tmp/cluster_instance_key)
77-
$(eval export CLUSTER_INSTANCE_SSH_KEY)
78-
$(shell echo "$${CLUSTER_INSTANCE_SSH_KEY_VAR}" | openssl enc -base64 -d -A > $(CLUSTER_INSTANCE_SSH_KEY))
79-
$(shell chmod 600 $(CLUSTER_INSTANCE_SSH_KEY))
80-
endif
81-
endif
82-
8354
.PHONY: test
8455
test: build-dirs Makefile
8556
@echo "Testing: $(SRC_DIRS)"
@@ -130,80 +101,6 @@ version:
130101
lint:
131102
@find pkg cmd -name '*.go' | grep -v 'generated' | xargs -L 1 golint
132103

133-
define e2efunc-wercker
134-
if [ -z "$$MYSQL_OPERATOR_VERSION" ]; then export MYSQL_OPERATOR_VERSION=`cat dist/version.txt`; fi && \
135-
export NEW_NAMESPACE=$(NEW_NAMESPACE) && \
136-
export USE_GLOBAL_NAMESPACE=$(USE_GLOBAL_NAMESPACE) && \
137-
export E2E_NON_BUFFERED_LOGS=$(E2E_NON_BUFFERED_LOGS) && \
138-
export E2E_PARALLEL=$(E2E_PARALLEL) && \
139-
./test/e2e/scripts/e2e-mysql-operator-cluster.sh $(1)
140-
endef
141-
142-
define e2efunc-docker
143-
if [ -z "$$MYSQL_OPERATOR_VERSION" ]; then export MYSQL_OPERATOR_VERSION=`cat dist/version.txt`; fi && \
144-
docker login -u '$(DOCKER_REGISTRY_USERNAME)' -p '$(DOCKER_REGISTRY_PASSWORD)' $(REGISTRY) && \
145-
docker run \
146-
${DOCKER_OPS_INTERACTIVE} \
147-
--rm \
148-
-v "$$(pwd)/.go:/go:delegated" \
149-
-v "$$(pwd):/go/src/$(PKG):delegated" \
150-
-v "$$(pwd)/bin/$(ARCH):/go/bin" \
151-
-v "$$(pwd)/.go/std/$(ARCH):/usr/local/go/pkg/linux_$(ARCH)_static:delegated" \
152-
-w /go/src/$(PKG) \
153-
-e CLUSTER_INSTANCE_SSH_KEY=$(CLUSTER_INSTANCE_SSH_KEY) \
154-
-v $(CLUSTER_INSTANCE_SSH_KEY):$(CLUSTER_INSTANCE_SSH_KEY) \
155-
-e KUBECONFIG=/kubeconfig.conf \
156-
-v $(KUBECONFIG):/kubeconfig.conf \
157-
-e S3_ACCESS_KEY=$(S3_ACCESS_KEY) \
158-
-e S3_SECRET_KEY=$(S3_SECRET_KEY) \
159-
-e E2E_DEBUG="$(E2E_DEBUG)" \
160-
-e USE_RBAC="$(USE_RBAC)" \
161-
-e NODE_IPS="$(NODE_IPS)" \
162-
-e DOCKER_REGISTRY_USERNAME="$$DOCKER_REGISTRY_USERNAME" \
163-
-e DOCKER_REGISTRY_PASSWORD="$$DOCKER_REGISTRY_PASSWORD" \
164-
-e MYSQL_OPERATOR_VERSION="$$MYSQL_OPERATOR_VERSION" \
165-
-e HTTP_PROXY="$$HTTP_PROXY" \
166-
-e HTTPS_PROXY="$$HTTPS_PROXY" \
167-
-e NO_PROXY="$$NO_PROXY" \
168-
-e E2E_TEST_RUN="$$E2E_TEST_RUN" \
169-
-e E2E_TEST_TAG="$$E2E_TEST_TAG" \
170-
-e USE_GLOBAL_NAMESPACE=$(USE_GLOBAL_NAMESPACE) \
171-
-e NEW_NAMESPACE=$(NEW_NAMESPACE) \
172-
-e E2E_NON_BUFFERED_LOGS=$(E2E_NON_BUFFERED_LOGS) \
173-
-e E2E_PARALLEL=$(E2E_PARALLEL) \
174-
-e HOME=/tmp \
175-
$(TEST_E2E_IMAGE) \
176-
/bin/sh -c "./test/e2e/scripts/e2e-mysql-operator-cluster.sh $(1)"
177-
endef
178-
179-
# Runs test set specified by regex (i.e. go test -run <regex>)
180-
181-
e2e-test-setup-%: build-dirs e2econfig
182-
export E2E_TEST_RUN=$* && $(call $(E2E_FUNC), setup)
183-
184-
e2e-test-run-%: build-dirs e2econfig
185-
export E2E_TEST_RUN=$* && $(call $(E2E_FUNC), run)
186-
187-
e2e-test-teardown-%: build-dirs e2econfig
188-
export E2E_TEST_RUN=$* && $(call $(E2E_FUNC), teardown)
189-
190-
e2e-test-%: build-dirs e2econfig
191-
export E2E_TEST_RUN=$* && $(call $(E2E_FUNC), teardown setup run teardown)
192-
193-
# Runs test set specified by tags (i.e. go test -tags <tag>)
194-
195-
e2e-suite-setup-%: build-dirs e2econfig
196-
export E2E_TEST_TAG=$* && $(call $(E2E_FUNC), setup)
197-
198-
e2e-suite-run-%: build-dirs e2econfig
199-
export E2E_TEST_TAG=$* && $(call $(E2E_FUNC), run)
200-
201-
e2e-suite-teardown-%: build-dirs e2econfig
202-
export E2E_TEST_TAG=$* && $(call $(E2E_FUNC), teardown)
203-
204-
e2e-suite-%: build-dirs e2econfig
205-
export E2E_TEST_TAG=$* && $(call $(E2E_FUNC), teardown setup run teardown)
206-
207104
.PHONY: clean
208105
clean: container-clean bin-clean
209106

@@ -227,10 +124,3 @@ run-dev:
227124
.PHONY: generate
228125
generate:
229126
./hack/update-generated.sh
230-
231-
print-var-%: e2econfig
232-
@echo $* = $($*)
233-
234-
.PHONY: precommit-install
235-
precommit-install:
236-
ln -s ${ROOT_DIR}/hack/pre-commit.sh ${ROOT_DIR}/.git/hooks/pre-commit
Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
1-
FROM oraclelinux:7.3
1+
FROM oraclelinux:7.4
22

33
RUN yum install -y ca-certificates make openssl git && yum clean all
44

55
# Install golang environment
66
RUN curl https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz -O && \
7-
mkdir /tools && \
8-
tar xzf go1.8.3.linux-amd64.tar.gz -C /tools && \
9-
rm go1.8.3.linux-amd64.tar.gz && \
10-
mkdir /go
7+
mkdir /tools && \
8+
tar xzf go1.8.3.linux-amd64.tar.gz -C /tools && \
9+
rm go1.8.3.linux-amd64.tar.gz && \
10+
mkdir -p /go/bin
1111

12-
RUN mkdir /go/bin
13-
ENV PATH=/tools/go/bin:$PATH
14-
ENV GOPATH=/go
15-
ENV GOROOT=/tools/go
16-
17-
RUN curl -L -O https://github.com/Masterminds/glide/releases/download/v0.12.3/glide-v0.12.3-linux-amd64.tar.gz && \
18-
tar xf glide-v0.12.3-linux-amd64.tar.gz -C /tools
19-
20-
ENV PATH=/tools/linux-amd64:$PATH
12+
ENV PATH=/tools/go/bin:/go/bin:/tools/linux-amd64:$PATH \
13+
GOPATH=/go \
14+
GOROOT=/tools/go
2115

2216
# Install the kubectl client
23-
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.4/bin/linux/amd64/kubectl
24-
RUN chmod +x ./kubectl
25-
RUN mv ./kubectl /usr/local/bin/kubectl
17+
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.4/bin/linux/amd64/kubectl && \
18+
chmod +x ./kubectl && \
19+
mv ./kubectl /usr/local/bin/kubectl
2620

2721
# Installs Helm
28-
RUN curl -LO https://kubernetes-helm.storage.googleapis.com/helm-v2.6.1-linux-amd64.tar.gz
29-
RUN tar -xzvf helm-v2.6.1-linux-amd64.tar.gz
30-
RUN mv linux-amd64/helm /usr/local/bin/helm
22+
RUN curl -LO https://kubernetes-helm.storage.googleapis.com/helm-v2.6.1-linux-amd64.tar.gz && \
23+
tar -xzvf helm-v2.6.1-linux-amd64.tar.gz && \
24+
mv linux-amd64/helm /usr/local/bin/helm
25+
26+
# Install Ginkgo
27+
RUN go get -u github.com/onsi/ginkgo/ginkgo
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
DOCKER_REPO ?= wcr.io
2-
DOCKER_USER ?= oracle
3-
DOCKER_IMAGE_NAME ?= mysql-operator-ci-e2e
4-
5-
ifdef VERSION
6-
DOCKER_IMAGE_TAG := ${VERSION}
7-
else
8-
DOCKER_IMAGE_TAG := 1.0.0
9-
endif
1+
IMAGE ?= wcr.io/oracle/mysql-operator-ci-e2e
2+
VERSION ?= 1.1.1
103

114
.PHONY: build
12-
135
build:
14-
docker build --build-arg=http_proxy --build-arg=https_proxy -t ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} -f Dockerfile .
15-
docker tag ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} ${DOCKER_REPO}/${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}
16-
6+
docker build \
7+
--build-arg=http_proxy \
8+
--build-arg=https_proxy \
9+
-f Dockerfile \
10+
-t ${IMAGE}:${VERSION} \
11+
.
12+
13+
.PHONY: push
1714
push: build
18-
docker push ${DOCKER_REPO}/${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}
15+
docker push ${IMAGE}:${VERSION}

mysql-operator/templates/NOTES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ Thanks for installing the MySQL Operator.
22

33
Check if the operator is running with
44

5-
kubectl get po -n {{.Values.operator.namespace}}
5+
kubectl -n {{.Values.operator.namespace}} get po

test/e2e/README.md

Lines changed: 0 additions & 36 deletions
This file was deleted.

test/e2e/TestCases.md

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)