mirror of
https://github.com/boshu2/agentops.git
synced 2026-09-14 15:08:13 +08:00
test(goals): stabilize skipped timeout cases
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user