summaryrefslogtreecommitdiff
path: root/integrationtests/commandutils.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-25 22:08:34 +0300
committerPaul Buetow <paul@buetow.org>2025-06-25 22:08:34 +0300
commit146ec97a51c1ab7ca96795310de80a0045db2699 (patch)
tree67675b8f4975844744dc24bbcaaebc1c4c1caa9b /integrationtests/commandutils.go
parent07a1147a7291938d2433efda5ecb2855cd1e3f18 (diff)
Add comprehensive test logging infrastructure to integration tests
- Add test logging infrastructure to track command execution and file comparisons - Generate .log files for each test with command history and manual verification commands - Ensure all temporary test files use .tmp suffix for consistency - Clean up .tmp files before each test run (not after) for clean test starts - Update .gitignore to exclude generated test artifacts (.log, .query files) - Fix dserver test configurations to use .tmp suffix for output files - Fix expected test outputs for dgrep context tests This change improves test debugging and verification by providing detailed logs of what each test does and allows manual verification of test results. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'integrationtests/commandutils.go')
-rw-r--r--integrationtests/commandutils.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/integrationtests/commandutils.go b/integrationtests/commandutils.go
index 04557b9..763e76f 100644
--- a/integrationtests/commandutils.go
+++ b/integrationtests/commandutils.go
@@ -20,6 +20,11 @@ func runCommand(ctx context.Context, t *testing.T, stdoutFile, cmdStr string,
return 0, fmt.Errorf("no such executable '%s', please compile first: %w", cmdStr, err)
}
+ // Log command execution if logger is available
+ if logger := GetTestLogger(ctx); logger != nil {
+ logger.LogCommand(cmdStr, args)
+ }
+
t.Log("Creating stdout file", stdoutFile)
fd, err := os.Create(stdoutFile)
if err != nil {
@@ -64,6 +69,11 @@ func startCommandWithEnv(ctx context.Context, t *testing.T, inPipeFile,
fmt.Errorf("no such executable '%s', please compile first: %w", cmdStr, err)
}
+ // Log command execution if logger is available
+ if logger := GetTestLogger(ctx); logger != nil {
+ logger.LogCommand(cmdStr, args)
+ }
+
t.Log(cmdStr, strings.Join(args, " "))
cmd := exec.CommandContext(ctx, cmdStr, args...)