test(obs): validate canonical local evidence
- commit
- 99293b64ec44dc23f7585d4e3a7b7474041f38dd
- author
- brice · · 2026-07-13 01:15 UTC
- parent
- 42b3f98
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +60 -0
M cmd/vev-perf-harness/main_test.go +60 -0
| @@ -200,6 +200,66 @@ func TestHarnessCanonicalLocalSmokeRealRoles(t *testing.T) { | |||
| 200 | 200 | } | |
| 201 | 201 | } | |
| 202 | 202 | ||
| 203 | + | func TestHarnessCanonicalLocalRolesAreIsolatedAcrossRepetitions(t *testing.T) { | |
| 204 | + | if testing.Short() { | |
| 205 | + | t.Skip("public CLI repetition lifecycle") | |
| 206 | + | } | |
| 207 | + | root, err := filepath.Abs(filepath.Join("..", "..")) | |
| 208 | + | if err != nil { | |
| 209 | + | t.Fatal(err) | |
| 210 | + | } | |
| 211 | + | bin := filepath.Join(t.TempDir(), "vev") | |
| 212 | + | build := exec.Command("/usr/local/go/bin/go", "build", "-o", bin, "./") | |
| 213 | + | build.Dir = root | |
| 214 | + | if output, err := build.CombinedOutput(); err != nil { | |
| 215 | + | t.Fatalf("build public CLI: %v\n%s", err, output) | |
| 216 | + | } | |
| 217 | + | m, err := readManifest(filepath.Join(root, "testdata", "perf", "manifest.json")) | |
| 218 | + | if err != nil { | |
| 219 | + | t.Fatal(err) | |
| 220 | + | } | |
| 221 | + | var local scenario | |
| 222 | + | for _, candidate := range m.Scenarios { | |
| 223 | + | if candidate.ID == "1x4-idle-local" { | |
| 224 | + | local = candidate | |
| 225 | + | break | |
| 226 | + | } | |
| 227 | + | } | |
| 228 | + | if local.ID == "" { | |
| 229 | + | t.Fatal("canonical local scenario missing") | |
| 230 | + | } | |
| 231 | + | out, err := os.MkdirTemp("", "vev-ob-") | |
| 232 | + | if err != nil { | |
| 233 | + | t.Fatal(err) | |
| 234 | + | } | |
| 235 | + | defer os.RemoveAll(out) | |
| 236 | + | raw, err := os.OpenFile(filepath.Join(out, "raw.jsonl"), os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0o600) | |
| 237 | + | if err != nil { | |
| 238 | + | t.Fatal(err) | |
| 239 | + | } | |
| 240 | + | defer raw.Close() | |
| 241 | + | h := defaultHarness() | |
| 242 | + | h.clock = &fakeClock{} | |
| 243 | + | h.launcher = &cliLauncher{bin: bin} | |
| 244 | + | for run := 1; run <= 3; run++ { | |
| 245 | + | result, err := h.runOne(options{vevBin: bin, out: out, duration: minimumDuration}, m, local, run, raw) | |
| 246 | + | if err != nil { | |
| 247 | + | t.Fatalf("run %d: %v", run, err) | |
| 248 | + | } | |
| 249 | + | if len(result.Processes) != 2 { | |
| 250 | + | t.Fatalf("run %d process mappings = %+v", run, result.Processes) | |
| 251 | + | } | |
| 252 | + | for _, process := range result.Processes { | |
| 253 | + | if process.Role != "daemon" && process.Role != "client" { | |
| 254 | + | t.Fatalf("run %d unexpected role %q", run, process.Role) | |
| 255 | + | } | |
| 256 | + | if _, err := os.Stat(process.TracePath); err != nil { | |
| 257 | + | t.Fatalf("run %d %s trace %q: %v", run, process.Role, process.TracePath, err) | |
| 258 | + | } | |
| 259 | + | } | |
| 260 | + | } | |
| 261 | + | } | |
| 262 | + | ||
| 203 | 263 | func TestHarnessScenarioSelectionKeepsCanonicalManifestValidation(t *testing.T) { | |
| 204 | 264 | root, err := filepath.Abs(filepath.Join("..", "..")) | |
| 205 | 265 | if err != nil { | |
| @@ -200,6 +200,66 @@ func TestHarnessCanonicalLocalSmokeRealRoles(t *testing.T) { | |||||
| 200 | } | 200 | } | ||
| 201 | } | 201 | } | ||
| 202 | 202 | ||||
| 203 | + | func TestHarnessCanonicalLocalRolesAreIsolatedAcrossRepetitions(t *testing.T) { | |||
| 204 | + | if testing.Short() { | |||
| 205 | + | t.Skip("public CLI repetition lifecycle") | |||
| 206 | + | } | |||
| 207 | + | root, err := filepath.Abs(filepath.Join("..", "..")) | |||
| 208 | + | if err != nil { | |||
| 209 | + | t.Fatal(err) | |||
| 210 | + | } | |||
| 211 | + | bin := filepath.Join(t.TempDir(), "vev") | |||
| 212 | + | build := exec.Command("/usr/local/go/bin/go", "build", "-o", bin, "./") | |||
| 213 | + | build.Dir = root | |||
| 214 | + | if output, err := build.CombinedOutput(); err != nil { | |||
| 215 | + | t.Fatalf("build public CLI: %v\n%s", err, output) | |||
| 216 | + | } | |||
| 217 | + | m, err := readManifest(filepath.Join(root, "testdata", "perf", "manifest.json")) | |||
| 218 | + | if err != nil { | |||
| 219 | + | t.Fatal(err) | |||
| 220 | + | } | |||
| 221 | + | var local scenario | |||
| 222 | + | for _, candidate := range m.Scenarios { | |||
| 223 | + | if candidate.ID == "1x4-idle-local" { | |||
| 224 | + | local = candidate | |||
| 225 | + | break | |||
| 226 | + | } | |||
| 227 | + | } | |||
| 228 | + | if local.ID == "" { | |||
| 229 | + | t.Fatal("canonical local scenario missing") | |||
| 230 | + | } | |||
| 231 | + | out, err := os.MkdirTemp("", "vev-ob-") | |||
| 232 | + | if err != nil { | |||
| 233 | + | t.Fatal(err) | |||
| 234 | + | } | |||
| 235 | + | defer os.RemoveAll(out) | |||
| 236 | + | raw, err := os.OpenFile(filepath.Join(out, "raw.jsonl"), os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0o600) | |||
| 237 | + | if err != nil { | |||
| 238 | + | t.Fatal(err) | |||
| 239 | + | } | |||
| 240 | + | defer raw.Close() | |||
| 241 | + | h := defaultHarness() | |||
| 242 | + | h.clock = &fakeClock{} | |||
| 243 | + | h.launcher = &cliLauncher{bin: bin} | |||
| 244 | + | for run := 1; run <= 3; run++ { | |||
| 245 | + | result, err := h.runOne(options{vevBin: bin, out: out, duration: minimumDuration}, m, local, run, raw) | |||
| 246 | + | if err != nil { | |||
| 247 | + | t.Fatalf("run %d: %v", run, err) | |||
| 248 | + | } | |||
| 249 | + | if len(result.Processes) != 2 { | |||
| 250 | + | t.Fatalf("run %d process mappings = %+v", run, result.Processes) | |||
| 251 | + | } | |||
| 252 | + | for _, process := range result.Processes { | |||
| 253 | + | if process.Role != "daemon" && process.Role != "client" { | |||
| 254 | + | t.Fatalf("run %d unexpected role %q", run, process.Role) | |||
| 255 | + | } | |||
| 256 | + | if _, err := os.Stat(process.TracePath); err != nil { | |||
| 257 | + | t.Fatalf("run %d %s trace %q: %v", run, process.Role, process.TracePath, err) | |||
| 258 | + | } | |||
| 259 | + | } | |||
| 260 | + | } | |||
| 261 | + | } | |||
| 262 | + | ||||
| 203 | func TestHarnessScenarioSelectionKeepsCanonicalManifestValidation(t *testing.T) { | 263 | func TestHarnessScenarioSelectionKeepsCanonicalManifestValidation(t *testing.T) { | ||
| 204 | root, err := filepath.Abs(filepath.Join("..", "..")) | 264 | root, err := filepath.Abs(filepath.Join("..", "..")) | ||
| 205 | if err != nil { | 265 | if err != nil { | ||