Fix timing in execContainer
This commit is contained in:
@@ -27,7 +27,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -347,7 +346,9 @@ func execContainer(t *testing.T, cli *client.Client, ID string, user string, cmd
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
cli.ContainerExecStart(context.Background(), resp.ID, types.ExecStartCheck{
|
defer hijack.Close()
|
||||||
|
time.Sleep(time.Millisecond * 10)
|
||||||
|
err = cli.ContainerExecStart(context.Background(), resp.ID, types.ExecStartCheck{
|
||||||
Detach: false,
|
Detach: false,
|
||||||
Tty: false,
|
Tty: false,
|
||||||
})
|
})
|
||||||
@@ -376,12 +377,17 @@ func execContainer(t *testing.T, cli *client.Client, ID string, user string, cmd
|
|||||||
|
|
||||||
outputStr = strings.TrimSpace(buf.String())
|
outputStr = strings.TrimSpace(buf.String())
|
||||||
|
|
||||||
// Before we go let's just double check it did actually finish running
|
/* Commented out on 14/06/2018 as it might not be needed after adding
|
||||||
// because sometimes we get a "Exec command already running error"
|
* pause between ContainerExecAttach and ContainerExecStart.
|
||||||
alreadyRunningErr := regexp.MustCompile("Error: Exec command .* is already running")
|
* TODO If intermittent failures do not occur, remove and refactor.
|
||||||
if alreadyRunningErr.MatchString(outputStr) {
|
*
|
||||||
continue
|
* // Before we go let's just double check it did actually finish running
|
||||||
}
|
* // because sometimes we get a "Exec command already running error"
|
||||||
|
* alreadyRunningErr := regexp.MustCompile("Error: Exec command .* is already running")
|
||||||
|
* if alreadyRunningErr.MatchString(outputStr) {
|
||||||
|
* continue
|
||||||
|
* }
|
||||||
|
*/
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user