From bc2767c87c4090798c4c7d15e101ed066e947301 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 22 Jul 2026 23:51:28 +0300 Subject: =?UTF-8?q?test:=20DTail=20fork=20=E2=80=94=20integration=20test?= =?UTF-8?q?=20suite=20and=20fixtures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- integrationtests/dserver_test.go | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'integrationtests/dserver_test.go') 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 -- cgit v1.2.3