You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mh...@apache.org on 2019/08/02 15:09:14 UTC
[incubator-openwhisk-apigateway] branch master updated: Run test
framework in a Docker container (#351)
This is an automated email from the ASF dual-hosted git repository.
mhamann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-apigateway.git
The following commit(s) were added to refs/heads/master by this push:
new fd1f48d Run test framework in a Docker container (#351)
fd1f48d is described below
commit fd1f48d88143b431f89f404ac03a1021e0dad38b
Author: Matt Hamann <ma...@gmail.com>
AuthorDate: Fri Aug 2 11:09:09 2019 -0400
Run test framework in a Docker container (#351)
---
.travis.yml | 11 +----------
Dockerfile | 19 +++++++++++++------
Dockerfile.test.unit | 46 ++++++++++++++++++++++++++++++++++++++++++++++
Makefile | 7 ++++---
4 files changed, 64 insertions(+), 19 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 42a8d25..8569fcc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -35,24 +35,15 @@ notifications:
env:
global:
- - LUA="lua=5.1"
- secure: "c8XNwdOryMVJUGLzWv+AzUQaS0Yt7uUmGqw+5/K7o7zmpux7Q5H7OU3jni2kOr+ZoIldsmTnnG7m1N9D8qUjD64KaAfEC0ybo04kDraezVMghUEV8LWMpSRRlAFpzQeVC8IcSiUEXM0H8E6Y09jGMnLKqyFUWAlDB60n0x2rfK/IPU+x4/h+6Y5XpYqaNtujoUf/2XVkrOeRcEhVZQJAwsRtA8HjRUy7PRB/9kepTSln9QzRZYd6v4F1qUKgZhlWNRUXWRbhrNK/z6T7jSlHjY44yvse4fBbie+EsuImtOHnDuTA4XXQlbc0gGVvD3sYYf2CBMxeeE+UTbRPLxgml+uUIviWKt/PKB5qUwQyLKP/Rzr1qv5RryrX0xWoqCrVsaCe0fkh0vUks0AYlzhm1CNK/g1If+qZ6R0GMjawVUbCunhDi1vJlP5PmniIoLpVwLa6XoMYJKtfngGm2763y00ktVGGL [...]
- secure: "dM0paMW2d4U4U7OwbnrTjdOqDnvo+nce9r7h+qTbYfbuJe0fpRkHCrxcB//8ESkMrPTr0EDExCxvaywY8pqeVVJbykNswdyze1SWYk6lbUvXTpSrKqp0J0a/FtVjfamc1aMv4c6KIDKh4vIcgK4xrjXj68COCS6uIcFhETNUy5bxH8T2BOJzyf/iWOF7oduXUV/VGNcWnhkPdoPh8xtpmBJ6ZTWQ01MriZ/28hvzgyh1OjJFWCJZ+OZoIDQVPb/jnfPXU4Wk/G/LEPJcBgvN4qSMr2lm3Iq29V0Ltrsx8rrYADO7trCm6qyEQK9TLKfywaYIcm/D9FJ8F4WBHtIeJ3PLY3518L3iZ+Ngd6QTnd0FI6hrG7rpoD/0dz4e//9d3tSsjbh/1BiQwXXTnPyaUjN3C92k4GyITYJTVL5f6evzsTneT6Plj1vWC0E52d1oqVOZDgrWMYZEHdYvpUJTQqclMNhu5 [...]
before_install:
- ./tools/travis/scan.sh
- ./tools/travis/setup.sh
- - pip install hererocks --user
- - hererocks lua_install -r^ --$LUA
- - export PATH=$PATH:$PWD/lua_install/bin # Add directory with all installed binaries to PATH
-
-install:
- - cd tests
- - ./install-deps.sh
script:
- - busted --output=TAP --helper=set_paths --pattern=.lua scripts
- - cd ..
+ - make test
- ./tools/travis/build.sh
deploy:
diff --git a/Dockerfile b/Dockerfile
index f123be4..af7f8ee 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -22,7 +22,7 @@
# From https://hub.docker.com/_/alpine/
#
-FROM alpine:3.9
+FROM alpine:3.9 as base
# Busybox's ash shell supports pipefail, which is useful for tarballs
SHELL [ "/bin/ash", "-o", "pipefail", "-c"]
@@ -82,7 +82,6 @@ RUN echo " ... adding Openresty, NGINX and PCRE" \
&& mkdir -p /tmp/api-gateway \
&& readonly NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) \
&& echo "using up to $NPROC threads" \
-
&& cd /tmp/api-gateway/ \
&& curl -k -L https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VERSION}.tar.gz -o /tmp/api-gateway/pcre-${PCRE_VERSION}.tar.gz \
&& curl -k -L https://openresty.org/download/openresty-${OPENRESTY_VERSION}.tar.gz -o /tmp/api-gateway/openresty-${OPENRESTY_VERSION}.tar.gz \
@@ -152,7 +151,9 @@ RUN echo " ... adding Openresty, NGINX and PCRE" \
-j${NPROC} \
&& make -j${NPROC} \
&& make install \
-
+ #
+ # Build regular version of the API Gateway #
+ #
&& echo " - building regular version of the api-gateway ... " \
&& ./configure \
--prefix=${_exec_prefix}/api-gateway \
@@ -188,14 +189,18 @@ RUN echo " ... adding Openresty, NGINX and PCRE" \
-j${NPROC} \
&& make -j${NPROC} \
&& make install \
-
+ #
+ # Add nginx test support #
+ #
&& echo " - adding Nginx Test support" \
&& curl -k -L https://github.com/openresty/test-nginx/archive/v${TEST_NGINX_VERSION}.tar.gz -o ${_prefix}/test-nginx-${TEST_NGINX_VERSION}.tar.gz \
&& cd ${_prefix} \
&& tar -xf ${_prefix}/test-nginx-${TEST_NGINX_VERSION}.tar.gz \
&& rm ${_prefix}/test-nginx-${TEST_NGINX_VERSION}.tar.gz \
&& cp -r ${_prefix}/test-nginx-0.24/inc/* /usr/local/share/perl5/site_perl/ \
-
+ #
+ # CLEANUP #
+ #
&& ln -s ${_sbindir}/api-gateway-debug ${_sbindir}/nginx \
&& cp /tmp/api-gateway/openresty-${OPENRESTY_VERSION}/build/install ${_prefix}/api-gateway/bin/resty-install \
&& apk del g++ gcc make \
@@ -216,7 +221,6 @@ RUN echo " ... installing opm..." \
&& ln -s ${_prefix}/api-gateway/bin/resty /usr/bin/resty \
&& rm -rf /tmp/api-gateway
-
RUN echo " ... installing opm packages ... " \
&& opm get pintsized/lua-resty-http=${LUA_RESTY_HTTP_VERSION} \
hamishforbes/lua-resty-iputils=${LUA_RESTY_IPUTILS_VERSION} \
@@ -248,6 +252,9 @@ ENV CONFIG_SUPERVISOR_VERSION 1.0.1-RC1
COPY build_config_supervisor.sh /tmp/build_config_supervisor.sh
RUN sh +x /tmp/build_config_supervisor.sh
+# Add standard gateway configuration
+FROM base as apigateway
+
COPY init.sh /etc/init-container.sh
# add the default configuration for the Gateway
COPY . /etc/api-gateway
diff --git a/Dockerfile.test.unit b/Dockerfile.test.unit
new file mode 100644
index 0000000..598a038
--- /dev/null
+++ b/Dockerfile.test.unit
@@ -0,0 +1,46 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# apigateway
+#
+# VERSION 1.13.6.1
+#
+# From https://hub.docker.com/_/alpine/
+#
+
+FROM alpine:3.9
+
+RUN apk update && \
+ apk add \
+ gcc tar zlib wget make musl-dev g++ curl \
+ libtool readline luajit luajit-dev unzip \
+ openssl openssl-dev
+
+WORKDIR /tmp
+RUN wget https://luarocks.org/releases/luarocks-3.1.3.tar.gz && \
+ tar zxpf luarocks-3.1.3.tar.gz && \
+ cd luarocks-3.1.3 && \
+ ./configure && \
+ make build && \
+ make install
+
+COPY . /etc/api-gateway
+
+WORKDIR /etc/api-gateway/tests
+RUN ./install-deps.sh
+
+CMD sh run-tests.sh
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 7da0c67..55e5e01 100644
--- a/Makefile
+++ b/Makefile
@@ -58,9 +58,10 @@ profile-run: profile-build
-e OPTIMIZE=1 \
-d ${PROFILING}
-.PHONY: test-run
-test-run:
- cd tests; ./run-tests.sh
+.PHONY: test
+test:
+ docker build -f Dockerfile.test.unit -t gw-tests .
+ docker run gw-tests:latest
.PHONY: docker-run
docker-run: