summaryrefslogtreecommitdiff
path: root/integrationtests/interactive_runtime_query_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integrationtests/interactive_runtime_query_test.go')
-rw-r--r--integrationtests/interactive_runtime_query_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/integrationtests/interactive_runtime_query_test.go b/integrationtests/interactive_runtime_query_test.go
index 213c877..48e2301 100644
--- a/integrationtests/interactive_runtime_query_test.go
+++ b/integrationtests/interactive_runtime_query_test.go
@@ -51,6 +51,10 @@ func TestDTailInteractiveReloadReusesSessionAndDropsLateOldMatches(t *testing.T)
t.Fatalf("start dserver: %v", err)
}
serverLogs := startProcessOutputCollector(ctx, serverStdout, serverStderr)
+ if err := waitForServerReady(ctx, "localhost", port); err != nil {
+ t.Fatalf("wait for dserver: %v", err)
+ }
+ serverLogs.reset()
writerDone := make(chan error, 1)
go func() {
@@ -130,6 +134,10 @@ func TestDGrepInteractiveReloadReusesSessionAfterCompletedRead(t *testing.T) {
t.Fatalf("start dserver: %v", err)
}
serverLogs := startProcessOutputCollector(ctx, serverStdout, serverStderr)
+ if err := waitForServerReady(ctx, "localhost", port); err != nil {
+ t.Fatalf("wait for dserver: %v", err)
+ }
+ serverLogs.reset()
clientOutput, err := runInteractivePTYCommand(ctx, []string{
"../dgrep",
@@ -199,6 +207,12 @@ func (c *processOutputCollector) snapshot() []string {
return out
}
+func (c *processOutputCollector) reset() {
+ c.mu.Lock()
+ defer c.mu.Unlock()
+ c.lines = c.lines[:0]
+}
+
func appendLinesOnSchedule(ctx context.Context, path string, steps []interactiveStep) error {
fd, err := os.OpenFile(path, os.O_WRONLY|os.O_APPEND, 0600)
if err != nil {