Skip to content

Commit

Permalink
fix(test): support bitbucket pipeline for pgtap tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Jan 12, 2024
1 parent 8e35f09 commit a641cc7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/db/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ func pgProve(ctx context.Context, testFiles []string, config pgconn.Config, opti
}
}()
}
// Use custom network when connecting to local database
networkID := "host"
if utils.IsLoopback(config.Host) && config.Port == uint16(utils.Config.Db.Port) {
config.Host = utils.DbAliases[0]
config.Port = 5432
networkID = utils.NetId
}
// Run pg_prove on volume mount
return utils.DockerRunOnceWithConfig(
ctx,
Expand All @@ -90,7 +97,7 @@ func pgProve(ctx context.Context, testFiles []string, config pgconn.Config, opti
WorkingDir: dstPath,
},
container.HostConfig{
NetworkMode: container.NetworkMode("host"),
NetworkMode: container.NetworkMode(networkID),
Binds: binds,
},
network.NetworkingConfig{},
Expand Down

0 comments on commit a641cc7

Please sign in to comment.