fix(websocket): use local test server instead of public echo.websocket.org

This commit is contained in:
surengab
2026-03-20 19:00:33 +04:00
parent c413fa7f9f
commit 37413999a4
8 changed files with 35 additions and 8 deletions
+9
View File
@@ -27,6 +27,9 @@ on:
pre_run_script:
type: string
required: false
pre_run_executable_script:
type: string
required: false
publish_unit_test_result:
type: boolean
required: false
@@ -61,6 +64,9 @@ jobs:
echo "Executeable wasn't run"
exit 0
fi
if [ -n "${{ inputs.pre_run_executable_script }}" ]; then
source $GITHUB_WORKSPACE/${{ inputs.pre_run_executable_script }}
fi
./build/${{inputs.app_name}}.elf
- name: Publish Unit Test Result
uses: EnricoMi/publish-unit-test-result-action@v2
@@ -82,6 +88,9 @@ jobs:
# The sdkconfig.ci.coverage specifies Linux as the build target with apropriate settings (CONFIG_GCOV_ENABLED=y).
cp sdkconfig.ci.coverage sdkconfig.defaults
idf.py build
if [ -n "${{ inputs.pre_run_executable_script }}" ]; then
source $GITHUB_WORKSPACE/${{ inputs.pre_run_executable_script }}
fi
./build/${{inputs.app_name}}.elf
- name: Run Coverage
shell: bash
@@ -17,6 +17,7 @@ jobs:
app_name: "websocket"
app_path: "esp-protocols/components/esp_websocket_client/examples/linux"
component_path: "esp-protocols/components/esp_websocket_client"
pre_run_executable_script: "esp-protocols/components/esp_websocket_client/examples/linux/start_server.sh"
run_executable: true
upload_artifacts: true
run_coverage: true
@@ -3,4 +3,5 @@ CONFIG_IDF_TARGET="linux"
CONFIG_IDF_TARGET_LINUX=y
CONFIG_ESP_EVENT_POST_FROM_ISR=n
CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=n
CONFIG_WEBSOCKET_URI="wss://echo.websocket.org"
CONFIG_WEBSOCKET_URI="ws://localhost:8080"
CONFIG_WS_OVER_TLS_SERVER_AUTH=n
@@ -2,4 +2,5 @@ CONFIG_IDF_TARGET="linux"
CONFIG_IDF_TARGET_LINUX=y
CONFIG_ESP_EVENT_POST_FROM_ISR=n
CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=n
CONFIG_WEBSOCKET_URI="wss://echo.websocket.org"
CONFIG_WEBSOCKET_URI="ws://localhost:8080"
CONFIG_WS_OVER_TLS_SERVER_AUTH=n
@@ -0,0 +1,15 @@
#!/bin/bash
pip install SimpleWebSocketServer
python3 $GITHUB_WORKSPACE/esp-protocols/components/esp_websocket_client/examples/target/websocket_server.py --port 8080 &
WS_SERVER_PID=$!
echo "WebSocket server started (PID $WS_SERVER_PID)"
# Wait until the server is accepting connections (up to 10 s)
for i in $(seq 1 10); do
python3 -c "import socket; s=socket.create_connection(('localhost',8080),timeout=1); s.close()" 2>/dev/null && echo "Server ready" && break
echo "Waiting for server... ($i)" && sleep 1
done
# Ensure the server is killed when the calling shell exits
trap "kill $WS_SERVER_PID 2>/dev/null || true" EXIT
@@ -1,7 +1,7 @@
CONFIG_IDF_TARGET="esp32"
CONFIG_IDF_TARGET_LINUX=n
CONFIG_WEBSOCKET_URI_FROM_STDIN=n
CONFIG_WEBSOCKET_URI_FROM_STRING=y
CONFIG_WEBSOCKET_URI_FROM_STDIN=y
CONFIG_WEBSOCKET_URI_FROM_STRING=n
CONFIG_EXAMPLE_CONNECT_ETHERNET=y
CONFIG_EXAMPLE_CONNECT_WIFI=n
CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y
@@ -1,7 +1,7 @@
CONFIG_IDF_TARGET="esp32"
CONFIG_IDF_TARGET_LINUX=n
CONFIG_WEBSOCKET_URI_FROM_STDIN=n
CONFIG_WEBSOCKET_URI_FROM_STRING=y
CONFIG_WEBSOCKET_URI_FROM_STDIN=y
CONFIG_WEBSOCKET_URI_FROM_STRING=n
CONFIG_EXAMPLE_CONNECT_ETHERNET=y
CONFIG_EXAMPLE_CONNECT_WIFI=n
CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y
@@ -1,7 +1,7 @@
CONFIG_IDF_TARGET="esp32"
CONFIG_IDF_TARGET_LINUX=n
CONFIG_WEBSOCKET_URI_FROM_STDIN=n
CONFIG_WEBSOCKET_URI_FROM_STRING=y
CONFIG_WEBSOCKET_URI_FROM_STDIN=y
CONFIG_WEBSOCKET_URI_FROM_STRING=n
CONFIG_EXAMPLE_CONNECT_ETHERNET=y
CONFIG_EXAMPLE_CONNECT_WIFI=n
CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y