Skip to content

Commit

Permalink
e2e: Don't allocate TTY when executing commands
Browse files Browse the repository at this point in the history
Executing commands on pods allocating TTY may produce
additional, unwanted characters like:
```
\x1b[1;31m2024-12-06T20:33:56.630784Z:
```

We saw this in some CI run like
https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/logs/periodic-ci-openshift-release-master-nightly-4.18-e2e-telco5g-sno-cnftests/1865094117650862080/artifacts/e2e-telco5g-sno-cnftests/telco5g-cnf-tests/artifacts/test_results.html

Avoid allocating TTY in the automated test suite.

Signed-off-by: Andrea Panattoni <[email protected]>
  • Loading branch information
zeeke committed Dec 9, 2024
1 parent 07a7f05 commit c621f29
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions test/util/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,16 @@ func ExecCommand(cs *testclient.ClientSet, pod *corev1.Pod, command ...string) (
Command: command,
Stdout: true,
Stderr: true,
TTY: true,
}, scheme.ParameterCodec)

exec, err := remotecommand.NewSPDYExecutor(cs.Config, "POST", req.URL())
if err != nil {
return buf.String(), errbuf.String(), err
}

err = exec.Stream(remotecommand.StreamOptions{
err = exec.StreamWithContext(context.Background(), remotecommand.StreamOptions{
Stdout: &buf,
Stderr: &errbuf,
Tty: true,
})
if err != nil {
return buf.String(), errbuf.String(), err
Expand Down

0 comments on commit c621f29

Please sign in to comment.