Merge pull request #2829 from ElvinEfendi/use-resty-cli

use resty-cli for running lua unit tests
This commit is contained in:
k8s-ci-robot 2018-07-21 16:32:33 -07:00 committed by GitHub
commit f5963f2d80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View file

@ -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

3
build/busted Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env resty
require "busted.runner"({ standalone = false })

View file

@ -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;