Skip to content

Comments

Fix CI test failure caused by go test -json piping#12651

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/fix-github-actions-test
Closed

Fix CI test failure caused by go test -json piping#12651
Copilot wants to merge 4 commits intomainfrom
copilot/fix-github-actions-test

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

CI test job was failing with exit code 1 despite all tests passing. The issue: go test -json | tee with set -o pipefail causes intermittent pipeline failures due to JSON output buffering.

Changes

Separated test execution from JSON artifact generation:

Before:

- name: Run unit tests with coverage
  run: |
    set -o pipefail
    go test -v -parallel=8 -timeout=3m -run='^Test' -tags '!integration' -coverprofile=coverage.out -json ./... | tee test-result-unit.json
    go tool cover -html=coverage.out -o coverage.html

After:

- name: Run unit tests with coverage
  run: |
    set -o pipefail
    go test -v -parallel=8 -timeout=3m -run='^Test' -tags '!integration' -coverprofile=coverage.out ./...
    go tool cover -html=coverage.out -o coverage.html

- name: Generate JSON test results  
  if: always()
  run: |
    go test -json -run='^Test' -tags '!integration' ./... > test-result-unit.json 2>&1 || true

Main test command now uses -v (human-readable output) without piping. JSON results generated separately with if: always() to ensure artifact creation regardless of test outcome.

Original prompt

Fix the failing GitHub Actions workflow test
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 61943541516
Job URL: https://github.com/githubnext/gh-aw/actions/runs/21499856490/job/61943541516


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 30, 2026 00:45
Found that test command exits with code 1 even though all tests pass.
Root cause: go test -json output with tee and set -o pipefail can cause failures

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Remove -json flag and tee from main test command
- Run tests with -v for human-readable output
- Generate JSON test results in separate step with if: always()
- This avoids pipeline failures from go test -json | tee interaction

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix the failing GitHub Actions workflow test Fix CI test failure caused by go test -json piping Jan 30, 2026
Copilot AI requested a review from pelikhan January 30, 2026 00:50
@pelikhan pelikhan closed this Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants