coder / coder/internal

Flaky test: TestTemplateEdit/Autostop/startRequirement/BlockedNotEntitled

Offen
#879 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Keine Sprachdaten
Sterne
3
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## Description

The test `TestTemplateEdit/Autostop/startRequirement/BlockedNotEntitled` is failing consistently across multiple CI runs and platforms (both Linux and macOS runners).

## Test Details

This test verifies that when a user tries to edit template autostop requirements without the proper license entitlement, the operation should fail with a "license is not entitled" error.

The test:
1. Creates a proxy server that returns entitlements without the advanced scheduling feature
2. Attempts to set autostop requirements via the CLI
3. Expects the operation to fail with a license error

## Failure Evidence

- Failed on PR coder/coder#19238 (fix/template-patch-preserve-fields)
- Failed on multiple runners: `test-go-race-pg`, `test-go-pg-17`, `test-go-pg (macos-latest)`
- Error appears to be consistent across different platforms

## Potential Causes

1. **Race condition**: The entitlements check might happen before the proxy server is fully set up
2. **Timing issue**: The client configuration with the proxy might not be properly established
3. **Test isolation**: The test might be affected by other parallel tests

## Suggested Investigation

1. Add more logging to understand the exact failure mode
2. Check if the proxy server is properly intercepting the entitlements request
3. Verify the client is correctly configured to use the proxy
4. Consider adding retry logic or better synchronization in the test setup

## Impact

This flaky test is blocking CI and preventing legitimate changes from being merged. The test failure appears to be unrelated to the actual code changes being tested.

## Related Files

- `/cli/templateedit_test.go` (lines ~338-450)
- `/cli/templateedit.go` (entitlements check logic)

cc: @coder/backend

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit dem Fall TestTemplateEdit/Autostop/startRequirement/BlockedNotEntitled in /cli/templateedit_test.go und untersuche anschließend die Entitlements-Prüfung in /cli/templateedit.go. Reproduziere ihn in den aufgeführten Linux- und macOS-CI-Umgebungen und überprüfe, ob die Proxy-Einrichtung und die Client-Konfiguration vor der Anfrage bereit sind. Die Aufgabe ist erledigt, wenn der Test zuverlässig den erwarteten Fehler "license is not entitled" feststellt, ohne nicht verwandte Änderungen zu blockieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
go
Bereich
testing-qa
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.