coder / coder/internal

Flaky test: TestTemplateEdit/Autostop/startRequirement/BlockedNotEntitled

Open
#879 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.