cog
0177c3a1 - chore: replace Python test harness with Go implementation (#2915)

Commit
126 days ago
chore: replace Python test harness with Go implementation (#2915) * chore: rewrite test harness in go Signed-off-by: Mark Phelps <mphelps@cloudflare.com> * fix: handle file close error and unchecked g.Wait() in test harness * fix: issues with test runner Signed-off-by: Mark Phelps <mphelps@cloudflare.com> * fix: address review findings in test harness - Fix slice mutation via append in ConsoleReport (pre-allocate allTests) - Close file before checksum verification (not deferred) - Use math.Round instead of hand-rolled round() function - Use os.UserHomeDir() with error handling instead of os.Getenv(HOME) - Clean up temp dirs on download failure via deferred cleanup - Move Docker image cleanup defer before g.Wait() in CompareSchema - Validate checksum is 64-char hex SHA256 in parseChecksum - Check f.Close() errors explicitly on all write paths - Replace hand-rolled join/repeat/splitLines with strings stdlib - Extract resolveSetup() helper to deduplicate cmd boilerplate - Validate --output flag is 'console' or 'json' - Sort map keys for deterministic input/env ordering - Move binary download temp dir to ~/.cache/cog-harness/bin/ - Extract setGitHubAuth() helper for DRY token logic - Use local vars in CompareSchema goroutines to avoid concurrent writes - Use filepath.WalkDir + skip symlinks in copyDir - Cleanup() collects and returns errors via errors.Join * fix: address low-severity review findings in test harness - Send checksum success message to stderr for consistent diagnostic output - Check os.MkdirAll error in buildCogFromRef wheel dir creation - Thread context.Context through cloneRepo, extractSchemaLabel, prepareModel - Add tests for extractOutput (7 cases) and report package (round, JSONReport) - Fix double error printing in main.go with SilenceErrors - Include failed model names in error messages for run/build/schema-compare * feat: support setup commands Signed-off-by: Mark Phelps <mphelps@cloudflare.com> * chore: remove go.mod/go.sum files Signed-off-by: Mark Phelps <mphelps@cloudflare.com> --------- Signed-off-by: Mark Phelps <mphelps@cloudflare.com>
Author
Parents
Loading