Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests for apis/arangodb/v1alpha package #21

Merged
merged 20 commits into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Jenkinsfile.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pipeline {
"IMAGETAG=${env.GIT_COMMIT}",
]) {
sh "make"
sh "make run-unit-tests"
}
}
}
Expand Down
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ update-vendor:
github.com/prometheus/client_golang/prometheus \
github.com/pulcy/pulsar \
github.com/rs/zerolog \
github.com/spf13/cobra
github.com/spf13/cobra \
github.com/stretchr/testify
@$(PULSAR) go flatten -V $(VENDORDIR) $(VENDORDIR)
@${MAKE} -B -s clean

Expand Down Expand Up @@ -148,6 +149,19 @@ endif

# Testing

run-unit-tests: $(GOBUILDDIR) $(SOURCES)
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 -v \
$(REPOPATH)/pkg/apis/arangodb/v1alpha

$(TESTBIN): $(GOBUILDDIR) $(SOURCES)
@mkdir -p $(BINDIR)
docker run \
Expand Down Expand Up @@ -183,7 +197,7 @@ endif
kubectl delete namespace $(TESTNAMESPACE) --ignore-not-found --now

cleanup-tests:
kubectl delete namespace $(TESTNAMESPACE) --ignore-not-found --now
$(ROOTDIR)/scripts/kube_delete_namespace.sh $(TESTNAMESPACE)

# Release building

Expand Down
24 changes: 24 additions & 0 deletions deps/github.com/stretchr/testify/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go

*.exe

.DS_Store
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

if [ -n "$(gofmt -l .)" ]; then
echo "Go code is not formatted:"
gofmt -d .
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

if [[ "$TRAVIS_GO_VERSION" =~ ^1\.[45](\..*)?$ ]]; then
exit 0
fi

go get github.com/ernesto-jimenez/gogen/imports
go generate ./...
if [ -n "$(git diff)" ]; then
echo "Go generate had not been run"
git diff
exit 1
fi
10 changes: 10 additions & 0 deletions deps/github.com/stretchr/testify/.travis.govet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

cd "$(dirname $0)"
DIRS=". assert require mock _codegen"
set -e
for subdir in $DIRS; do
pushd $subdir
go vet
popd
done
15 changes: 15 additions & 0 deletions deps/github.com/stretchr/testify/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: go

sudo: false

go:
- 1.7
- 1.8
- 1.9
- tip

script:
- ./.travis.gogenerate.sh
- ./.travis.gofmt.sh
- ./.travis.govet.sh
- go test -v -race $(go list ./... | grep -v vendor)
27 changes: 27 additions & 0 deletions deps/github.com/stretchr/testify/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions deps/github.com/stretchr/testify/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[prune]
unused-packages = true
non-go = true
go-tests = true

[[constraint]]
name = "github.com/davecgh/go-spew"
version = "~1.1.0"

[[constraint]]
name = "github.com/pmezard/go-difflib"
version = "~1.0.0"

[[constraint]]
name = "github.com/stretchr/objx"
version = "~0.1.0"
Loading