mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
Creating test framework
This commit is contained in:
parent
bdd4427070
commit
5a7597d999
3 changed files with 44 additions and 4 deletions
5
Dockerfile.test
Normal file
5
Dockerfile.test
Normal file
|
@ -0,0 +1,5 @@
|
|||
FROM scratch
|
||||
|
||||
ADD bin/arangodb_operator_test /usr/bin/
|
||||
|
||||
ENTRYPOINT [ "/usr/bin/arangodb_operator_test" ]
|
31
Makefile
31
Makefile
|
@ -27,13 +27,13 @@ PULSAR := $(GOBUILDDIR)/bin/pulsar$(shell go env GOEXE)
|
|||
ifndef DOCKERNAMESPACE
|
||||
DOCKERNAMESPACE := arangodb
|
||||
endif
|
||||
ifndef DOCKERFILE
|
||||
DOCKERFILE := Dockerfile
|
||||
#DOCKERFILE := Dockerfile.debug
|
||||
endif
|
||||
DOCKERFILE := Dockerfile
|
||||
DOCKERTESTFILE := Dockerfile.test
|
||||
|
||||
BINNAME := $(PROJECT)
|
||||
BIN := $(BINDIR)/$(BINNAME)
|
||||
TESTBINNAME := $(PROJECT)_test
|
||||
TESTBIN := $(BINDIR)/$(TESTBINNAME)
|
||||
RELEASE := $(GOBUILDDIR)/bin/release
|
||||
GHRELEASE := $(GOBUILDDIR)/bin/github-release
|
||||
|
||||
|
@ -124,6 +124,29 @@ $(BIN): $(GOBUILDDIR) $(SOURCES)
|
|||
docker: $(BIN)
|
||||
docker build -f $(DOCKERFILE) -t arangodb/arangodb-operator .
|
||||
|
||||
# Testing
|
||||
|
||||
$(TESTBIN): $(GOBUILDDIR) $(SOURCES)
|
||||
@mkdir -p $(BINDIR)
|
||||
@docker run \
|
||||
--rm \
|
||||
-v $(SRCDIR):/usr/code \
|
||||
-e GOPATH=/usr/code/.gobuild \
|
||||
-e GOOS=linux \
|
||||
-e GOARCH=amd64 \
|
||||
-e CGO_ENABLED=0 \
|
||||
-w /usr/code/ \
|
||||
golang:$(GOVERSION) \
|
||||
go test -c -installsuffix cgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o /usr/code/bin/$(TESTBINNAME) $(REPOPATH)/tests
|
||||
|
||||
docker-test: $(TESTBIN)
|
||||
docker build --quiet -f $(DOCKERTESTFILE) -t arangodb/arangodb-operator-test .
|
||||
|
||||
run-tests: docker-test
|
||||
kubectl run arangodb-operator-test -i --rm --quiet --restart=Never --image=arangodb/arangodb-operator-test
|
||||
|
||||
# Release building
|
||||
|
||||
docker-push: docker
|
||||
ifneq ($(DOCKERNAMESPACE), arangodb)
|
||||
docker tag arangodb/arangodb-operator $(DOCKERNAMESPACE)/arangodb-operator
|
||||
|
|
12
tests/single_test.go
Normal file
12
tests/single_test.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
package tests
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestSimpleSingle(t *testing.T) {
|
||||
time.Sleep(time.Second * 5)
|
||||
t.Log("TODO")
|
||||
t.Error("foo")
|
||||
}
|
Loading…
Reference in a new issue