Get DB config from env.
This commit is contained in:
parent
20c04a98bc
commit
fcd2b963b0
2
.github/workflows/on-pr.yaml
vendored
2
.github/workflows/on-pr.yaml
vendored
@ -32,7 +32,7 @@ jobs:
|
||||
- name: Test
|
||||
run: |
|
||||
sleep 10
|
||||
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 make test
|
||||
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing make test
|
||||
|
||||
integrationtest:
|
||||
name: Run integration tests
|
||||
|
@ -19,6 +19,7 @@ package eth_test
|
||||
import (
|
||||
"context"
|
||||
"math/big"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
@ -184,12 +185,13 @@ var (
|
||||
|
||||
// SetupDB is use to setup a db for watcher tests
|
||||
func SetupDB() (*postgres.DB, error) {
|
||||
port, _ := strconv.Atoi(os.Getenv("DATABASE_PORT"))
|
||||
uri := postgres.DbConnectionString(postgres.ConnectionParams{
|
||||
User: "vdbm",
|
||||
Password: "password",
|
||||
Hostname: "localhost",
|
||||
Name: "vulcanize_testing",
|
||||
Port: 8077,
|
||||
User: os.Getenv("DATABASE_USER"),
|
||||
Password: os.Getenv("DATABASE_PASSWORD"),
|
||||
Hostname: os.Getenv("DATABASE_HOSTNAME"),
|
||||
Name: os.Getenv("DATABASE_NAME"),
|
||||
Port: port,
|
||||
})
|
||||
return postgres.NewDB(uri, postgres.ConnectionConfig{}, node.Info{})
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
@ -45,12 +47,13 @@ import (
|
||||
|
||||
// SetupDB is use to setup a db for watcher tests
|
||||
func SetupDB() (*postgres.DB, error) {
|
||||
port, _ := strconv.Atoi(os.Getenv("DATABASE_PORT"))
|
||||
uri := postgres.DbConnectionString(postgres.ConnectionParams{
|
||||
User: "vdbm",
|
||||
Password: "password",
|
||||
Hostname: "localhost",
|
||||
Name: "vulcanize_testing",
|
||||
Port: 8077,
|
||||
User: os.Getenv("DATABASE_USER"),
|
||||
Password: os.Getenv("DATABASE_PASSWORD"),
|
||||
Hostname: os.Getenv("DATABASE_HOSTNAME"),
|
||||
Name: os.Getenv("DATABASE_NAME"),
|
||||
Port: port,
|
||||
})
|
||||
return postgres.NewDB(uri, postgres.ConnectionConfig{}, node.Info{})
|
||||
}
|
||||
|
@ -2,4 +2,4 @@
|
||||
docker-compose down --remove-orphans --volumes
|
||||
|
||||
docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db
|
||||
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 make test
|
||||
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing make test
|
Loading…
Reference in New Issue
Block a user