mirror of
https://github.com/coder/coder.git
synced 2026-09-21 12:44:32 +08:00
test: disable direct connections for a deterministic reachable peers metric (#19458)
closes https://github.com/coder/internal/issues/921 Not sure what I was thinking when I wrote this test case, but it was relying on the connection being p2p on every ping, which is technically and evidently not always the case. Instead we'll require a DERP peer, and block direct connections.
This commit is contained in:
+7
-3
@@ -3470,7 +3470,11 @@ func TestAgent_Metrics_SSH(t *testing.T) {
|
||||
registry := prometheus.NewRegistry()
|
||||
|
||||
//nolint:dogsled
|
||||
conn, _, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0, func(_ *agenttest.Client, o *agent.Options) {
|
||||
conn, _, _, _, _ := setupAgent(t, agentsdk.Manifest{
|
||||
// Make sure we always get a DERP connection for
|
||||
// currently_reachable_peers.
|
||||
DisableDirectConnections: true,
|
||||
}, 0, func(_ *agenttest.Client, o *agent.Options) {
|
||||
o.PrometheusRegistry = registry
|
||||
})
|
||||
|
||||
@@ -3524,7 +3528,7 @@ func TestAgent_Metrics_SSH(t *testing.T) {
|
||||
{
|
||||
Name: "coderd_agentstats_currently_reachable_peers",
|
||||
Type: proto.Stats_Metric_GAUGE,
|
||||
Value: 0,
|
||||
Value: 1,
|
||||
Labels: []*proto.Stats_Metric_Label{
|
||||
{
|
||||
Name: "connection_type",
|
||||
@@ -3535,7 +3539,7 @@ func TestAgent_Metrics_SSH(t *testing.T) {
|
||||
{
|
||||
Name: "coderd_agentstats_currently_reachable_peers",
|
||||
Type: proto.Stats_Metric_GAUGE,
|
||||
Value: 1,
|
||||
Value: 0,
|
||||
Labels: []*proto.Stats_Metric_Label{
|
||||
{
|
||||
Name: "connection_type",
|
||||
|
||||
Reference in New Issue
Block a user