ashwin's fix for failing pgx unit test

This commit is contained in:
i-norden 2021-11-12 09:03:56 -06:00
parent 4fb92b5358
commit 5f4968b3cd

View File

@ -23,7 +23,6 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/jackc/pgx/pgtype"
"github.com/jackc/pgx/v4/pgxpool" "github.com/jackc/pgx/v4/pgxpool"
"github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres"
@ -86,15 +85,15 @@ func TestPostgresPGX(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
var data pgtype.Text var data string
err = dbPool.QueryRow(ctx, `SELECT data FROM example WHERE id = 1`).Scan(&data) err = dbPool.QueryRow(ctx, `SELECT cast(data AS TEXT) FROM example WHERE id = 1`).Scan(&data)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
test_helpers.ExpectEqual(t, data, bi.String()) test_helpers.ExpectEqual(t, data, bi.String())
actual := new(big.Int) actual := new(big.Int)
actual.SetString(data.String, 10) actual.SetString(data, 10)
test_helpers.ExpectEqual(t, actual, bi) test_helpers.ExpectEqual(t, actual, bi)
}) })