fix(e2e): Add debug for flaky bytes up down test (#6572)

* fix(e2e): Increase number of tries in bytes up down test

* test(e2e): Additional debug
This commit is contained in:
Michael Li authored and GitHub committed 2026-04-10 09:19:24 -04:00
1 parent efc6fed502
commit e3f19279c7
2 files changed
+42 -7

No files matched your search

@@ -95,8 +95,18 @@ func TestCliBytesUpDownEmpty(t *testing.T) {
return fmt.Errorf("no connections found in session") return fmt.Errorf("no connections found in session")
} }
bytesUp = int(newSessionReadResult.Item.Connections[0].BytesUp) conn := newSessionReadResult.Item.Connections[0]
bytesDown = int(newSessionReadResult.Item.Connections[0].BytesDown) bytesUp = int(conn.BytesUp)
bytesDown = int(conn.BytesDown)
// Log connection details for debugging rare failures
t.Logf("Connection - bytes_up: %d, bytes_down: %d, closed_reason: %q, client: %s:%d, endpoint: %s:%d, session status: %s",
bytesUp, bytesDown, conn.ClosedReason,
conn.ClientTcpAddress, conn.ClientTcpPort,
conn.EndpointTcpAddress, conn.EndpointTcpPort,
newSessionReadResult.Item.Status,
)
if bytesUp <= 0 || bytesDown <= 0 { if bytesUp <= 0 || bytesDown <= 0 {
return fmt.Errorf( return fmt.Errorf(
"bytes_up: %d, bytes_down: %d, bytes_up or bytes_down is not greater than 0", "bytes_up: %d, bytes_down: %d, bytes_up or bytes_down is not greater than 0",
@@ -108,7 +118,7 @@ func TestCliBytesUpDownEmpty(t *testing.T) {
t.Logf("bytes_up: %d, bytes_down: %d", bytesUp, bytesDown) t.Logf("bytes_up: %d, bytes_down: %d", bytesUp, bytesDown)
return nil return nil
}, },
backoff.WithMaxRetries(backoff.NewConstantBackOff(3*time.Second), 6), backoff.WithMaxRetries(backoff.NewConstantBackOff(3*time.Second), 20),
func(err error, td time.Duration) { func(err error, td time.Duration) {
t.Logf("%s. Retrying...", err.Error()) t.Logf("%s. Retrying...", err.Error())
}, },
@@ -117,7 +127,7 @@ func TestCliBytesUpDownEmpty(t *testing.T) {
// Confirm that bytesUp and bytesDown do not change // Confirm that bytesUp and bytesDown do not change
t.Log("Verifying bytes_up/bytes_down values do not change...") t.Log("Verifying bytes_up/bytes_down values do not change...")
for i := 0; i < 5; i++ { for i := 0; i < 10; i++ {
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
output := e2e.RunCommand(ctx, "boundary", output := e2e.RunCommand(ctx, "boundary",
@@ -99,8 +99,34 @@ func TestCliBytesUpDownTransferData(t *testing.T) {
return fmt.Errorf("no connections found in session") return fmt.Errorf("no connections found in session")
} }
bytesUp = int(newSessionReadResult.Item.Connections[0].BytesUp) conn := newSessionReadResult.Item.Connections[0]
bytesDown = int(newSessionReadResult.Item.Connections[0].BytesDown) bytesUp = int(conn.BytesUp)
bytesDown = int(conn.BytesDown)
// Log connection details for debugging rare failures
t.Logf("Connection - bytes_up: %d, bytes_down: %d, closed_reason: %q, client: %s:%d, endpoint: %s:%d, session status: %s",
bytesUp, bytesDown, conn.ClosedReason,
conn.ClientTcpAddress, conn.ClientTcpPort,
conn.EndpointTcpAddress, conn.EndpointTcpPort,
newSessionReadResult.Item.Status,
)
// Check if the SSH command failed early
select {
case result := <-errChan:
if result.Err != nil {
return backoff.Permanent(fmt.Errorf("SSH command failed, stdout: %s, stderr: %s", string(result.Stdout), string(result.Stderr)))
}
return backoff.Permanent(fmt.Errorf("SSH command completed unexpectedly early, stdout: %s, stderr: %s", string(result.Stdout), string(result.Stderr)))
default:
// Command still running, continue checking bytes
}
// Check if connection was closed prematurely
if conn.ClosedReason != "" {
return backoff.Permanent(fmt.Errorf("connection closed before data transmission: %s", conn.ClosedReason))
}
if bytesUp <= 0 || bytesDown <= 0 { if bytesUp <= 0 || bytesDown <= 0 {
return fmt.Errorf( return fmt.Errorf(
"bytes_up: %d, bytes_down: %d, bytes_up or bytes_down is not greater than 0", "bytes_up: %d, bytes_down: %d, bytes_up or bytes_down is not greater than 0",
@@ -109,7 +135,6 @@ func TestCliBytesUpDownTransferData(t *testing.T) {
) )
} }
t.Logf("bytes_up: %d, bytes_down: %d", bytesUp, bytesDown)
return nil return nil
}, },
backoff.WithMaxRetries(backoff.NewConstantBackOff(3*time.Second), 20), backoff.WithMaxRetries(backoff.NewConstantBackOff(3*time.Second), 20),