From c2e8f90023883185fbd953577fff02d65d960c4d Mon Sep 17 00:00:00 2001 From: Liu An Date: Wed, 28 Jan 2026 09:27:47 +0800 Subject: [PATCH] feat(ci): Add Redis service port configuration to test environment (#12855) ### What problem does this PR solve? Added Redis port calculation and environment variable export to support Redis service in test environment. The port is dynamically assigned based on runner number to prevent conflicts during parallel test execution. Removed by #12685 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- .github/workflows/tests.yml | 2 ++ conf/service_conf.yaml | 3 +-- docker/service_conf.yaml.template | 3 +-- rag/utils/redis_conn.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 76e87e1fd..20b8f7ceb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -167,6 +167,7 @@ jobs: EXPOSE_MYSQL_PORT=$((5455 + RUNNER_NUM * 10)) MINIO_PORT=$((9000 + RUNNER_NUM * 10)) MINIO_CONSOLE_PORT=$((9001 + RUNNER_NUM * 10)) + REDIS_PORT=$((6379 + RUNNER_NUM * 10)) TEI_PORT=$((6380 + RUNNER_NUM * 10)) KIBANA_PORT=$((6601 + RUNNER_NUM * 10)) SVR_HTTP_PORT=$((9380 + RUNNER_NUM * 10)) @@ -186,6 +187,7 @@ jobs: echo -e "EXPOSE_MYSQL_PORT=${EXPOSE_MYSQL_PORT}" >> docker/.env echo -e "MINIO_PORT=${MINIO_PORT}" >> docker/.env echo -e "MINIO_CONSOLE_PORT=${MINIO_CONSOLE_PORT}" >> docker/.env + echo -e "REDIS_PORT=${REDIS_PORT}" >> docker/.env echo -e "TEI_PORT=${TEI_PORT}" >> docker/.env echo -e "KIBANA_PORT=${KIBANA_PORT}" >> docker/.env echo -e "SVR_HTTP_PORT=${SVR_HTTP_PORT}" >> docker/.env diff --git a/conf/service_conf.yaml b/conf/service_conf.yaml index 4b6777839..b303d69ae 100644 --- a/conf/service_conf.yaml +++ b/conf/service_conf.yaml @@ -43,8 +43,7 @@ redis: db: 1 username: '' password: 'infini_rag_flow' - host: 'localhost' - port: 6379 + host: 'localhost:6379' task_executor: message_queue_type: 'redis' user_default_llm: diff --git a/docker/service_conf.yaml.template b/docker/service_conf.yaml.template index a34845b11..f283f0853 100644 --- a/docker/service_conf.yaml.template +++ b/docker/service_conf.yaml.template @@ -51,8 +51,7 @@ redis: db: 1 username: '${REDIS_USERNAME:-}' password: '${REDIS_PASSWORD:-infini_rag_flow}' - host: '${REDIS_HOST:-redis}' - port: '${REDIS_PORT:-6379}' + host: '${REDIS_HOST:-redis}:6379' user_default_llm: default_models: embedding_model: diff --git a/rag/utils/redis_conn.py b/rag/utils/redis_conn.py index 99ad47796..d134f0533 100644 --- a/rag/utils/redis_conn.py +++ b/rag/utils/redis_conn.py @@ -125,8 +125,8 @@ class RedisDB: def __open__(self): try: conn_params = { - "host": self.config["host"], - "port": int(self.config.get("port", 6379)), + "host": self.config["host"].split(":")[0], + "port": int(self.config.get("host", ":6379").split(":")[1]), "db": int(self.config.get("db", 1)), "decode_responses": True, }