Skip to content

Commit

Permalink
[v14] Fix flaky test TestWithRsync/with_headless_tsh (#33557)
Browse files Browse the repository at this point in the history
* Improve error output for flaky test; Disable ssh agent to fix flaky test.

* Skip TestWithRsync in flaky test detector because the test is too long.
  • Loading branch information
Joerger committed Oct 17, 2023
1 parent 07d22f7 commit 9d17893
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion build.assets/tooling/cmd/difftest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ var (
// TestServer_Authenticate_headless takes about 4-5 seconds to run, so if other tests are changed
// in the same PR that take >1 second total, it may cause the flaky test detector to time out.
"TestServer_Authenticate_headless",

// TestWithRsync takes ~10 seconds to run
"TestWithRsync",
}
)

Expand Down Expand Up @@ -158,7 +161,7 @@ func diff(repoPath string, ref string, changedFiles []string, elapsed time.Durat

// test builds and prints go test flags
func test(repoPath string, ref string, changedFiles []string) {
var dirs = make(StringSet)
dirs := make(StringSet)
methods := make([]string, 0)

dollarSign := "$"
Expand Down
8 changes: 4 additions & 4 deletions tool/tsh/common/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ func TestSSHLoadAllCAs(t *testing.T) {

// TestWithRsync tests that Teleport works with rsync.
func TestWithRsync(t *testing.T) {
disableAgent(t)

_, err := exec.LookPath("rsync")
require.NoError(t, err)

Expand Down Expand Up @@ -478,13 +480,11 @@ func TestWithRsync(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
t.Cleanup(cancel)
cmd := tt.createCmd(ctx, testDir, srcPath, dstPath)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
out, err := cmd.CombinedOutput()
var msg string
var exitErr *exec.ExitError
if errors.As(err, &exitErr) {
msg = fmt.Sprintf("exit code: %d", exitErr.ExitCode())
msg = fmt.Sprintf("exit code: %d\nout: %s", exitErr.ExitCode(), out)
}
require.NoError(t, err, msg)

Expand Down

0 comments on commit 9d17893

Please sign in to comment.