Skip to content

Commit

Permalink
more iterations in tests for connectWithWait, "no port 9000/tcp for c…
Browse files Browse the repository at this point in the history
…ontainer projectX-clickhouse-1"

Signed-off-by: Slach <[email protected]>
  • Loading branch information
Slach committed Nov 4, 2024
1 parent 587cf1e commit e039c60
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3102,11 +3102,16 @@ func (env *TestEnvironment) connect(timeOut string) error {
time.Sleep(1 * time.Second)
}
env.ch = &clickhouse.ClickHouse{Config: &config.ClickHouseConfig{}}
for i := 0; i < 3; i++ {
portMaxTry := 3
for i := 1; i <= portMaxTry; i++ {
portOut, portErr := utils.ExecCmdOut(context.Background(), 10*time.Second, "docker", append(env.GetDefaultComposeCommand(), "port", "clickhouse", "9000")...)
if portErr != nil {
log.Error().Msg(portOut)
log.Fatal().Msgf("%s can't get port for clickhouse: %v", env.ProjectName, portErr)
if i == portMaxTry {
log.Fatal().Msgf("%s can't get port for clickhouse: %v", env.ProjectName, portErr)
}
time.Sleep(500 * time.Millisecond)
continue
}
hostAndPort := strings.Split(strings.Trim(portOut, " \r\n\t"), ":")
if len(hostAndPort) < 1 {
Expand All @@ -3125,7 +3130,7 @@ func (env *TestEnvironment) connect(timeOut string) error {
return nil
}

if i == 2 {
if i == portMaxTry {
return err
}
time.Sleep(500 * time.Millisecond)
Expand Down

0 comments on commit e039c60

Please sign in to comment.