mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix(agent): retry devcontainer sub-agent rejection test (#25187)
This commit is contained in:
+10
-5
@@ -2829,15 +2829,20 @@ func TestAgent_DevcontainersDisabledForSubAgent(t *testing.T) {
|
||||
o.Devcontainers = true
|
||||
})
|
||||
|
||||
// Query the containers API endpoint. This should fail because
|
||||
// devcontainers have been disabled for the sub agent.
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitMedium)
|
||||
defer cancel()
|
||||
|
||||
_, err := conn.ListContainers(ctx)
|
||||
var err error
|
||||
// setupAgent only waits for tailnet reachability, not for the HTTP API
|
||||
// listener to serve the expected sub-agent rejection response.
|
||||
testutil.Eventually(ctx, t, func(ctx context.Context) bool {
|
||||
_, err = conn.ListContainers(ctx)
|
||||
if err != nil {
|
||||
t.Logf("Error listing containers: %v", err)
|
||||
}
|
||||
return err != nil && strings.Contains(err.Error(), "Dev Container feature not supported.")
|
||||
}, testutil.IntervalFast, "containers endpoint should reject devcontainers inside sub agents")
|
||||
require.Error(t, err)
|
||||
|
||||
// Verify the error message contains the expected text.
|
||||
require.Contains(t, err.Error(), "Dev Container feature not supported.")
|
||||
require.Contains(t, err.Error(), "Dev Container integration inside other Dev Containers is explicitly not supported.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user