Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Assert the shared job budget as a bound

502119f46893fb21e5c6c5b1d8dc563c31862057 · Keenan Nemetz · 17d ago · parent ea6ce9fe

Assert the shared job budget as a bound

The job-budget test expected the timeout message to say exactly 300ms,
but the limit is the budget left when the step starts. CI load can take
a few milliseconds, so the message said 293ms. Accept any positive
remaining value no greater than the budget.

cmd/vole/workflowrun_test.go +13−2

@@ -7,8 +7,10 @@ import (
7 7 "os"
8 8 "os/exec"
9 9 "path/filepath"
10 "regexp"
10 11 "strings"
11 12 "testing"
13 "time"
12 14 )
13 15
14 16 func writeWorkflowFile(t *testing.T, root, name, body string) {
@@ -447,8 +449,17 @@ jobs:
447 449 if !errors.As(err, &ec) || ec.ExitCode() != 1 {
448 450 t.Fatalf("error = %v, want exit status 1", err)
449 451 }
450 if !strings.Contains(stderr, "timed out after 300ms") {
451 t.Fatalf("output does not mention the job budget:\n%s", stderr)
452 // The step gets what is left of the job budget, not exactly the budget: CI
453 // load can consume a few milliseconds before the limit is computed. Checking
454 // the bound rather than the exact string keeps the assertion about the budget.
455 m := regexp.MustCompile(`step "wait" timed out after ([0-9.]+(?:ns|us|µs|ms|s|m|h))`).
456 FindStringSubmatch(stderr)
457 if m == nil {
458 t.Fatalf("output does not report the step timeout:\n%s", stderr)
459 }
460 limit, parseErr := time.ParseDuration(m[1])
461 if parseErr != nil || limit <= 0 || limit > 300*time.Millisecond {
462 t.Fatalf("step timeout = %q, want the job's remaining 300ms budget:\n%s", m[1], stderr)
452 463 }
453 464 }
454 465