Skip to content

Commit

Permalink
Add postgres to the ecr mirror and use in code (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
tateexon authored Nov 30, 2023
1 parent 24c9d63 commit 0620fc3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docker/test_env/killgrave.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (k *Killgrave) StartContainer() error {
}

func (k *Killgrave) getContainerRequest() (tc.ContainerRequest, error) {
killgraveImage, err := mirror.GetImage("friendsofgo/killgrave:0.4.1")
killgraveImage, err := mirror.GetImage("friendsofgo/killgrave")
if err != nil {
return tc.ContainerRequest{}, err
}
Expand Down
15 changes: 11 additions & 4 deletions docker/test_env/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io"
"net/url"
"os/exec"
"strings"
"testing"
"time"

Expand All @@ -17,6 +18,7 @@ import (

"github.com/smartcontractkit/chainlink-testing-framework/docker"
"github.com/smartcontractkit/chainlink-testing-framework/logging"
"github.com/smartcontractkit/chainlink-testing-framework/mirror"
"github.com/smartcontractkit/chainlink-testing-framework/utils/testcontext"
)

Expand Down Expand Up @@ -74,12 +76,17 @@ func WithContainerEnv(key, value string) PostgresDbOption {
}
}

func NewPostgresDb(networks []string, opts ...PostgresDbOption) *PostgresDb {
func NewPostgresDb(networks []string, opts ...PostgresDbOption) (*PostgresDb, error) {
image, err := mirror.GetImage("postgres")
if err != nil {
return nil, err
}
parts := strings.Split(image, ":")
pg := &PostgresDb{
EnvComponent: EnvComponent{
ContainerName: fmt.Sprintf("%s-%s", "postgres-db", uuid.NewString()[0:8]),
ContainerImage: "public.ecr.aws/docker/library/postgres",
ContainerVersion: "15.4",
ContainerImage: parts[0],
ContainerVersion: parts[1],
ContainerEnvs: map[string]string{},
Networks: networks,
},
Expand All @@ -99,7 +106,7 @@ func NewPostgresDb(networks []string, opts ...PostgresDbOption) *PostgresDb {
pg.ContainerEnvs["POSTGRES_DB"] = pg.DbName
pg.ContainerEnvs["POSTGRES_PASSWORD"] = pg.Password

return pg
return pg, nil
}

func (pg *PostgresDb) WithTestLogger(t *testing.T) *PostgresDb {
Expand Down
3 changes: 2 additions & 1 deletion mirror/mirror.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"confluentinc/cp-kafka:7.4.0",
"confluentinc/cp-schema-registry:7.4.0",
"confluentinc/cp-zookeeper:7.4.0",
"hyperledger/besu:23.10"
"hyperledger/besu:23.10",
"postgres:15.5"
]

0 comments on commit 0620fc3

Please sign in to comment.