Skip to content

Commit 1aef3e8

Browse files
committed
health: fix TestHealthMetric to pass on release branch
Fixes tailscale#14302 Change-Id: I9fd893a97711c72b713fe5535f2ccb93fadf7452 Signed-off-by: Brad Fitzpatrick <[email protected]> (cherry picked from commit dc67287)
1 parent 2690b47 commit 1aef3e8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

health/health_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"tailscale.com/tailcfg"
1515
"tailscale.com/types/opt"
1616
"tailscale.com/util/usermetric"
17+
"tailscale.com/version"
1718
)
1819

1920
func TestAppendWarnableDebugFlags(t *testing.T) {
@@ -352,6 +353,11 @@ func TestShowUpdateWarnable(t *testing.T) {
352353
}
353354

354355
func TestHealthMetric(t *testing.T) {
356+
unstableBuildWarning := 0
357+
if version.IsUnstableBuild() {
358+
unstableBuildWarning = 1
359+
}
360+
355361
tests := []struct {
356362
desc string
357363
check bool
@@ -361,20 +367,20 @@ func TestHealthMetric(t *testing.T) {
361367
}{
362368
// When running in dev, and not initialising the client, there will be two warnings
363369
// by default:
364-
// - is-using-unstable-version
370+
// - is-using-unstable-version (except on the release branch)
365371
// - wantrunning-false
366372
{
367373
desc: "base-warnings",
368374
check: true,
369375
cv: nil,
370-
wantMetricCount: 2,
376+
wantMetricCount: unstableBuildWarning + 1,
371377
},
372378
// with: update-available
373379
{
374380
desc: "update-warning",
375381
check: true,
376382
cv: &tailcfg.ClientVersion{RunningLatest: false, LatestVersion: "1.2.3"},
377-
wantMetricCount: 3,
383+
wantMetricCount: unstableBuildWarning + 2,
378384
},
379385
}
380386
for _, tt := range tests {

0 commit comments

Comments
 (0)