summaryrefslogtreecommitdiff
path: root/integrationtests/dserver_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-22 23:51:28 +0300
committerPaul Buetow <paul@buetow.org>2026-07-22 23:51:28 +0300
commitbc2767c87c4090798c4c7d15e101ed066e947301 (patch)
tree0f47a2e0b159a617eb56509bbca1c998196453c4 /integrationtests/dserver_test.go
parent849951be1d1a7ee9f9302006ccb187bf5b4e36f3 (diff)
test: DTail fork — integration test suite and fixtures
Squashed development of the integration test suite (integrationtests/) covering DCat, DGrep, DMap (serverless + server mode), DTail follow, DServer, DTailHealth, journal source reads, auth-key fast reconnect, interactive query reload, client-deadline/timeout behaviour, and the single-mode read/output path. Includes real test fixtures (dserver*.cfg, dmap_csv_multifile_*.csv.in, test_server_*.json, *.expected golden files) and deterministic synchronization helpers (waitContains-style barriers) replacing racy fixed-timing assertions. Accidental debug/output dumps that earlier commits added here (captured client output, strace logs, ad-hoc turbo_test_output/manual_output/test_output files, throwaway debug scripts) are intentionally excluded and gitignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'integrationtests/dserver_test.go')
-rw-r--r--integrationtests/dserver_test.go39
1 files changed, 18 insertions, 21 deletions
diff --git a/integrationtests/dserver_test.go b/integrationtests/dserver_test.go
index eaca23b..663098d 100644
--- a/integrationtests/dserver_test.go
+++ b/integrationtests/dserver_test.go
@@ -17,18 +17,18 @@ func TestDServer1(t *testing.T) {
return
}
// Testing a scheduled query.
+ cleanupTmpFiles(t)
+ testLogger := NewTestLogger("TestDServer1")
+ defer testLogger.WriteLogFile()
- csvFile := "dserver1.csv"
+ csvFile := "dserver1.csv.tmp"
expectedCsvFile := "dserver1.csv.expected"
queryFile := fmt.Sprintf("%s.query", csvFile)
expectedQueryFile := "dserver1.csv.query.expected"
- // In case files still exists from previous test run.
- os.Remove(csvFile)
- os.Remove(queryFile)
-
- ctx, cancel := context.WithCancel(context.Background())
+ baseCtx, cancel := context.WithCancel(context.Background())
defer cancel()
+ ctx := WithTestLogger(baseCtx, testLogger)
stdoutCh, stderrCh, cmdErrCh, err := startCommand(ctx, t,
"", "../dserver",
@@ -46,17 +46,14 @@ func TestDServer1(t *testing.T) {
waitForCommand(ctx, t, stdoutCh, stderrCh, cmdErrCh)
- if err := compareFiles(t, csvFile, expectedCsvFile); err != nil {
+ if err := compareFilesWithContext(ctx, t, csvFile, expectedCsvFile); err != nil {
t.Error(err)
return
}
- if err := compareFiles(t, queryFile, expectedQueryFile); err != nil {
+ if err := compareFilesWithContext(ctx, t, queryFile, expectedQueryFile); err != nil {
t.Error(err)
return
}
-
- os.Remove(csvFile)
- os.Remove(queryFile)
}
func TestDServer2(t *testing.T) {
@@ -66,15 +63,19 @@ func TestDServer2(t *testing.T) {
}
// Testing a continious query.
+ cleanupTmpFiles(t)
+ testLogger := NewTestLogger("TestDServer2")
+ defer testLogger.WriteLogFile()
- inFile := "dserver2.log"
- csvFile := "dserver2.csv"
+ inFile := "dserver2.log.tmp"
+ csvFile := "dserver2.csv.tmp"
expectedCsvFile := "dserver2.csv.expected"
queryFile := fmt.Sprintf("%s.query", csvFile)
expectedQueryFile := "dserver2.csv.query.expected"
- ctx, cancel := context.WithCancel(context.Background())
+ baseCtx, cancel := context.WithCancel(context.Background())
defer cancel()
+ ctx := WithTestLogger(baseCtx, testLogger)
fd, err := os.Create(inFile)
if err != nil {
@@ -114,16 +115,12 @@ func TestDServer2(t *testing.T) {
waitForCommand(ctx, t, stdoutCh, stderrCh, cmdErrCh)
cancel()
- if err := compareFiles(t, csvFile, expectedCsvFile); err != nil {
+ if err := compareFilesWithContext(ctx, t, csvFile, expectedCsvFile); err != nil {
t.Error(err)
return
}
- if err := compareFiles(t, queryFile, expectedQueryFile); err != nil {
+ if err := compareFilesWithContext(ctx, t, queryFile, expectedQueryFile); err != nil {
t.Error(err)
return
}
-
- os.Remove(inFile)
- os.Remove(csvFile)
- os.Remove(queryFile)
-}
+} \ No newline at end of file