Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add NULL values to test data types #30

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,25 +191,27 @@ func TestVerifyData(t *testing.T) {
}

columnTypes := map[string][]string{
"boolean": {"true", "false"},
"bytea": {fmt.Sprintf("'%s'", hex.EncodeToString([]byte("convert this content to bytes")))},
"bit(1)": {"'1'", "'0'"},
"varbit(3)": {"'0'", "'1'", "'101'", "'010'"},

"bigint[]": {"'{602213950000000000, -1}'"},
"integer": {"0", "123979", "-23974"},
"double precision": {"69.123987", "-69.123987"},

"text": {`'foo'`, `'bar'`, `''`, `'something that is much longer but without much other complication'`},
"uuid": {fmt.Sprintf("'%s'", uuid.New().String())},
`character varying(64)`: {`'more string stuff'`},

"jsonb": {`'{}'`, `'{"foo": ["bar", "baz"]}'`, `'{"foo": "bar"}'`, `'{"foo": "bar", "baz": "qux"}'`, `'{"for sure?": true, "has numbers": 123.456, "this is": ["some", "json", "blob"]}'`},
"json": {`'{}'`, `'{"foo": ["bar", "baz"]}'`, `'{"foo": "bar"}'`, `'{"foo": "bar", "baz": "qux"}'`, `'{"for sure?": true, "has numbers": 123.456, "this is": ["some", "json", "blob"]}'`},

"date": {`'2020-12-31'`},
"timestamp with time zone": {`'2020-12-31 23:59:59 -8:00'`, `'2022-06-08 20:03:06.957223+00'`}, // hashes differently for psql/crdb, convert to epoch when hashing
"timestamp without time zone": {`'2020-12-31 23:59:59'`},
"boolean": {"true", "false", "NULL"},
"bytea": {fmt.Sprintf("'%s'", hex.EncodeToString([]byte("convert this content to bytes"))), "NULL"},
"bit(1)": {"'1'", "'0'", "NULL"},
"varbit(3)": {"'0'", "'1'", "'101'", "'010'", "NULL"},

"bigint[]": {"'{602213950000000000, -1}'", "NULL"},
"integer": {"0", "123979", "-23974", "NULL"},
"double precision": {"69.123987", "-69.123987", "NULL"},

"text": {`'foo'`, `'bar'`, `''`, `'something that is much longer but without much other complication'`, `NULL`},
"text not null": {`'foo'`, `'bar'`, `''`, `'something that is much longer but without much other complication'`},
"uuid": {fmt.Sprintf("'%s'", uuid.New().String()), fmt.Sprintf("'%s'", uuid.New().String()), "NULL"},
`character varying(64)`: {`'more string stuff'`, "NULL"},

"jsonb": {`'{}'`, `'{"foo": ["bar", "baz"]}'`, `'{"foo": "bar"}'`, `'{"foo": "bar", "baz": "qux"}'`, `'{"for sure?": true, "has numbers": 123.456, "this is": ["some", "json", "blob"]}'`, "NULL"},
"json": {`'{}'`, `'{"foo": ["bar", "baz"]}'`, `'{"foo": "bar"}'`, `'{"foo": "bar", "baz": "qux"}'`, `'{"for sure?": true, "has numbers": 123.456, "this is": ["some", "json", "blob"]}'`, "NULL"},

"date": {`'2020-12-31'`, "NULL"},
"date not null": {`'2020-12-31'`},
"timestamp with time zone": {`'2020-12-31 23:59:59 -8:00'`, `'2022-06-08 20:03:06.957223+00'`, "NULL"}, // hashes differently for psql/crdb, convert to epoch when hashing
"timestamp without time zone": {`'2020-12-31 23:59:59'`, "NULL"},
}
keys := make([]string, len(columnTypes))
keysWithTypes := make([]string, len(columnTypes))
Expand Down