summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-24 18:46:50 +0300
committerPaul Buetow <paul@buetow.org>2025-06-24 18:46:50 +0300
commit58f11aa4a174256954f75b7d27ef704fe2f94776 (patch)
tree847abc263418691ad96af139987771abfe99b065
parent480dcf59cff0e2329cee80c456dfe4da2b7d4269 (diff)
Update TestDTailColorTable to run in both serverless and server modes
- 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 <noreply@anthropic.com>
-rw-r--r--integrationtests/dtail_test.go57
1 files changed, 57 insertions, 0 deletions
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)
+}