File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed
Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -109,10 +109,18 @@ jobs:
109109 python:3.11-alpine \
110110 sh -c "pip install websockets && python /ws-echo.py"
111111
112- # 等待服务就绪
112+ # 等待服务就绪 - WebSocket 服务启动很快
113113 echo "Waiting for ws-echo to be ready..."
114- sleep 5
115- echo "✅ ws-echo started!"
114+ sleep 10
115+
116+ # 检查容器是否在运行
117+ if docker ps | grep -q ws-echo; then
118+ echo "✅ ws-echo container is running!"
119+ else
120+ echo "❌ ws-echo container failed to start"
121+ docker logs ws-echo
122+ exit 1
123+ fi
116124
117125 - name : Install Rust-stable
118126 uses : actions-rust-lang/setup-rust-toolchain@v1
@@ -141,8 +149,15 @@ jobs:
141149 echo "Checking json-api..."
142150 curl -f http://localhost:8889/posts
143151
144- echo "Checking ws-echo..."
145- curl -f http://localhost:8890
152+ echo "Checking ws-echo (WebSocket service - checking port)..."
153+ # WebSocket 服务不能用普通 HTTP 请求检查,检查端口是否监听
154+ if timeout 5 bash -c 'cat < /dev/null > /dev/tcp/localhost/8890'; then
155+ echo "✅ ws-echo port 8890 is listening"
156+ else
157+ echo "❌ ws-echo port 8890 is not accessible"
158+ docker logs ws-echo
159+ exit 1
160+ fi
146161
147162 - name : Run tests
148163 env :
You can’t perform that action at this time.
0 commit comments