2021-01-12 10:55:54 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2021-03-29 23:34:01 +08:00
|
|
|
. ./ci/common.sh
|
2021-01-12 10:55:54 +08:00
|
|
|
|
|
|
|
install_dependencies() {
|
2021-02-01 13:15:53 +08:00
|
|
|
export_or_prefix
|
2021-01-12 10:55:54 +08:00
|
|
|
|
|
|
|
# install development tools
|
2021-02-01 10:51:34 +08:00
|
|
|
yum install -y wget tar gcc automake autoconf libtool make unzip \
|
2021-10-25 08:59:44 +08:00
|
|
|
git which sudo openldap-devel
|
2021-01-12 10:55:54 +08:00
|
|
|
|
2021-10-25 08:59:44 +08:00
|
|
|
# curl with http2
|
|
|
|
wget https://github.com/moparisthebest/static-curl/releases/download/v7.79.1/curl-amd64 -O /usr/bin/curl
|
2021-03-03 17:59:59 +08:00
|
|
|
# install openresty to make apisix's rpm test work
|
2021-01-12 10:55:54 +08:00
|
|
|
yum install -y yum-utils && yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
|
2021-08-06 11:35:07 +08:00
|
|
|
yum install -y openresty openresty-debug openresty-openssl111-debug-devel pcre pcre-devel
|
2021-02-02 10:47:59 +08:00
|
|
|
|
|
|
|
# install luarocks
|
2021-02-04 09:08:23 +08:00
|
|
|
./utils/linux-install-luarocks.sh
|
2021-01-12 10:55:54 +08:00
|
|
|
|
|
|
|
# install etcdctl
|
|
|
|
wget https://github.com/etcd-io/etcd/releases/download/v3.4.0/etcd-v3.4.0-linux-amd64.tar.gz
|
|
|
|
tar xf etcd-v3.4.0-linux-amd64.tar.gz
|
2021-02-04 09:08:23 +08:00
|
|
|
cp ./etcd-v3.4.0-linux-amd64/etcdctl /usr/local/bin/
|
2021-01-12 10:55:54 +08:00
|
|
|
rm -rf etcd-v3.4.0-linux-amd64
|
|
|
|
|
2021-12-15 11:45:59 +08:00
|
|
|
# install vault cli capabilities
|
|
|
|
install_vault_cli
|
|
|
|
|
2021-01-12 10:55:54 +08:00
|
|
|
# install test::nginx
|
2021-08-18 16:02:30 +08:00
|
|
|
yum install -y cpanminus perl
|
2021-01-12 10:55:54 +08:00
|
|
|
cpanm --notest Test::Nginx IPC::Run > build.log 2>&1 || (cat build.log && exit 1)
|
|
|
|
|
2021-10-28 08:49:08 +08:00
|
|
|
# add go1.15 binary to the path
|
2021-01-12 10:55:54 +08:00
|
|
|
mkdir build-cache
|
2021-10-28 08:49:08 +08:00
|
|
|
# centos-7 ci runs on a docker container with the centos image on top of ubuntu host. Go is required inside the container.
|
|
|
|
cd build-cache/ && wget https://golang.org/dl/go1.15.linux-amd64.tar.gz && tar -xf go1.15.linux-amd64.tar.gz
|
|
|
|
export PATH=$PATH:$(pwd)/go/bin
|
|
|
|
cd ..
|
|
|
|
# install and start grpc_server_example
|
|
|
|
cd t/grpc_server_example
|
|
|
|
|
|
|
|
# unless pulled recursively, the submodule directory will remain empty. So it's better to initialize and set the submodule to the particular commit.
|
|
|
|
if [ ! "$(ls -A . )" ]; then
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
fi
|
|
|
|
|
|
|
|
CGO_ENABLED=0 go build
|
|
|
|
./grpc_server_example \
|
2021-04-20 18:08:13 +08:00
|
|
|
-grpc-address :50051 -grpcs-address :50052 -grpcs-mtls-address :50053 \
|
2021-10-28 08:49:08 +08:00
|
|
|
-crt ../certs/apisix.crt -key ../certs/apisix.key -ca ../certs/mtls_ca.crt \
|
2021-04-20 18:08:13 +08:00
|
|
|
> grpc_server_example.log 2>&1 || (cat grpc_server_example.log && exit 1)&
|
2021-01-12 10:55:54 +08:00
|
|
|
|
2021-10-28 08:49:08 +08:00
|
|
|
cd ../../
|
2021-01-12 10:55:54 +08:00
|
|
|
# wait for grpc_server_example to fully start
|
|
|
|
sleep 3
|
|
|
|
|
2021-10-25 14:43:38 +08:00
|
|
|
# installing grpcurl
|
|
|
|
install_grpcurl
|
|
|
|
|
2022-01-09 23:59:32 +08:00
|
|
|
# install nodejs
|
|
|
|
install_nodejs
|
|
|
|
|
|
|
|
# grpc-web server && client
|
|
|
|
cd t/plugin/grpc-web
|
|
|
|
./setup.sh
|
|
|
|
# back to home directory
|
|
|
|
cd ../../../
|
|
|
|
|
2021-01-12 10:55:54 +08:00
|
|
|
# install dependencies
|
2021-02-04 09:08:23 +08:00
|
|
|
git clone https://github.com/iresty/test-nginx.git test-nginx
|
2021-11-02 21:49:41 +08:00
|
|
|
create_lua_deps
|
2021-01-12 10:55:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
run_case() {
|
2021-02-01 13:15:53 +08:00
|
|
|
export_or_prefix
|
2021-03-03 17:59:59 +08:00
|
|
|
make init
|
2021-02-02 09:07:40 +08:00
|
|
|
./utils/set-dns.sh
|
2021-01-12 10:55:54 +08:00
|
|
|
# run test cases
|
2022-01-02 17:49:42 +08:00
|
|
|
FLUSH_ETCD=1 prove -Itest-nginx/lib -I./ -r t | tee /tmp/test.result
|
|
|
|
rerun_flaky_tests /tmp/test.result
|
2021-01-12 10:55:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
case_opt=$1
|
|
|
|
case $case_opt in
|
|
|
|
(install_dependencies)
|
|
|
|
install_dependencies
|
|
|
|
;;
|
|
|
|
(run_case)
|
|
|
|
run_case
|
|
|
|
;;
|
|
|
|
esac
|