From 5d7578ce424c0305e6ff72218ccc3fd7bd9f235e Mon Sep 17 00:00:00 2001 From: kevkevinpal Date: Fri, 6 Dec 2024 12:13:41 -0500 Subject: [PATCH] TEMP COMMIT --- .github/workflows/prjob_tests.yml | 32 ++++++++++++++++++++++++------- handlers/auth_test.go | 3 ++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/prjob_tests.yml b/.github/workflows/prjob_tests.yml index 68ea43369..8cc1e2026 100644 --- a/.github/workflows/prjob_tests.yml +++ b/.github/workflows/prjob_tests.yml @@ -39,22 +39,40 @@ jobs: run: go get golang.org/x/tools/cmd/cover - name: Tests + continue-on-error: true run: | - sudo V2_BOT_URL=http://localhost:3005 V2_BOT_TOKEN=xyzxyzxyz go test ./... -race -v -coverprofile=coverage.out > test_output.log 2>&1 - ./cover-check.sh coverage.out 8.4 - if [ -f "test_output.log" ]; then - sudo cat test_output.log - else - echo "Log file not found!" + if ! sudo V2_BOT_URL=http://localhost:3005 V2_BOT_TOKEN=xyzxyzxyz go test ./... -failfast -race -v -coverprofile=coverage.out > test_output.log 2>&1; then + echo "::set-output name=test_status::failed" fi + ./cover-check.sh coverage.out 8.4 - name: Upload test log + if: ${{steps.tests.outputs.test_status}} == 'failed' uses: actions/upload-artifact@v3 - if: failure() with: name: test-logs path: test_output.log + - name: Parse test log + if: ${{steps.tests.outputs.test_status}} == 'failed' + run: | + cat test_output.log + if grep -q "error" test_output.log; then + echo "Errors found in the logs." + # Write a loop here to get all the errors + # Send a curl request to jarvis use the env vars to set the url and token + + #curl -X POST \ + #-H "Content-Type: application/json" \ + #-H "Authorization: Bearer ${{ secrets.JARVIS_API_TOKEN }}" \ + #-d '{"log": ""}' \ + #${{ secrets.JARVIS_URL }}/endpoint + else + echo "No errors found in the logs." + fi + + exit 1 + - name: Droping DB with docker compose run: docker compose -f ./docker/testdb-docker-compose.yml -p test_db down diff --git a/handlers/auth_test.go b/handlers/auth_test.go index 46b73bd05..ffcb3000a 100644 --- a/handlers/auth_test.go +++ b/handlers/auth_test.go @@ -39,7 +39,8 @@ func TestGetAdminPubkeys(t *testing.T) { handler.ServeHTTP(rr, req) - if status := rr.Code; status != http.StatusOK { + t.Errorf("handler returned wrong status code: got TEST want TEST") + if status := rr.Code; status != rr.Code { t.Errorf("handler returned wrong status code: got %v want %v", status, http.StatusOK) }