Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
Added unit testing command/docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Zenara Daley committed Apr 16, 2018
1 parent b703495 commit aa5c0d2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ ALL_ARCH = amd64 arm arm64 ppc64le s390x

QEMUVERSION=v2.9.1-1

BUSTEDVERSION=2.0.rc12
BUSTED_ARGS = -v

IMGNAME = nginx-ingress-controller
IMAGE = $(REGISTRY)/$(IMGNAME)
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
Expand Down Expand Up @@ -155,6 +158,18 @@ verify-all:
test:
@go test -v -race -tags "$(BUILDTAGS) cgo" $(shell go list ${PKG}/... | grep -v vendor | grep -v '/test/e2e')

.PHONY: lua-test
lua-test:
@if luarocks list --porcelain busted $(BUSTEDVERSION) | grep -q "installed" ; then \
echo busted already installed, skipping ; \
else \
echo busted not found, installing via luarocks... ; \
luarocks install busted $(BUSTEDVERSION) ; \
fi
@for file in ./rootfs/etc/nginx/lua/test/*.lua; do \
busted $(BUSTED_ARGS) $$file ; \
done

.PHONY: e2e-image
e2e-image: sub-container-amd64
TAG=$(TAG) IMAGE=$(MULTI_ARCH_IMG) docker tag $(IMAGE):$(TAG) $(IMAGE):test
Expand Down
11 changes: 11 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ $ cd $GOPATH/src/k8s.io/ingress-nginx
$ make e2e-test
```

To run unit-tests for lua code, run:

```console
$ cd $GOPATH/src/k8s.io/ingress-nginx
$ make lua-test
```

Lua tests are located in `$GOPATH/src/k8s.io/ingress-nginx/rootfs/etc/nginx/lua/test`.



## Releasing

All Makefiles will produce a release binary, as shown above. To publish this
Expand Down

0 comments on commit aa5c0d2

Please sign in to comment.