Updates post review
* remove StreamCodeAndCodeHash * Makefile: local build target * clean up comments & unused
This commit is contained in:
@@ -31,8 +31,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
pgConfig, _ = postgres.MakeConfig(postgres.TestConfig)
|
||||
ctx = context.Background()
|
||||
pgConfig, _ = postgres.TestConfig.WithEnv()
|
||||
pgxConfig, _ = postgres.MakeConfig(pgConfig)
|
||||
ctx = context.Background()
|
||||
)
|
||||
|
||||
func expectContainsSubstring(t *testing.T, full string, sub string) {
|
||||
@@ -43,9 +44,9 @@ func expectContainsSubstring(t *testing.T, full string, sub string) {
|
||||
|
||||
func TestPostgresPGX(t *testing.T) {
|
||||
t.Run("connects to the sql", func(t *testing.T) {
|
||||
dbPool, err := pgxpool.ConnectConfig(context.Background(), pgConfig)
|
||||
dbPool, err := pgxpool.ConnectConfig(context.Background(), pgxConfig)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to connect to db with connection string: %s err: %v", pgConfig.ConnString(), err)
|
||||
t.Fatalf("failed to connect to db with connection string: %s err: %v", pgxConfig.ConnString(), err)
|
||||
}
|
||||
if dbPool == nil {
|
||||
t.Fatal("DB pool is nil")
|
||||
@@ -61,9 +62,9 @@ func TestPostgresPGX(t *testing.T) {
|
||||
// sized int, so use string representation of big.Int
|
||||
// and cast on insert
|
||||
|
||||
dbPool, err := pgxpool.ConnectConfig(context.Background(), pgConfig)
|
||||
dbPool, err := pgxpool.ConnectConfig(context.Background(), pgxConfig)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to connect to db with connection string: %s err: %v", pgConfig.ConnString(), err)
|
||||
t.Fatalf("failed to connect to db with connection string: %s err: %v", pgxConfig.ConnString(), err)
|
||||
}
|
||||
defer dbPool.Close()
|
||||
|
||||
@@ -111,7 +112,7 @@ func TestPostgresPGX(t *testing.T) {
|
||||
badHash := fmt.Sprintf("x %s", strings.Repeat("1", 100))
|
||||
badInfo := node.Info{GenesisBlock: badHash, NetworkID: "1", ID: "x123", ClientName: "geth"}
|
||||
|
||||
_, err := postgres.NewPGXDriver(ctx, postgres.TestConfig, badInfo)
|
||||
_, err := postgres.NewPGXDriver(ctx, pgConfig, badInfo)
|
||||
if err == nil {
|
||||
t.Fatal("Expected an error")
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ func TestPostgresSQLX(t *testing.T) {
|
||||
|
||||
t.Run("connects to the database", func(t *testing.T) {
|
||||
var err error
|
||||
connStr := postgres.TestConfig.DbConnectionString()
|
||||
connStr := pgConfig.DbConnectionString()
|
||||
|
||||
sqlxdb, err = sqlx.Connect("postgres", connStr)
|
||||
if err != nil {
|
||||
@@ -58,7 +58,7 @@ func TestPostgresSQLX(t *testing.T) {
|
||||
// sized int, so use string representation of big.Int
|
||||
// and cast on insert
|
||||
|
||||
connStr := postgres.TestConfig.DbConnectionString()
|
||||
connStr := pgConfig.DbConnectionString()
|
||||
db, err := sqlx.Connect("postgres", connStr)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -109,7 +109,7 @@ func TestPostgresSQLX(t *testing.T) {
|
||||
badHash := fmt.Sprintf("x %s", strings.Repeat("1", 100))
|
||||
badInfo := node.Info{GenesisBlock: badHash, NetworkID: "1", ID: "x123", ClientName: "geth"}
|
||||
|
||||
_, err := postgres.NewSQLXDriver(ctx, postgres.TestConfig, badInfo)
|
||||
_, err := postgres.NewSQLXDriver(ctx, pgConfig, badInfo)
|
||||
if err == nil {
|
||||
t.Fatal("Expected an error")
|
||||
}
|
||||
|
||||
@@ -25,7 +25,10 @@ import (
|
||||
|
||||
// SetupSQLXDB is used to setup a sqlx db for tests
|
||||
func SetupSQLXDB() (sql.Database, error) {
|
||||
conf := TestConfig
|
||||
conf, err := TestConfig.WithEnv()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
conf.MaxIdle = 0
|
||||
driver, err := NewSQLXDriver(context.Background(), conf, node.Info{})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user