Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit33b42fc

Browse files
test: fix flake in TestAgent_Metrics_SSH (#20450)
Second flake for this test today 😮‍💨.Flake seen here, though I couldn't replicate this locally, some CIexclusive networking issue.https://github.com/coder/coder/actions/runs/18770305895/job/53553517887?pr=20448``` agent_test.go:3619: Error Trace:/home/runner/work/coder/coder/agent/agent_test.go:3619 Error: Received unexpected error: expected 1, got 0.000000: github.com/coder/coder/v2/agent_test.TestAgent_Metrics_SSH.func7 /home/runner/work/coder/coder/agent/agent_test.go:3557 Test: TestAgent_Metrics_SSH Messages: check fn for coderd_agentstats_currently_reachable_peers failed```This value is incremented by a successful ping to the peer from theagent, which is dependent on all the networking code, which I think isdefinitely out of scope of this test for agent metrics. So, we'll justassert that the metrics exist with the correct labels (`derp`, `p2p`)
1 parent86ef3fb commit33b42fc

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

‎agent/agent_test.go‎

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,11 +3462,7 @@ func TestAgent_Metrics_SSH(t *testing.T) {
34623462
registry:=prometheus.NewRegistry()
34633463

34643464
//nolint:dogsled
3465-
conn,_,_,_,_:=setupAgent(t, agentsdk.Manifest{
3466-
// Make sure we always get a DERP connection for
3467-
// currently_reachable_peers.
3468-
DisableDirectConnections:true,
3469-
},0,func(_*agenttest.Client,o*agent.Options) {
3465+
conn,_,_,_,_:=setupAgent(t, agentsdk.Manifest{},0,func(_*agenttest.Client,o*agent.Options) {
34703466
o.PrometheusRegistry=registry
34713467
})
34723468

@@ -3550,11 +3546,11 @@ func TestAgent_Metrics_SSH(t *testing.T) {
35503546
{
35513547
Name:"coderd_agentstats_currently_reachable_peers",
35523548
Type:proto.Stats_Metric_GAUGE,
3553-
CheckFn:func(vfloat64)error {
3554-
ifv==1 {
3555-
returnnil
3556-
}
3557-
returnxerrors.Errorf("expected 1, got %f",v)
3549+
CheckFn:func(float64)error {
3550+
// We can't reliably ping a peer here, and networking is out of
3551+
// scope of this test, so we just test that the metric exists
3552+
// with the correct labels.
3553+
returnnil
35583554
},
35593555
Labels: []*proto.Stats_Metric_Label{
35603556
{
@@ -3566,11 +3562,8 @@ func TestAgent_Metrics_SSH(t *testing.T) {
35663562
{
35673563
Name:"coderd_agentstats_currently_reachable_peers",
35683564
Type:proto.Stats_Metric_GAUGE,
3569-
CheckFn:func(ffloat64)error {
3570-
iff==0 {
3571-
returnnil
3572-
}
3573-
returnxerrors.Errorf("expected 0, got %f",f)
3565+
CheckFn:func(float64)error {
3566+
returnnil
35743567
},
35753568
Labels: []*proto.Stats_Metric_Label{
35763569
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp