Skip to content

Commit

Permalink
multiple images testing
Browse files Browse the repository at this point in the history
  • Loading branch information
art22m committed Jan 16, 2025
1 parent 7edc143 commit 3143ea4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions database/ydb/ydb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (

"github.com/golang-migrate/migrate/v4"
dt "github.com/golang-migrate/migrate/v4/database/testing"
"github.com/golang-migrate/migrate/v4/dktesting"
_ "github.com/golang-migrate/migrate/v4/source/file"
)

const (
image = "ydbplatform/local-ydb:latest"
host = "localhost"
port = "2136"
databaseName = "local"
Expand All @@ -44,6 +44,13 @@ var (
ReadyTimeout: 15 * time.Second,
ReadyFunc: isReady,
}

// Released version: https://ydb.tech/docs/downloads/#ydb-server
specs = []dktesting.ContainerSpec{
{ImageName: "ydbplatform/local-ydb:latest", Options: opts},
{ImageName: "ydbplatform/local-ydb:24.3", Options: opts},
{ImageName: "ydbplatform/local-ydb:24.2", Options: opts},
}
)

func connectionString(options ...string) string {
Expand All @@ -67,7 +74,7 @@ func isReady(ctx context.Context, c dktest.ContainerInfo) bool {
}

func Test(t *testing.T) {
dktest.Run(t, image, opts, func(t *testing.T, c dktest.ContainerInfo) {
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
db := &YDB{}
d, err := db.Open(connectionString())
if err != nil {
Expand All @@ -86,7 +93,7 @@ func Test(t *testing.T) {
}

func TestMigrate(t *testing.T) {
dktest.Run(t, image, opts, func(t *testing.T, c dktest.ContainerInfo) {
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
db := &YDB{}
d, err := db.Open(connectionString())
if err != nil {
Expand Down

0 comments on commit 3143ea4

Please sign in to comment.