From a962840853a27b9a4d04c5f3734fb50ddf9bfd83 Mon Sep 17 00:00:00 2001 From: Albert Callarisa Date: Fri, 6 Mar 2026 10:11:59 +0100 Subject: [PATCH 1/5] fix flaky standalone e2e by dropping "Exited App successfully" requirement Signed-off-by: Albert Callarisa --- tests/e2e/standalone/utils.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/e2e/standalone/utils.go b/tests/e2e/standalone/utils.go index 4eff6287b..477e7e1b0 100644 --- a/tests/e2e/standalone/utils.go +++ b/tests/e2e/standalone/utils.go @@ -117,21 +117,17 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) { } err := cmd.Wait() - hasAppCommand := !strings.Contains(daprOutput, "WARNING: no application command found") if err != nil { var exitErr *exec.ExitError if errors.As(err, &exitErr) && exitErr.ExitCode() == 1 && strings.Contains(daprOutput, "Exited Dapr successfully") && - (!hasAppCommand || strings.Contains(daprOutput, "Exited App successfully")) { + !strings.Contains(daprOutput, "The App process exited with error code: exit status") { err = nil } } require.NoError(t, err, "dapr didn't exit cleanly") assert.NotContains(t, daprOutput, "The App process exited with error code: exit status", "Stop command should have been called before the app had a chance to exit") assert.Contains(t, daprOutput, "Exited Dapr successfully") - if hasAppCommand { - assert.Contains(t, daprOutput, "Exited App successfully") - } } // ensureDaprInstallation ensures that Dapr is installed. From 00c8155d5e3f6495a68b9b5661e26ccfed3ebdd8 Mon Sep 17 00:00:00 2001 From: Albert Callarisa Date: Fri, 6 Mar 2026 12:35:02 +0100 Subject: [PATCH 2/5] consume stderr in e2e tests Signed-off-by: Albert Callarisa --- tests/e2e/standalone/utils.go | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/e2e/standalone/utils.go b/tests/e2e/standalone/utils.go index 477e7e1b0..32b4623d0 100644 --- a/tests/e2e/standalone/utils.go +++ b/tests/e2e/standalone/utils.go @@ -23,6 +23,7 @@ import ( "path/filepath" "runtime" "strings" + "sync" "testing" "github.com/stretchr/testify/assert" @@ -101,11 +102,25 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) { daprPath := common.GetDaprPath() cmd := exec.Command(daprPath, daprArgs...) - reader, _ := cmd.StdoutPipe() - scanner := bufio.NewScanner(reader) + stdoutReader, _ := cmd.StdoutPipe() + stderrReader, _ := cmd.StderrPipe() + scanner := bufio.NewScanner(stdoutReader) cmd.Start() + var wg sync.WaitGroup + var stderrOutput strings.Builder + wg.Add(1) + go func() { + defer wg.Done() + stderrScanner := bufio.NewScanner(stderrReader) + for stderrScanner.Scan() { + line := stderrScanner.Text() + t.Log(line) + stderrOutput.WriteString(line) + } + }() + daprOutput := "" for scanner.Scan() { outputChunk := scanner.Text() @@ -116,17 +131,20 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) { daprOutput += outputChunk } + wg.Wait() + daprOutput += stderrOutput.String() + err := cmd.Wait() if err != nil { var exitErr *exec.ExitError if errors.As(err, &exitErr) && exitErr.ExitCode() == 1 && strings.Contains(daprOutput, "Exited Dapr successfully") && - !strings.Contains(daprOutput, "The App process exited with error code: exit status") { + !strings.Contains(daprOutput, "The App process exited with error") { err = nil } } require.NoError(t, err, "dapr didn't exit cleanly") - assert.NotContains(t, daprOutput, "The App process exited with error code: exit status", "Stop command should have been called before the app had a chance to exit") + assert.NotContains(t, daprOutput, "The App process exited with error", "Stop command should have been called before the app had a chance to exit") assert.Contains(t, daprOutput, "Exited Dapr successfully") } From 6a053d3ad3772349f25fe20885110141f1dc65be Mon Sep 17 00:00:00 2001 From: Albert Callarisa Date: Fri, 6 Mar 2026 13:40:42 +0100 Subject: [PATCH 3/5] Address copilot comments Signed-off-by: Albert Callarisa --- tests/e2e/standalone/utils.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/e2e/standalone/utils.go b/tests/e2e/standalone/utils.go index 32b4623d0..dd838acff 100644 --- a/tests/e2e/standalone/utils.go +++ b/tests/e2e/standalone/utils.go @@ -102,11 +102,14 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) { daprPath := common.GetDaprPath() cmd := exec.Command(daprPath, daprArgs...) - stdoutReader, _ := cmd.StdoutPipe() - stderrReader, _ := cmd.StderrPipe() + stdoutReader, err := cmd.StdoutPipe() + require.NoError(t, err, "failed to get stdout pipe for dapr") + stderrReader, err := cmd.StderrPipe() + require.NoError(t, err, "failed to get stderr pipe for dapr") scanner := bufio.NewScanner(stdoutReader) - cmd.Start() + err = cmd.Start() + require.NoError(t, err, "failed to start dapr") var wg sync.WaitGroup var stderrOutput strings.Builder @@ -119,8 +122,16 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) { t.Log(line) stderrOutput.WriteString(line) } + if err := stderrScanner.Err(); err != nil { + t.Errorf("error while reading dapr stderr: %v", err) + } }() + t.Cleanup(func() { + cmd.Process.Kill() //nolint:errcheck + wg.Wait() + }) + daprOutput := "" for scanner.Scan() { outputChunk := scanner.Text() @@ -134,7 +145,7 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) { wg.Wait() daprOutput += stderrOutput.String() - err := cmd.Wait() + err = cmd.Wait() if err != nil { var exitErr *exec.ExitError if errors.As(err, &exitErr) && exitErr.ExitCode() == 1 && From ef804ff7b80bc5c24fad51b7f6d27af007a3b988 Mon Sep 17 00:00:00 2001 From: Albert Callarisa Date: Fri, 6 Mar 2026 13:48:55 +0100 Subject: [PATCH 4/5] Address copilot comments Signed-off-by: Albert Callarisa --- tests/e2e/standalone/utils.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/e2e/standalone/utils.go b/tests/e2e/standalone/utils.go index dd838acff..cc0a6f684 100644 --- a/tests/e2e/standalone/utils.go +++ b/tests/e2e/standalone/utils.go @@ -120,7 +120,7 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) { for stderrScanner.Scan() { line := stderrScanner.Text() t.Log(line) - stderrOutput.WriteString(line) + stderrOutput.WriteString(line + "\n") } if err := stderrScanner.Err(); err != nil { t.Errorf("error while reading dapr stderr: %v", err) @@ -128,7 +128,10 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) { }() t.Cleanup(func() { - cmd.Process.Kill() //nolint:errcheck + if cmd.Process != nil { + _ = cmd.Process.Kill() + _ = cmd.Wait() + } wg.Wait() }) @@ -139,7 +142,7 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) { if strings.Contains(outputChunk, "You're up and running!") { f() } - daprOutput += outputChunk + daprOutput += outputChunk + "\n" } wg.Wait() From 946f49f8dde871315c823dfeb8ca68ed8a7ef02c Mon Sep 17 00:00:00 2001 From: Albert Callarisa Date: Fri, 6 Mar 2026 13:56:38 +0100 Subject: [PATCH 5/5] Address copilot comments Signed-off-by: Albert Callarisa --- tests/e2e/standalone/utils.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/e2e/standalone/utils.go b/tests/e2e/standalone/utils.go index cc0a6f684..4f57615fd 100644 --- a/tests/e2e/standalone/utils.go +++ b/tests/e2e/standalone/utils.go @@ -144,6 +144,9 @@ func executeAgainstRunningDapr(t *testing.T, f func(), daprArgs ...string) { } daprOutput += outputChunk + "\n" } + if err := scanner.Err(); err != nil { + t.Errorf("error while reading dapr stdout: %v", err) + } wg.Wait() daprOutput += stderrOutput.String()