Skip to content

Commit

Permalink
Fix the env var name.
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidtw committed Dec 10, 2023
1 parent d75c42c commit 0b62600
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions idock.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (

// CLEANUP_ATTEMPTS_FLAG is the default environment variable that controls
// how many times to retry the cleanup process.
CLEANUP_ATTEMPTS_FLAG = "IDOCK_CLEANUP_RETRIES"
CLEANUP_ATTEMPTS_FLAG = "IDOCK_CLEANUP_ATTEMPTS"
)

var (
Expand Down Expand Up @@ -177,6 +177,7 @@ func (c *IDock) startDocker(ctx context.Context) error {
return err
}

cmd.WaitDelay = c.dockerMaxWait
dockerStart := time.Now()
err = cmd.Start()
if err != nil {
Expand All @@ -185,6 +186,12 @@ func (c *IDock) startDocker(ctx context.Context) error {
c.dockerStarted = true

c.Logf(1, "Waiting for services to start...\n")
err = cmd.Wait()
if err != nil {
c.Logf(0, "docker-compose services failed to start: %s\n", err)
return err
}

err = c.waitForPorts(ctx, c.dockerTCPPorts)
if err != nil {
c.Logf(1, "docker-compose services took too long to start (%s)\n", c.dockerMaxWait)
Expand Down Expand Up @@ -272,6 +279,8 @@ func (c *IDock) waitForPorts(ctx context.Context, ports []int) error {
// root context is done.
if errors.Is(err, errTimedOut) && ctx.Err() == nil {
cancel()
// Give the service a chance to start.
time.Sleep(c.tcpPortMaxWait)
continue
}

Expand Down Expand Up @@ -342,8 +351,8 @@ func dockerCompose(ctx context.Context, useStdout bool, args ...string) (*exec.C
return nil, cmd.Err
}

cmd.Stderr = os.Stderr
if useStdout {
cmd.Stderr = os.Stdout
cmd.Stdout = os.Stdout
}

Expand Down

0 comments on commit 0b62600

Please sign in to comment.