Use better defaults and naming for postgres database (#659)

This commit is contained in:
Egon Elbre 2018-11-15 20:36:57 +02:00 committed by GitHub
parent 0357e61bbd
commit c4b90f84dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 14 deletions

View File

@ -16,7 +16,7 @@ before_script:
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6';
sudo sh -c 'echo "\n::1 localhost\n" >> /etc/hosts';
psql -c 'create database pointerdb' -U postgres;
psql -c 'create database teststorj' -U postgres;
fi;
before_install:
@ -28,7 +28,7 @@ matrix:
### tests ###
- env:
- MODE=tests
- STORJ_POSTGRESKV_TEST=postgres://postgres@localhost/pointerdb?sslmode=disable
- STORJ_POSTGRES_TEST=postgres://postgres@localhost/teststorj?sslmode=disable
services:
- redis
- postgresql

View File

@ -76,7 +76,7 @@ var (
}
defaultConfDir = "$HOME/.storj/satellite"
defaultDiagDir = "postgres://postgres@localhost/pointerdb?sslmode=disable"
defaultDiagDir = "postgres://postgres@localhost/storj?sslmode=disable"
)
func init() {

View File

@ -6,14 +6,14 @@ services:
dockerfile: test/Dockerfile
network_mode: service:test-redis
depends_on:
- test-postgres-pointerdb
- test-postgres
test-redis:
image: redis
test-postgres-pointerdb:
test-postgres:
image: postgres
environment:
- POSTGRES_USER=pointerdb
- POSTGRES_PASSWORD=pg-secret-pass
- POSTGRES_USER=storj
- POSTGRES_PASSWORD=storj-pass
storagenode:
image: storjlabs/storagenode:${VERSION}

View File

@ -41,9 +41,9 @@ func TestCreate_Sqlite(t *testing.T) {
}
// this connstring is expected to work under the storj-test docker-compose instance
const defaultPostgresConn = "postgres://pointerdb:pg-secret-pass@test-postgres-pointerdb/pointerdb?sslmode=disable"
const defaultPostgresConn = "postgres://storj:storj-pass@test-postgres/teststorj?sslmode=disable"
var testPostgres = flag.String("postgres-test-db", os.Getenv("STORJ_POSTGRESKV_TEST"), "PostgreSQL test database connection string")
var testPostgres = flag.String("postgres-test-db", os.Getenv("STORJ_POSTGRES_TEST"), "PostgreSQL test database connection string")
func TestCreate_Postgres(t *testing.T) {
if *testPostgres == "" {

View File

@ -9,6 +9,7 @@ import (
"go.uber.org/zap"
monkit "gopkg.in/spacemonkeygo/monkit.v2"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/provider"
)
@ -20,7 +21,7 @@ var (
// Config is a configuration struct that is everything you need to start an
// agreement receiver responsibility
type Config struct {
DatabaseURL string `help:"the database connection string to use" default:"postgres://postgres@localhost/pointerdb?sslmode=disable"`
DatabaseURL string `help:"the database connection string to use" default:"postgres://postgres@localhost/storj?sslmode=disable"`
DatabaseDriver string `help:"the database driver to use" default:"postgres"`
}

View File

@ -96,12 +96,12 @@ func NewTestServer(t *testing.T) *TestServer {
const (
// this connstring is expected to work under the storj-test docker-compose instance
defaultPostgresConn = "postgres://pointerdb:pg-secret-pass@test-postgres-pointerdb/pointerdb?sslmode=disable"
defaultPostgresConn = "postgres://storj:storj-pass@test-postgres/teststorj?sslmode=disable"
)
var (
// for travis build support
testPostgres = flag.String("postgres-test-db", os.Getenv("STORJ_POSTGRESKV_TEST"), "PostgreSQL test database connection string")
testPostgres = flag.String("postgres-test-db", os.Getenv("STORJ_POSTGRES_TEST"), "PostgreSQL test database connection string")
)
func newTestServerStruct(t *testing.T) *Server {

View File

@ -21,11 +21,11 @@ import (
const (
// this connstring is expected to work under the storj-test docker-compose instance
defaultPostgresConn = "postgres://pointerdb:pg-secret-pass@test-postgres-pointerdb/pointerdb?sslmode=disable"
defaultPostgresConn = "postgres://storj:storj-pass@test-postgres/teststorj?sslmode=disable"
)
var (
testPostgres = flag.String("postgres-test-db", os.Getenv("STORJ_POSTGRESKV_TEST"), "PostgreSQL test database connection string")
testPostgres = flag.String("postgres-test-db", os.Getenv("STORJ_POSTGRES_TEST"), "PostgreSQL test database connection string")
)
func newTestPostgres(t testing.TB) (store *Client, cleanup func()) {