2020-11-24 18:48:45 +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.
|
|
|
|
#
|
|
|
|
|
2020-12-18 15:05:09 +08:00
|
|
|
# This file is like other test_*.sh, but requires extra dependencies which
|
|
|
|
# you don't need in daily development.
|
2020-11-24 18:48:45 +08:00
|
|
|
|
2021-03-12 00:02:02 +08:00
|
|
|
. ./t/cli/common.sh
|
2020-11-24 18:48:45 +08:00
|
|
|
|
|
|
|
# check error handling when connecting to old etcd
|
|
|
|
git checkout conf/config.yaml
|
|
|
|
|
|
|
|
echo '
|
|
|
|
etcd:
|
|
|
|
host:
|
|
|
|
- "http://127.0.0.1:3379"
|
|
|
|
prefix: "/apisix"
|
|
|
|
' > conf/config.yaml
|
|
|
|
|
|
|
|
out=$(make init 2>&1 || true)
|
|
|
|
if ! echo "$out" | grep 'etcd cluster version 3.3.0 is less than the required version 3.4.0'; then
|
|
|
|
echo "failed: properly handle the error when connecting to old etcd"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "passed: properly handle the error when connecting to old etcd"
|
2021-01-26 23:33:55 +08:00
|
|
|
|
|
|
|
# It is forbidden to run apisix under the "/root" directory.
|
|
|
|
git checkout conf/config.yaml
|
|
|
|
|
|
|
|
mkdir /root/apisix
|
|
|
|
|
|
|
|
cp -r ./* /root/apisix
|
|
|
|
cd /root/apisix
|
|
|
|
make init
|
|
|
|
|
|
|
|
out=$(make run 2>&1 || true)
|
|
|
|
if ! echo "$out" | grep "Error: It is forbidden to run APISIX in the /root directory"; then
|
|
|
|
echo "failed: should echo It is forbidden to run APISIX in the /root directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd -
|
|
|
|
|
|
|
|
echo "passed: successfully prohibit APISIX from running in the /root directory"
|
|
|
|
|
|
|
|
rm -rf /root/apisix
|