Skip to content

Commit

Permalink
use resty-cli for running lua unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvinEfendi committed Jul 21, 2018
1 parent 81848e6 commit 5c18fc9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"

WORKDIR $GOPATH

ENV RESTY_CLI_VERSION 0.22rc2
ENV RESTY_CLI_SHA 1ec64d204469a04da553c95eaafb2e5601a03acb8f26cc10ae16b15525228c12
RUN set -eux; \
url="https://github.com/openresty/resty-cli/archive/v${RESTY_CLI_VERSION}.tar.gz"; \
wget -O resty_cli.tgz "$url"; \
echo "${RESTY_CLI_SHA} *resty_cli.tgz" | sha256sum -c -; \
tar -C /tmp -xzf resty_cli.tgz; \
rm resty_cli.tgz; \
mv /tmp/resty-cli-${RESTY_CLI_VERSION}/bin/* /usr/local/bin/; \
resty -V

RUN luarocks install luacheck \
&& luarocks install busted 2.0.rc12

Expand Down
3 changes: 3 additions & 0 deletions build/busted
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env resty

require "busted.runner"({ standalone = false })
5 changes: 4 additions & 1 deletion build/test-lua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail

busted ${BUSTED_ARGS} ./rootfs/etc/nginx/lua/test;
export LUA_PATH="/usr/local/lib/lua/?.lua;;"
export LUA_CPATH="/usr/local/lib/lua/?.so;/usr/lib/lua-platform-path/lua/5.1/?.so;;"

resty ./build/busted ${BUSTED_ARGS} ./rootfs/etc/nginx/lua/test;

0 comments on commit 5c18fc9

Please sign in to comment.