Skip to content

Fix flaky tests by adding health check to git daemon#3110

Merged
dheerajodha merged 1 commit into
conforma:mainfrom
st3penta:fix-flaky-acceptance-instruction
Feb 12, 2026
Merged

Fix flaky tests by adding health check to git daemon#3110
dheerajodha merged 1 commit into
conforma:mainfrom
st3penta:fix-flaky-acceptance-instruction

Conversation

@st3penta

Copy link
Copy Markdown
Contributor

Wait for git HTTP backend to be fully ready instead of just checking if the port is listening. This prevents "connection reset by peer" errors when tests try to clone repositories before nginx/FastCGI are initialized.

Wait for git HTTP backend to be fully ready instead of just checking
if the port is listening. This prevents "connection reset by peer"
errors when tests try to clone repositories before nginx/FastCGI are
initialized.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add HTTP health check to git daemon for reliable test startup

🐞 Bug fix 🧪 Tests

Grey Divider

Walkthroughs

Description
• Replace port listening check with HTTP health check endpoint
• Create minimal bare git repository for health verification
• Configure HTTPS health check with TLS and polling parameters
• Prevent "connection reset by peer" errors during test initialization
Diagram
flowchart LR
  A["Port Listening Check"] -->|Replace| B["HTTP Health Check"]
  C["Create health-check.git"] -->|Initialize| D["Bare Git Repository"]
  D -->|Enable| B
  B -->|Configure| E["HTTPS with TLS Settings"]
  E -->|Result| F["Reliable Container Startup"]
Loading

Grey Divider

File Changes

1. acceptance/git/git.go 🐞 Bug fix +19/-1

Implement HTTP health check for git daemon startup

• Added os/exec import for executing git commands
• Created minimal bare git repository at health-check.git before container startup
• Replaced wait.ForListeningPort("443/tcp") with HTTP health check endpoint
• Configured HTTPS health check with TLS, insecure mode, 30-second timeout, and 500ms polling
 interval

acceptance/git/git.go


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (2) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. MkdirAll error lacks context 📘 Rule violation ⛯ Reliability
Description
If creating healthCheckDir fails, the function returns the raw err without describing what
operation/path failed. This reduces actionable context for debugging, violating robust error
handling expectations.
Code

acceptance/git/git.go[R154-156]

+	if err := os.MkdirAll(healthCheckDir, 0755); err != nil {
+		return ctx, err
+	}
Evidence
PR Compliance ID 3 requires error messages to provide actionable context about what failed and why;
the new code returns a bare error from os.MkdirAll without including the target path or operation.

Rule 3: Generic: Robust Error Handling and Edge Case Management
acceptance/git/git.go[152-156]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When `os.MkdirAll(healthCheckDir, 0755)` fails, the function returns the raw error without indicating which directory creation failed. This makes failures harder to diagnose.

## Issue Context
This change is part of test infrastructure, and failures should be immediately actionable with clear context (path + operation).

## Fix Focus Areas
- acceptance/git/git.go[152-156]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. git init loses stderr 📘 Rule violation ⛯ Reliability
Description
If git init --bare fails, the returned error does not include command output, which can hide the
reason for failure. This reduces diagnostic value and weakens error handling for this new setup
step.
Code

acceptance/git/git.go[R159-162]

+	cmd := exec.Command("git", "init", "--bare", healthCheckDir)
+	if err := cmd.Run(); err != nil {
+		return ctx, fmt.Errorf("failed to create health check repository: %w", err)
+	}
Evidence
PR Compliance ID 3 expects errors to include relevant operation context and why it failed; using
cmd.Run() without capturing output can omit the most actionable details from git
(stderr/stdout).

Rule 3: Generic: Robust Error Handling and Edge Case Management
acceptance/git/git.go[158-162]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`exec.Command(...).Run()` discards stdout/stderr. When `git init --bare` fails, the error returned lacks the command output that typically explains the failure.

## Issue Context
This is a new test setup step; failures should include enough context (exit output) to quickly identify missing binary, permissions issues, or invalid repo dir.

## Fix Focus Areas
- acceptance/git/git.go[158-162]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@codecov

codecov Bot commented Feb 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
acceptance 55.48% <ø> (ø)
generative 18.59% <ø> (ø)
integration 27.60% <ø> (ø)
unit 68.35% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dheerajodha

Copy link
Copy Markdown
Contributor

lgtm!

@dheerajodha dheerajodha merged commit 4882c59 into conforma:main Feb 12, 2026
12 checks passed
@st3penta st3penta deleted the fix-flaky-acceptance-instruction branch February 12, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants