test(goals): stabilize skipped timeout cases

This commit is contained in:
Boden Fuller
2026-04-12 03:21:31 -04:00
parent 944fb1e3d6
commit ee2af059c9
3 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -422,11 +422,11 @@ func TestGoalsMeasure_SkippedGoals(t *testing.T) {
Version: 2,
Goals: []goals.Goal{
{ID: "pass-1", Check: "exit 0", Weight: 5, Type: goals.GoalTypeHealth},
{ID: "timeout-1", Check: "sleep 10", Weight: 10, Type: goals.GoalTypeHealth},
{ID: "timeout-1", Check: "sleep 5", Weight: 10, Type: goals.GoalTypeHealth},
},
}
// Very short timeout to force skip
snap := goals.Measure(gf, 50*time.Millisecond)
// Timeout remains shorter than the slow goal without racing shell startup.
snap := goals.Measure(gf, 2*time.Second)
if snap.Summary.Skipped != 1 {
t.Errorf("Skipped = %d, want 1", snap.Summary.Skipped)
+2 -2
View File
@@ -428,10 +428,10 @@ func TestGoalsMeasure_SkippedGoals_Subsystem(t *testing.T) {
Version: 2,
Goals: []goals.Goal{
{ID: "pass-1", Check: "exit 0", Weight: 5, Type: goals.GoalTypeHealth},
{ID: "timeout-1", Check: "sleep 10", Weight: 10, Type: goals.GoalTypeHealth},
{ID: "timeout-1", Check: "sleep 5", Weight: 10, Type: goals.GoalTypeHealth},
},
}
snap := goals.Measure(gf, 50*time.Millisecond)
snap := goals.Measure(gf, 2*time.Second)
if snap.Summary.Skipped != 1 {
t.Errorf("Skipped = %d, want 1", snap.Summary.Skipped)
+2 -2
View File
@@ -208,10 +208,10 @@ func TestMeasure_SkippedGoalsExcludedFromScore(t *testing.T) {
Version: 2,
Goals: []Goal{
{ID: "pass-1", Check: "exit 0", Weight: 5, Type: GoalTypeHealth},
{ID: "skip-1", Check: "sleep 10", Weight: 10, Type: GoalTypeHealth},
{ID: "skip-1", Check: "sleep 5", Weight: 10, Type: GoalTypeHealth},
},
}
snap := Measure(gf, 50*time.Millisecond)
snap := Measure(gf, 2*time.Second)
if snap.Summary.Skipped != 1 {
t.Errorf("Skipped = %d, want 1", snap.Summary.Skipped)
}