entc/integration: add postgress 10,11 for test cases

Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/131

Reviewed By: alexsn

Differential Revision: D18199300

fbshipit-source-id: 2335f81ba67055934dddae22ec02f1bfb43162d0
This commit is contained in:
Ariel Mashraki
2019-10-29 03:30:02 -07:00
committed by Facebook Github Bot
parent c259aee24b
commit 440a737d73
3 changed files with 46 additions and 9 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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)
})
}
})
}
}