-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Go Testing Pipeline #142
Conversation
@@ -5,7 +5,10 @@ on: | |||
branches: [main] | |||
|
|||
jobs: | |||
test-server: | |||
uses: ./.github/workflows/go-tests.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dev.yml is the deployment workflow.
This shall be independent of the testing workflow and not depend on each other. So please change this back and let the testing be a separate workflow.
@@ -21,10 +20,10 @@ jobs: | |||
- name: Install dependencies | |||
run: cd ${{ matrix.directory }} && go mod download | |||
- name: Test with Go | |||
run: cd ${{ matrix.directory }} && go test ./... -json > TestResults-${{ matrix.directory }}.json | |||
run: cd ${{ matrix.directory }} && go test -race ./... -json > TestResults-${{ matrix.directory }}.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Updated Feedback - sorry)
I honestly do not see how the race flag actually resolve the root cause of the issue.
{"Time":"2025-02-03T10:54:40.078360835Z","Action":"output","Package":"github.com/niclasheun/prompt2.0/student","Test":"TestRouterTestSuite","Output":"2025/02/03 10:54:40 Failed to set up test database: failed to run SQL dump: failed to connect to user=testuser database=prompt
:\n"}
{"Time":"2025-02-03T10:54:40.078401362Z","Action":"output","Package":"github.com/niclasheun/prompt2.0/student","Test":"TestRouterTestSuite","Output":"\t127.0.0.1:32780 (localhost): failed to receive message: unexpected EOF\n"}
{"Time":"2025-02-03T10:54:40.078410308Z","Action":"output","Package":"github.com/niclasheun/prompt2.0/student","Test":"TestRouterTestSuite","Output":"\t[::1]:32780 (localhost): failed to receive message: read tcp [::1]:42826-\u003e[::1]:32780: read: connection reset by peer\n"}
Hence, the issue is that Github cannot handle the amount of created test containers or that i.e. the timeout is set too short or something like that.
Race will only check the local storage of Go but not the connections of external containers. I assume it "fixes" the issue, because it introduces overhead and slows down the execution. But I do no see a reason how this actually resolves the root cause.
My Advice:
- look into the creation of the test containers in server/testutils
- refer to the test results file generated and uploaded by the workflow
This pull request includes changes to the GitHub Actions workflows to improve the testing process and ensure better integration between jobs. The most important changes include adding a new test job, modifying the trigger for the Go test workflow, and enhancing the Go test command.
Improvements to Go testing workflow:
.github/workflows/go-tests.yml
: Updated thego test
command to include the-race
flag for detecting possible race conditions.github/workflows/go-tests.yml
: Changed the trigger frompull_request
toworkflow_call
to allow the workflow to be able to call it from the dev workflow.github/workflows/dev.yml
: Added a newtest-server
job that uses thego-tests.yml
workflow and set thebuild-and-push-server
job to depend on thetest-server
job