From 6a11a5bb4b805cbdf91c53825179b8a24efbc8ed Mon Sep 17 00:00:00 2001 From: bensohh Date: Sun, 20 Oct 2024 22:52:54 +0800 Subject: [PATCH 1/4] Update test.yml file --- .github/workflows/test.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 635b95557e..fc5e848eb5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,9 @@ jobs: FIREBASE_CREDENTIAL_PATH: ${{ vars.QUESTION_SERVICE_FIREBASE_CREDENTIAL_PATH }} DB_CLOUD_URI: ${{ secrets.USER_SERVICE_DB_CLOUD_URI }} USER_SERVICE_PORT: ${{ vars.USER_SERVICE_PORT }} + MATCHING_SERVICE_PORT: ${{ vars.MATCHING_SERVICE_PORT }} + MATCHING_SERVICE_TIMEOUT: ${{ vars.MATCHING_SERVICE_TIMEOUT }} + REDIS_URL: ${{ vars.REDIS_URL }} run: | cd ./apps/frontend echo "NEXT_PUBLIC_QUESTION_SERVICE_URL=$QUESTION_SERVICE_URL" >> .env @@ -48,6 +51,12 @@ jobs: echo "PORT=$USER_SERVICE_PORT" >> .env echo "JWT_SECRET=$JWT_SECRET" >> .env + cd ../matching-service + echo "PORT=$MATCHING_SERVICE_PORT" >> .env + echo "MATCH_TIMEOUT=$MATCHING_SERVICE_TIMEOUT" >> .env + echo "JWT_SECRET=$JWT_SECRET" >> .env + echo "REDIS_URL=$REDIS_URL" >> .env + - name: Create Database Credential Files env: FIREBASE_JSON: ${{ secrets.QUESTION_SERVICE_FIREBASE_CREDENTIAL }} @@ -69,9 +78,11 @@ jobs: FRONTEND_URL: ${{ vars.FRONTEND_URL }} USER_SERVICE_URL: ${{ vars.USER_SERVICE_URL }} QUESTION_SERVICE_URL: ${{ vars.QUESTION_SERVICE_URL }} + MATCHING_SERVICE_URL: ${{ vars.MATCHING_SERVICE_URL }} run: | curl -sSL -o /dev/null $QUESTION_SERVICE_URL curl -fsSL -o /dev/null $USER_SERVICE_URL curl -fsSL -o /dev/null $FRONTEND_URL + curl -fsSL -o /dev/null $MATCHING_SERVICE_URL # We can add more tests here From dd66cdb43a813f4ffd0a81a1443dd699118c956a Mon Sep 17 00:00:00 2001 From: bensohh Date: Sun, 20 Oct 2024 23:09:39 +0800 Subject: [PATCH 2/4] Change test for websocket --- .github/workflows/test.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fc5e848eb5..8f23078c99 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,6 +73,9 @@ jobs: - name: Wait for services to be ready run: sleep 30 + - name: Install websocat + run: sudo apt-get install -y websocat + - name: Run Tests env: FRONTEND_URL: ${{ vars.FRONTEND_URL }} @@ -80,9 +83,13 @@ jobs: QUESTION_SERVICE_URL: ${{ vars.QUESTION_SERVICE_URL }} MATCHING_SERVICE_URL: ${{ vars.MATCHING_SERVICE_URL }} run: | - curl -sSL -o /dev/null $QUESTION_SERVICE_URL - curl -fsSL -o /dev/null $USER_SERVICE_URL - curl -fsSL -o /dev/null $FRONTEND_URL - curl -fsSL -o /dev/null $MATCHING_SERVICE_URL + echo "Testing Question Service..." + curl -sSL -o /dev/null $QUESTION_SERVICE_URL && echo "Question Service is up" + echo "Testing User Service..." + curl -fsSL -o /dev/null $USER_SERVICE_URL && echo "User Service is up" + echo "Testing Frontend..." + curl -fsSL -o /dev/null $FRONTEND_URL && echo "Frontend is up" + echo "Testing Matching Service..." + websocat $MATCHING_SERVICE_URL --ping && echo "Matching Service is up" # We can add more tests here From 8de8677f6d9e27ee2b32d51d254a125a92492c11 Mon Sep 17 00:00:00 2001 From: bensohh Date: Sun, 20 Oct 2024 23:15:01 +0800 Subject: [PATCH 3/4] Temporarily remove test for matching service --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f23078c99..8975fcd317 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,9 +73,6 @@ jobs: - name: Wait for services to be ready run: sleep 30 - - name: Install websocat - run: sudo apt-get install -y websocat - - name: Run Tests env: FRONTEND_URL: ${{ vars.FRONTEND_URL }} @@ -90,6 +87,6 @@ jobs: echo "Testing Frontend..." curl -fsSL -o /dev/null $FRONTEND_URL && echo "Frontend is up" echo "Testing Matching Service..." - websocat $MATCHING_SERVICE_URL --ping && echo "Matching Service is up" + # Add in test for matching service in the future # We can add more tests here From ed4e1300c31a2a307bb5917051466f26d9eeb00d Mon Sep 17 00:00:00 2001 From: bensohh Date: Sun, 20 Oct 2024 23:29:43 +0800 Subject: [PATCH 4/4] Test websocat trial 1 --- .github/workflows/test.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8975fcd317..0d2a1ad306 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,6 +73,12 @@ jobs: - name: Wait for services to be ready run: sleep 30 + - name: Install websocat + run: | + sudo wget -qO /usr/local/bin/websocat https://github.com/vi/websocat/releases/latest/download/websocat.x86_64-unknown-linux-musl + sudo chmod a+x /usr/local/bin/websocat + websocat --version + - name: Run Tests env: FRONTEND_URL: ${{ vars.FRONTEND_URL }} @@ -87,6 +93,11 @@ jobs: echo "Testing Frontend..." curl -fsSL -o /dev/null $FRONTEND_URL && echo "Frontend is up" echo "Testing Matching Service..." + if ! (echo "Hello" | websocat $MATCHING_SERVICE_URL); then + echo "WebSocket for Matching Service is not live" + else + echo "WebSocket for Matching Service is live" + fi # Add in test for matching service in the future # We can add more tests here