Skip to content

use resty-cli for running lua unit tests #2829

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

Merged
merged 1 commit into from
Jul 21, 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
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;