diff --git a/.circleci/config.yml b/.circleci/config.yml index 6df04524f..d7ad364d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -71,10 +71,21 @@ jobs: environment: <<: *mysql_env MYSQL_TCP_PORT: 3308 + - image: circleci/postgres:10 + environment: + POSTGRES_DB: test + POSTGRES_PASSWORD: pass + command: -p 5430 + - image: circleci/postgres:11 + environment: + POSTGRES_DB: test + POSTGRES_PASSWORD: pass + command: -p 5431 - image: circleci/postgres:12 environment: POSTGRES_DB: test POSTGRES_PASSWORD: pass + command: -p 5432 - image: entgo/gremlin-server entrypoint: /opt/gremlin-server/bin/gremlin-server.sh command: conf/gremlin-server.yaml @@ -87,6 +98,8 @@ jobs: -wait tcp://localhost:3306 -wait tcp://localhost:3307 -wait tcp://localhost:3308 + -wait tcp://localhost:5430 + -wait tcp://localhost:5431 -wait tcp://localhost:5432 -wait tcp://localhost:8182 - *mktestdir diff --git a/entc/integration/compose/docker-compose.yaml b/entc/integration/compose/docker-compose.yaml index 1fadfcdbd..60494cfb2 100644 --- a/entc/integration/compose/docker-compose.yaml +++ b/entc/integration/compose/docker-compose.yaml @@ -36,6 +36,26 @@ services: ports: - 3308:3306 + postgres10: + image: postgres:10 + environment: + POSTGRES_DB: test + POSTGRES_PASSWORD: pass + healthcheck: + test: pg_isready -U postgres + ports: + - 5430:5432 + + postgres11: + image: postgres:11 + environment: + POSTGRES_DB: test + POSTGRES_PASSWORD: pass + healthcheck: + test: pg_isready -U postgres + ports: + - 5431:5432 + postgres12: image: postgres:12 environment: diff --git a/entc/integration/integration_test.go b/entc/integration/integration_test.go index 99990f07b..69b056669 100644 --- a/entc/integration/integration_test.go +++ b/entc/integration/integration_test.go @@ -71,15 +71,19 @@ func TestMySQL(t *testing.T) { } func TestPostgres(t *testing.T) { - client, err := ent.Open(dialect.Postgres, "host=localhost port=5432 user=postgres dbname=test password=pass sslmode=disable") - require.NoError(t, err) - defer client.Close() - require.NoError(t, client.Schema.Create(context.Background())) - for _, tt := range tests { - name := runtime.FuncForPC(reflect.ValueOf(tt).Pointer()).Name() - t.Run(name[strings.LastIndex(name, ".")+1:], func(t *testing.T) { - drop(t, client) - tt(t, client) + for version, port := range map[string]int{"10": 5430, "11": 5431, "12": 5432} { + t.Run(version, func(t *testing.T) { + client, err := ent.Open(dialect.Postgres, fmt.Sprintf("host=localhost port=%d user=postgres dbname=test password=pass sslmode=disable", port)) + require.NoError(t, err) + defer client.Close() + require.NoError(t, client.Schema.Create(context.Background())) + for _, tt := range tests { + name := runtime.FuncForPC(reflect.ValueOf(tt).Pointer()).Name() + t.Run(name[strings.LastIndex(name, ".")+1:], func(t *testing.T) { + drop(t, client) + tt(t, client) + }) + } }) } }