bisakhmondal commented on a change in pull request #1755:
URL: https://github.com/apache/apisix-dashboard/pull/1755#discussion_r611442945
##########
File path: api/test/e2enew/base/base.go
##########
@@ -248,8 +248,9 @@ func CleanAPISIXErrorLog() {
pwd := string(pwdByte)
pwd = strings.Replace(pwd, "\n", "", 1)
pwd = pwd[:strings.Index(pwd, "/e2e")]
- cmd = exec.Command("sudo", "echo", " > ",
pwd+"/docker/apisix_logs/error.log")
- _, err = cmd.CombinedOutput()
+ cmdStr := "echo | sudo tee " + pwd+"/docker/apisix_logs/error.log"
+ cmd = exec.Command("bash", "-c", cmdStr)
+ _, err = cmd.Output()
Review comment:
FYI, earlier the cleanup was not taking place properly by the exec
command and it got prominent during the execution of [this
line](https://github.com/apache/apisix-dashboard/pull/1755/files#diff-fda12d792401cbe1075880088e985ad29db054f11c5cec63b0dd68da1298b454R198).
As for this assertion to be successful, the substring must not be present in
the error.log and for that the cleanup must be done.
Reference:
[ref1](https://askubuntu.com/questions/103643/cannot-echo-hello-x-txt-even-with-sudo)
[ref2](https://stackoverflow.com/a/30329351)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]