Skip to content

flake: TestAgent_Metrics_SSH #921

@blink-so

Description

@blink-so

Test failure: TestAgent_Metrics_SSH in agent/agent_test.go

Failing commit: dd867bd7434e57ce7e5cb8a51fd0a60fc66028ec

CI run: https://github.com/coder/coder/actions/runs/17098629918

Error:

agent_test.go:3573: 
    Error Trace:	/Users/runner/work/coder/coder/agent/agent_test.go:3573
    Error:      	"0" is not greater than or equal to "1"
    Test:       	TestAgent_Metrics_SSH
    Messages:   	expected coderd_agentstats_currently_reachable_peers to be greater than or equal to 0.000000, got 1.000000

Root cause: The assertion logic is backwards. The test expects the metric coderd_agentstats_currently_reachable_peers to have a value ≥ 0, but it got 1, which should actually pass.

The issue is in line 3573 of agent/agent_test.go:

assert.GreaterOrEqualf(t, expected[i].Value, m.GetGauge().GetValue(), ...)

This should be:

assert.GreaterOrEqualf(t, m.GetGauge().GetValue(), expected[i].Value, ...)

The assertion is checking if expected[i].Value (0) is ≥ m.GetGauge().GetValue() (1), when it should be checking if the actual value (1) is ≥ the expected minimum (0).

Platform: macOS (depot-h8xftq2xzk)

Related: This metric was introduced in PR #14612

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions