Skip to content

Commit c273f26

Browse files
committed
Fixed SQLREPLTestSuite
Signed-off-by: Lou Marvin Caraig <[email protected]>
1 parent e355f5c commit c273f26

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

cmdtests/sql_test.go

+2-21
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import (
1717

1818
"github.com/kr/pty"
1919
"github.com/src-d/engine/cmdtests"
20-
"github.com/src-d/engine/components"
21-
"github.com/src-d/engine/docker"
2220
"github.com/stretchr/testify/assert"
2321
"github.com/stretchr/testify/require"
2422
"github.com/stretchr/testify/suite"
@@ -92,7 +90,6 @@ func (s *SQLREPLTestSuite) TestInteractiveREPL() {
9290
require.Contains(res, showRepoTableDescOutput)
9391

9492
require.NoError(s.exitInteractiveAndWait(10*time.Second, in, out))
95-
require.NoError(s.waitMysqlCliContainerStopped(10, 1*time.Second))
9693

9794
command.Wait()
9895
}
@@ -116,8 +113,9 @@ func (s *SQLREPLTestSuite) runInteractiveRepl() (*exec.Cmd, io.Writer, <-chan st
116113

117114
linifier := cmdtests.NewStreamLinifier(1 * time.Second)
118115
out := linifier.Linify(ch)
116+
119117
for s := range out {
120-
if strings.HasPrefix(s, "mysql>") {
118+
if strings.Contains(s, "MySQL [(none)]>") {
121119
return command, in, out, nil
122120
}
123121
}
@@ -164,23 +162,6 @@ func (s *SQLREPLTestSuite) exitInteractiveAndWait(timeout time.Duration, in io.W
164162
}
165163
}
166164

167-
func (s *SQLREPLTestSuite) waitMysqlCliContainerStopped(retries int, retryTimeout time.Duration) error {
168-
for i := 0; i < retries; i++ {
169-
running, err := docker.IsRunning(components.MysqlCli.Name, "")
170-
if !running {
171-
return nil
172-
}
173-
174-
if err != nil {
175-
return err
176-
}
177-
178-
time.Sleep(retryTimeout)
179-
}
180-
181-
return fmt.Errorf("maximum number of retries (%d) reached while waiting to stop container", retries)
182-
}
183-
184165
// containsSQLOutput returns `true` if the given string is a SQL output table.
185166
// To detect whether the `out` is a SQL output table, this checks that there
186167
// are exactly 3 separators matching this regex ``\+-+\+`.

0 commit comments

Comments
 (0)