Skip to content

Commit

Permalink
fix unit test/expected file
Browse files Browse the repository at this point in the history
  • Loading branch information
priyanshi-yb committed Jan 15, 2025
1 parent 099f1c1 commit 7c6f2c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@
{
"table_name": "public.\"hstore_example\"",
"db_type": "target",
"exported_snapshot_rows": 13,
"imported_snapshot_rows": 0,
"exported_snapshot_rows": 0,
"imported_snapshot_rows": 13,
"imported_inserts": 3,
"imported_updates": 5,
"imported_deletes": 0,
Expand All @@ -301,8 +301,8 @@
{
"table_name": "public.\"hstore_example\"",
"db_type": "target",
"exported_snapshot_rows": 13,
"imported_snapshot_rows": 0,
"exported_snapshot_rows": 0,
"imported_snapshot_rows": 13,
"imported_inserts": 3,
"imported_updates": 5,
"imported_deletes": 0,
Expand Down
35 changes: 0 additions & 35 deletions yb-voyager/src/tgtdb/suites/yugabytedbSuite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"testing"

"github.com/stretchr/testify/assert"

"github.com/yugabyte/yb-voyager/yb-voyager/src/utils/schemareg"
)

func TestStringConversionWithFormattingWithDoubleQuotes(t *testing.T) {
Expand Down Expand Up @@ -95,36 +93,3 @@ func TestUUIDConversionWithFormatting(t *testing.T) {
// Then
assert.Equal(t, `'123e4567-e89b-12d3-a456-426614174000'`, result)
}

func TestHstoreValueConversion(t *testing.T) {
colSchema := &schemareg.ColumnSchema{
Parameters: map[string]string{
"__debezium.source.column.type": "HSTORE",
},
}
value := `{"key1":"value1","key2":"value2"}`
result, err := YBValueConverterSuite["io.debezium.data.Json"](value, false, colSchema)
assert.NoError(t, err)
assert.Equal(t, `"key1"=>"value1","key2"=>"value2"`, result)

result, err = YBValueConverterSuite["io.debezium.data.Json"](value, true, colSchema)
assert.NoError(t, err)
assert.Equal(t, `'"key1"=>"value1","key2"=>"value2"'`, result)

result, err = YBValueConverterSuite["io.debezium.data.Json"]("{}", false, colSchema)
assert.NoError(t, err)
assert.Equal(t, "", result)

result, err = YBValueConverterSuite["io.debezium.data.Json"]("{}", true, colSchema)
assert.NoError(t, err)
assert.Equal(t, "''", result)

value = `{"\"{\"\"key1\"\":\"\"value1\"\",\"\"key2\"\":\"\"value2\"\"}\"":"{\\\"key1=value1, key2={\\\"key1=value1, key2=value2\\\"}\\\"}"}`
result, err = YBValueConverterSuite["io.debezium.data.Json"](value, false, colSchema)
assert.NoError(t, err)
assert.Equal(t, `"\"{\"\"key1\"\":\"\"value1\"\",\"\"key2\"\":\"\"value2\"\"}\""=>"{\"key1=value1, key2={\"key1=value1, key2=value2\"}\"}"`, result)

result, err = YBValueConverterSuite["io.debezium.data.Json"](value, true, colSchema)
assert.NoError(t, err)
assert.Equal(t, `'"\"{\"\"key1\"\":\"\"value1\"\",\"\"key2\"\":\"\"value2\"\"}\""=>"{\"key1=value1, key2={\"key1=value1, key2=value2\"}\"}"'`, result)
}

0 comments on commit 7c6f2c1

Please sign in to comment.