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 \
|
|
|
|
curl git which sudo
|
2021-01-12 10:55:54 +08:00
|
|
|
|
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-03-03 17:59:59 +08:00
|
|
|
yum install -y openresty openresty-debug openresty-openssl111-debug-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
|
|
|
|
|
|
|
|
# install test::nginx
|
|
|
|
yum install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl
|
|
|
|
cpanm --notest Test::Nginx IPC::Run > build.log 2>&1 || (cat build.log && exit 1)
|
|
|
|
|
|
|
|
# install and start grpc_server_example
|
|
|
|
mkdir build-cache
|
|
|
|
wget https://github.com/iresty/grpc_server_example/releases/download/20200901/grpc_server_example-amd64.tar.gz
|
|
|
|
tar -xvf grpc_server_example-amd64.tar.gz
|
|
|
|
mv grpc_server_example build-cache/
|
|
|
|
git clone https://github.com/iresty/grpc_server_example.git grpc_server_example
|
|
|
|
cd grpc_server_example/ && mv proto/ ../build-cache/ && cd ..
|
|
|
|
./build-cache/grpc_server_example > grpc_server_example.log 2>&1 || (cat grpc_server_example.log && exit 1)&
|
|
|
|
|
|
|
|
# wait for grpc_server_example to fully start
|
|
|
|
sleep 3
|
|
|
|
|
|
|
|
# install dependencies
|
2021-02-04 09:08:23 +08:00
|
|
|
git clone https://github.com/iresty/test-nginx.git test-nginx
|
2021-01-12 10:55:54 +08:00
|
|
|
make deps
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2021-02-05 09:00:20 +08:00
|
|
|
FLUSH_ETCD=1 prove -I./test-nginx/lib -I./ -r t/
|
2021-01-12 10:55:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
case_opt=$1
|
|
|
|
case $case_opt in
|
|
|
|
(install_dependencies)
|
|
|
|
install_dependencies
|
|
|
|
;;
|
|
|
|
(run_case)
|
|
|
|
run_case
|
|
|
|
;;
|
|
|
|
esac
|