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

Upgrade Artie Reader + unbreak tests #486

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.23.0

require (
github.com/DataDog/datadog-go/v5 v5.5.0
github.com/artie-labs/transfer v1.26.29
github.com/artie-labs/transfer v1.26.31
github.com/aws/aws-sdk-go-v2 v1.30.3
github.com/aws/aws-sdk-go-v2/config v1.27.27
github.com/aws/aws-sdk-go-v2/credentials v1.17.27
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ github.com/apache/thrift v0.0.0-20181112125854-24918abba929/go.mod h1:cp2SuWMxlE
github.com/apache/thrift v0.14.2/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.17.0 h1:cMd2aj52n+8VoAtvSvLn4kDC3aZ6IAkBuqWQ2IDu7wo=
github.com/apache/thrift v0.17.0/go.mod h1:OLxhMRJxomX+1I/KUw03qoV3mMz16BwaKI+d4fPBx7Q=
github.com/artie-labs/transfer v1.26.29 h1:oqyeGX1nAIbD1PEZ7/FUSUHLGycKnP456Mbpw4Wgjxs=
github.com/artie-labs/transfer v1.26.29/go.mod h1:+a/UhlQVRIpdz3muS1yhSvyX42RQL0LHOdovGZfEsDE=
github.com/artie-labs/transfer v1.26.31 h1:mnz50FnH8MLnEu83FdK5z/E5zZD42hR2Hz9i1Uqxz/A=
github.com/artie-labs/transfer v1.26.31/go.mod h1:+a/UhlQVRIpdz3muS1yhSvyX42RQL0LHOdovGZfEsDE=
github.com/aws/aws-sdk-go v1.30.19/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go-v2 v1.16.12/go.mod h1:C+Ym0ag2LIghJbXhfXZ0YEEp49rBWowxKzJLUoob0ts=
github.com/aws/aws-sdk-go-v2 v1.30.3 h1:jUeBtG0Ih+ZIFH0F4UkmL9w3cSpaMv9tYYDbzILP8dY=
Expand Down
5 changes: 3 additions & 2 deletions lib/debezium/converters/decimal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ func TestDecimalConverter_Convert(t *testing.T) {
assert.NoError(t, err)
bytes, ok := converted.([]byte)
assert.True(t, ok)
actualValue, err := converter.ToField("").DecodeDecimal(bytes)

actualValue, err := converter.ToField("").ParseValue(bytes)
assert.NoError(t, err)
assert.Equal(t, "1.23", fmt.Sprint(actualValue))
assert.Equal(t, "1.23", actualValue.(*decimal.Decimal).String())
}
}

Expand Down
8 changes: 6 additions & 2 deletions lib/debezium/converters/money_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/artie-labs/reader/lib/ptr"
transferDbz "github.com/artie-labs/transfer/lib/debezium"
"github.com/artie-labs/transfer/lib/typing/decimal"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -41,9 +42,12 @@ func TestMoneyConverter_Convert(t *testing.T) {
decodeValue := func(value any) string {
bytes, ok := value.([]byte)
assert.True(t, ok)
val, err := decimalField.DecodeDecimal(bytes)

valueConverter, err := decimalField.ToValueConverter()
assert.NoError(t, err)
val, err := valueConverter.Convert(bytes)
assert.NoError(t, err)
return val.String()
return val.(*decimal.Decimal).String()
}
{
// Converter where mutateString is true
Expand Down
15 changes: 0 additions & 15 deletions lib/debezium/converters/time_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package converters

import (
"fmt"
"math"
"testing"
"time"
Expand All @@ -12,20 +11,6 @@ import (
)

func parseUsingTransfer(converter ValueConverter, value int64) (*ext.ExtendedTime, error) {
if transferConverter := converter.ToField("foo").ToValueConverter(); transferConverter != nil {
val, err := transferConverter.Convert(value)
if err != nil {
return nil, err
}

extTime, isOk := val.(*ext.ExtendedTime)
if !isOk {
return nil, fmt.Errorf("expected *ext.ExtendedTime got %T", val)
}

return extTime, nil
}

parsedValue, err := converter.ToField("foo").ParseValue(value)
if err != nil {
return nil, err
Expand Down
7 changes: 4 additions & 3 deletions sources/postgres/adapter/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/artie-labs/reader/lib/postgres"
"github.com/artie-labs/reader/lib/postgres/schema"
"github.com/artie-labs/transfer/lib/debezium"
"github.com/artie-labs/transfer/lib/typing/decimal"
)

func TestPostgresAdapter_TableName(t *testing.T) {
Expand Down Expand Up @@ -262,10 +263,10 @@ func TestValueConverterForType_Convert(t *testing.T) {
if tc.numericValue {
bytes, ok := actualValue.([]byte)
assert.True(t, ok)
field := converter.ToField(tc.col.Name)
val, err := field.DecodeDecimal(bytes)

val, err := converter.ToField(tc.col.Name).ParseValue(bytes)
assert.NoError(t, err, tc.name)
assert.Equal(t, tc.expectedValue, val.String(), tc.name)
assert.Equal(t, tc.expectedValue, val.(*decimal.Decimal).String(), tc.name)
} else {
assert.Equal(t, tc.expectedValue, actualValue, tc.name)
}
Expand Down
Loading