okaybase commented on a change in pull request #5158: URL: https://github.com/apache/apisix/pull/5158#discussion_r720650204
########## File path: t/cli/test_etcd_ha.sh ########## @@ -0,0 +1,68 @@ +#!/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. +# + +ETCD_NAME_0=etcd0 +ETCD_NAME_1=etcd1 +ETCD_NAME_2=etcd2 + +echo ' +etcd: + host: + - "http://127.0.0.1:23790" + - "http://127.0.0.1:23791" + - "http://127.0.0.1:23792" +' > conf/config.yaml + +docker-compose -f ./t/cli/docker-compose-etcd-cluster.yaml up -d + +# case 1: stop one etcd nodes (result: start successful) +docker stop ${ETCD_NAME_0} + +out=$(make init 2>&1) +if echo "$out" | grep "23790" | grep "connection refused"; then + echo "passed: APISIX successfully to start, stop only one etcd node" +else + echo "failed: stop only one etcd node APISIX should start normally" + exit 1 +fi + +# case 2: stop two etcd nodes (result: start failure) +docker stop ${ETCD_NAME_1} + +out=$(make init 2>&1) +if echo "$out" | grep "23791" | grep "connection refused"; then + echo "passed: APISIX failed to start, etcd cluster must have two or more healthy nodes" +else + echo "failed: etcd has stopped two nodes, APISIX should fail to start" Review comment: ```suggestion echo "failed: two etcd nodes have been stopped, APISIX should fail to start" ``` ########## File path: t/cli/test_etcd_ha.sh ########## @@ -0,0 +1,68 @@ +#!/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. +# + +ETCD_NAME_0=etcd0 +ETCD_NAME_1=etcd1 +ETCD_NAME_2=etcd2 + +echo ' +etcd: + host: + - "http://127.0.0.1:23790" + - "http://127.0.0.1:23791" + - "http://127.0.0.1:23792" +' > conf/config.yaml + +docker-compose -f ./t/cli/docker-compose-etcd-cluster.yaml up -d + +# case 1: stop one etcd nodes (result: start successful) Review comment: ```suggestion # case 1: stop one etcd node (result: start successful) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
