Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions coderd/healthcheck/derphealth/derp.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"sync/atomic"
"time"

"golang.org/x/exp/slices"
"golang.org/x/xerrors"
"tailscale.com/derp"
"tailscale.com/derp/derphttp"
Expand All @@ -22,6 +23,7 @@ import (
tslogger "tailscale.com/types/logger"

"github.com/coder/coder/v2/coderd/util/ptr"
"github.com/coder/coder/v2/coderd/util/slice"
)

const (
Expand Down Expand Up @@ -183,6 +185,11 @@ func (r *RegionReport) Run(ctx context.Context) {
}
wg.Wait()

r.mu.Lock()
defer r.mu.Unlock()

sortNodeReports(r.NodeReports)

// Coder allows for 1 unhealthy node in the region, unless there is only 1 node.
if len(r.Region.Nodes) == 1 {
r.Healthy = healthyNodes == len(r.Region.Nodes)
Expand Down Expand Up @@ -492,3 +499,9 @@ func convertError(err error) *string {

return nil
}

func sortNodeReports(reports []*NodeReport) {
slices.SortFunc(reports, func(a, b *NodeReport) int {
return slice.Ascending(a.Node.Name, b.Node.Name)
})
}
1 change: 0 additions & 1 deletion coderd/healthcheck/derphealth/derp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ func TestDERP(t *testing.T) {

t.Run("HealthyWithNodeDegraded", func(t *testing.T) {
t.Parallel()
t.Skip("https://github.com/coder/coder/issues/10824")

healthyDerpSrv := derp.NewServer(key.NewNode(), func(format string, args ...any) { t.Logf(format, args...) })
defer healthyDerpSrv.Close()
Expand Down