zhanghongtong 4 лет назад
Родитель
Сommit
65e044abc0

+ 1 - 1
.ci/docker-compose-file/docker-compose-redis-cluster-tcp.yaml

@@ -6,7 +6,7 @@ services:
     container_name: redis
     volumes:
       - ./redis/:/data/conf
-    command: bash -c "/bin/bash /data/conf/redis.sh --node cluster && while true; do echo 1; sleep 1; done"
+    command: bash -c "/bin/bash /data/conf/redis.sh --node cluster && tail -f /var/log/redis-server.log"
     networks:
       emqx_bridge:
         # Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).

+ 1 - 1
.ci/docker-compose-file/docker-compose-redis-cluster-tls.yaml

@@ -7,7 +7,7 @@ services:
     volumes:
       - ../../apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs:/tls
       - ./redis/:/data/conf
-    command: bash -c "/bin/bash /data/conf/redis.sh --node cluster --tls-enabled && while true; do echo 1; sleep 1; done"
+    command: bash -c "/bin/bash /data/conf/redis.sh --node cluster --tls-enabled && tail -f /var/log/redis-server.log"
     networks:
       emqx_bridge:
         # Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).

+ 1 - 1
.ci/docker-compose-file/docker-compose-redis-sentinel-tcp.yaml

@@ -6,7 +6,7 @@ services:
     image: redis:${REDIS_TAG}
     volumes:
       - ./redis/:/data/conf
-    command: bash -c "/bin/bash /data/conf/redis.sh --node sentinel && while true; do echo 1; sleep 1; done"
+    command: bash -c "/bin/bash /data/conf/redis.sh --node sentinel && tail -f /var/log/redis-server.log"
     networks:
       emqx_bridge:
         # Assign a public address. Erlang container cannot find cluster nodes by network-scoped alias (redis_cluster).

+ 2 - 1
.ci/docker-compose-file/redis/redis-tls.conf

@@ -1,5 +1,6 @@
 daemonize yes
 bind 0.0.0.0 ::
+logfile /var/log/redis-server.log
 tls-cert-file /tls/redis.crt
 tls-key-file /tls/redis.key
-tls-ca-cert-file /tls/ca.crt
+tls-ca-cert-file /tls/ca.crt

+ 2 - 1
.ci/docker-compose-file/redis/redis.conf

@@ -1,2 +1,3 @@
 daemonize yes
-bind 0.0.0.0 ::
+bind 0.0.0.0 ::
+logfile /var/log/redis-server.log

+ 7 - 3
.ci/docker-compose-file/redis/redis.sh

@@ -1,5 +1,9 @@
 #!/bin/bash
 
+set -x
+
+LOCAL_IP=$(hostname -i | grep -oE '((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])\.){3}(25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])' | head -n 1)
+
 node=single
 tls=false
 while [[ $# -gt 0 ]]
@@ -48,9 +52,9 @@ elif [ "${node}" = "sentinel" ] ; then
     redis-server /data/conf/redis.conf --port 7000 --cluster-config-file /data/conf/nodes.7000.conf \
                                        --cluster-enabled no;
     redis-server /data/conf/redis.conf --port 7001 --cluster-config-file /data/conf/nodes.7001.conf \
-                                       --cluster-enabled no --slaveof 172.16.239.10 7000;
+                                       --cluster-enabled no --slaveof "$LOCAL_IP" 7000;
     redis-server /data/conf/redis.conf --port 7002 --cluster-config-file /data/conf/nodes.7002.conf \
-                                       --cluster-enabled no --slaveof 172.16.239.10 7000;
+                                       --cluster-enabled no --slaveof "$LOCAL_IP" 7000;
 fi
 REDIS_LOAD_FLG=true;
 
@@ -76,7 +80,7 @@ do
         continue;
     fi
     if [ "${node}" = "cluster" ] ; then
-      yes "yes" | redis-cli --cluster create 172.16.239.10:7000 172.16.239.10:7001 172.16.239.10:7002;
+      yes "yes" | redis-cli --cluster create "$LOCAL_IP:7000" "$LOCAL_IP:7001" "$LOCAL_IP:7002";
     elif [ "${node}" = "sentinel" ] ; then
       cp /data/conf/sentinel.conf /_sentinel.conf
       redis-server /_sentinel.conf --sentinel;

+ 1 - 0
.ci/docker-compose-file/redis/sentinel.conf

@@ -1,3 +1,4 @@
 port 26379
 dir /tmp
 sentinel monitor mymaster 172.16.239.10 7000 1
+logfile /var/log/redis-server.log

+ 0 - 5
.github/workflows/run_cts_tests.yaml

@@ -364,12 +364,7 @@ jobs:
             docker exec -i erlang bash -c "echo \"https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com\" > /root/.git-credentials && git config --global credential.helper store"
           fi
       - name: run test cases
-        timeout-minutes: 10
         run: |
-          while ! nc -zv ${EMQX_AUTH__REDIS__SERVER%:*} ${EMQX_AUTH__REDIS__SERVER##*:} > /dev/null 2>&1; do
-            echo "waiting redis server"
-            sleep 1
-          done
           export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
           printenv > .env
           docker exec -i erlang sh -c "make ensure-rebar3"