Skip to content
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

Closed
wants to merge 7 commits into from
Closed

Fix Go Testing Pipeline #142

wants to merge 7 commits into from

Conversation

rappm
Copy link
Contributor

@rappm rappm commented Feb 3, 2025

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 the go test command to include the -race flag for detecting possible race conditions
  • .github/workflows/go-tests.yml: Changed the trigger from pull_request to workflow_call to allow the workflow to be able to call it from the dev workflow
  • .github/workflows/dev.yml: Added a new test-server job that uses the go-tests.yml workflow and set the build-and-push-server job to depend on the test-server job

@rappm rappm linked an issue Feb 3, 2025 that may be closed by this pull request
@rappm rappm changed the title adapt go tests to check for possible race conditions Fix Go Testing Pipeline Feb 3, 2025
@rappm rappm marked this pull request as draft February 3, 2025 11:22
@rappm rappm marked this pull request as ready for review February 3, 2025 15:07
@@ -5,7 +5,10 @@ on:
branches: [main]

jobs:
test-server:
uses: ./.github/workflows/go-tests.yml
Copy link
Contributor

@niclasheun niclasheun Feb 3, 2025

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
Copy link
Contributor

@niclasheun niclasheun Feb 3, 2025

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

@niclasheun niclasheun closed this Feb 7, 2025
@niclasheun niclasheun deleted the 43-fix-testing-pipeline branch February 7, 2025 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Fix Testing Pipeline
2 participants