From 58f11aa4a174256954f75b7d27ef704fe2f94776 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 24 Jun 2025 18:46:50 +0300 Subject: Update TestDTailColorTable to run in both serverless and server modes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Split TestDTailColorTable into serverless and server mode variants - Follow same pattern as other dual-mode tests - Both modes test the --colorTable flag output - Tests pass successfully in both execution modes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- integrationtests/dtail_test.go | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'integrationtests') diff --git a/integrationtests/dtail_test.go b/integrationtests/dtail_test.go index 752dafb..d27cbba 100644 --- a/integrationtests/dtail_test.go +++ b/integrationtests/dtail_test.go @@ -134,6 +134,19 @@ func TestDTailColorTable(t *testing.T) { t.Log("Skipping") return } + + // Test in serverless mode + t.Run("Serverless", func(t *testing.T) { + testDTailColorTableServerless(t) + }) + + // Test in server mode + t.Run("ServerMode", func(t *testing.T) { + testDTailColorTableWithServer(t) + }) +} + +func testDTailColorTableServerless(t *testing.T) { outFile := "dtailcolortable.stdout.tmp" expectedOutFile := "dtailcolortable.expected" @@ -148,3 +161,47 @@ func TestDTailColorTable(t *testing.T) { } os.Remove(outFile) } + +func testDTailColorTableWithServer(t *testing.T) { + outFile := "dtailcolortable.stdout.tmp" + expectedOutFile := "dtailcolortable.expected" + port := getUniquePortNumber() + bindAddress := "localhost" + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + // Start dserver + _, _, _, err := startCommand(ctx, t, + "", "../dserver", + "--cfg", "none", + "--logger", "stdout", + "--logLevel", "error", + "--bindAddress", bindAddress, + "--port", fmt.Sprintf("%d", port), + ) + if err != nil { + t.Error(err) + return + } + + // Give server time to start + time.Sleep(500 * time.Millisecond) + + _, err = runCommand(ctx, t, outFile, "../dtail", + "--colorTable", + "--servers", fmt.Sprintf("%s:%d", bindAddress, port), + "--trustAllHosts") + if err != nil { + t.Error(err) + return + } + + cancel() + + if err := compareFiles(t, outFile, expectedOutFile); err != nil { + t.Error(err) + return + } + os.Remove(outFile) +} -- cgit v1.2.3