This is an automated email from the ASF dual-hosted git repository.
wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 8b3bccd test: check the behavior when connecting to old etcd (#2835)
8b3bccd is described below
commit 8b3bccd20f5224a0dc246666c4ee63fc0dad2e04
Author: 罗泽轩 <[email protected]>
AuthorDate: Tue Nov 24 18:48:45 2020 +0800
test: check the behavior when connecting to old etcd (#2835)
---
.github/workflows/build.yml | 9 +++++
.gitignore | 4 +-
.travis/apisix_cli_test_in_ci.sh | 49 +++++++++++++++++++++++++
.travis/linux_apisix_current_luarocks_runner.sh | 1 +
4 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f414fbb..8fa8ddb 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -35,6 +35,15 @@ jobs:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
+ old_etcd:
+ image: bitnami/etcd:3.3.8
+ ports:
+ - 3379:2379
+ - 3380:2380
+ env:
+ ALLOW_NONE_AUTHENTICATION: yes
+ ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
+
steps:
- name: Check out code
uses: actions/checkout@v2
diff --git a/.gitignore b/.gitignore
index a4cc4a3..2654e45 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,11 +57,9 @@ default.etcd/
.idea/
*.iml
\.*
+!.travis/
/conf/apisix.yaml
/conf/apisix-*.yaml
/conf/config-*.yaml
!/conf/config-default.yaml
/conf/debug-*.yaml
-
-# .travis
-!.travis/*.sh
diff --git a/.travis/apisix_cli_test_in_ci.sh b/.travis/apisix_cli_test_in_ci.sh
new file mode 100755
index 0000000..87410fe
--- /dev/null
+++ b/.travis/apisix_cli_test_in_ci.sh
@@ -0,0 +1,49 @@
+#!/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.
+#
+
+# This file is like apisix_cli_test.sh, but requires extra dependencies which
+# you don't need them in daily development.
+
+set -ex
+
+clean_up() {
+ git checkout conf/config.yaml
+}
+
+trap clean_up EXIT
+
+unset APISIX_PROFILE
+
+# 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"
diff --git a/.travis/linux_apisix_current_luarocks_runner.sh
b/.travis/linux_apisix_current_luarocks_runner.sh
index 4313116..1947246 100755
--- a/.travis/linux_apisix_current_luarocks_runner.sh
+++ b/.travis/linux_apisix_current_luarocks_runner.sh
@@ -56,6 +56,7 @@ script() {
# apisix cli test
sudo PATH=$PATH .travis/apisix_cli_test.sh
+ sudo PATH=$PATH .travis/apisix_cli_test_in_ci.sh
}
case_opt=$1