Skip to content

Commit

Permalink
fix: 3x shadow database start timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Sep 18, 2023
1 parent b7c58ad commit dbcc233
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/db/diff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func run(p utils.Program, ctx context.Context, schema []string, config pgconn.Co
return err
}
defer utils.DockerRemove(shadow)
if !start.WaitForHealthyService(ctx, shadow, start.HealthTimeout) {
if !start.WaitForHealthyService(ctx, shadow, 3*start.HealthTimeout) {
return start.ErrDatabase
}
if err := MigrateShadowDatabase(ctx, shadow, fsys); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/db/diff/migra.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func DiffDatabase(ctx context.Context, schema []string, config pgconn.Config, w
return "", err
}
defer utils.DockerRemove(shadow)
if !start.WaitForHealthyService(ctx, shadow, start.HealthTimeout) {
if !start.WaitForHealthyService(ctx, shadow, 3*start.HealthTimeout) {
return "", start.ErrDatabase
}
if err := MigrateShadowDatabase(ctx, shadow, fsys, options...); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/db/diff/migra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func TestDiffDatabase(t *testing.T) {
})

t.Run("throws error on health check failure", func(t *testing.T) {
start.HealthTimeout = time.Second
start.HealthTimeout = time.Millisecond
// Setup in-memory fs
fsys := afero.NewMemMapFs()
// Setup mock docker
Expand Down

0 comments on commit dbcc233

Please sign in to comment.