Separate example contracts and relax run ID format test

This commit is contained in:
2026-11-26 03:07:43 +00:00
parent fef0530533
commit fed376351f
4 changed files with 57 additions and 29 deletions

View File

@@ -3,7 +3,6 @@ package cli
import (
"os"
"path/filepath"
"regexp"
"strings"
"testing"
"time"
@@ -13,16 +12,12 @@ import (
func TestDefaultRunIDGeneratorProducesUniqueSafeIDs(t *testing.T) {
startedAt := time.Unix(0, 123456789).UTC()
pattern := regexp.MustCompile(`^run-123456789-[0-9a-f]{32}$`)
seen := make(map[string]struct{}, 256)
for i := 0; i < 256; i++ {
runID, err := defaultRunIDGenerator(startedAt)
if err != nil {
t.Fatal(err)
}
if !pattern.MatchString(runID) {
t.Fatalf("run ID %q does not match production format", runID)
}
if err := validateRunID(runID); err != nil {
t.Fatalf("run ID %q is not path-safe: %v", runID, err)
}