diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d2dfbcc..65dff256 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,7 @@ jobs: cat coverage_unit_tests.out > coverage.out cat coverage_integration_tests.out | grep -v 'mode: atomic' >> coverage.out go tool cover -func=coverage.out + rm coverage_unit_tests.out coverage_integration_tests.out - name: Upload coverage to Codecov uses: codecov/codecov-action@v4-beta with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4403ea48..1ae5a22d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,7 +36,7 @@ jobs: # Note: By default, the `.golangci.yml` file should be at the root of the repository. # The location of the configuration file can be changed by using `--config=` # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 - args: ./app/... ./tests/... + args: ./app/... ./common/... ./tests/... # Optional: show only new issues if it's a pull request. The default value is `false`. # only-new-issues: true diff --git a/Makefile b/Makefile index 0c77a5d8..cd6ab33e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ run: build ./fq-connector-go server -c ./example.conf lint: - golangci-lint run ./app/... ./tests/... + golangci-lint run ./app/... ./common/... ./tests/... unit_test: go test -v ./app/... @@ -31,3 +31,6 @@ test_coverage: integration_test_env build_image_base: docker build -t ghcr.io/ydb-platform/fq-connector-go:base -f ./Dockerfile.base . + +cloc: + cloc ./app ./common ./tests --git diff --git a/tests/infra/datasource/matching.go b/tests/infra/datasource/matching.go index bee293b3..5b1d4e6a 100644 --- a/tests/infra/datasource/matching.go +++ b/tests/infra/datasource/matching.go @@ -88,7 +88,14 @@ func matchArrays[EXPECTED common.ValueType, ACTUAL common.ArrowArrayType[EXPECTE if expected[j] != nil { require.Equal( t, *expected[j], actual.Value(j), - fmt.Sprintf("column: %v\nexpected: %v\nactual: %v\n", columnName, expected, actual)) + fmt.Sprintf( + "expected val: %v\nactual val: %v\ncolumn: %v\nexpected: %v\nactual: %v\n", + *expected[j], + actual.Value(j), + columnName, + expected, + actual), + ) } else { require.True(t, actual.IsNull(j), fmt.Sprintf("column: %v\nexpected: %v\nactual: %v\n", columnName, expected, actual)) diff --git a/tests/infra/datasource/postgresql/init/init_db.sh b/tests/infra/datasource/postgresql/init/init_db.sh index 9b607acb..9f85bf9d 100644 --- a/tests/infra/datasource/postgresql/init/init_db.sh +++ b/tests/infra/datasource/postgresql/init/init_db.sh @@ -42,11 +42,11 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-E INSERT INTO primitives VALUES ( false, 2, 3, DEFAULT, DEFAULT, 6, 7, 8, DEFAULT, DEFAULT, 11, 12, DEFAULT, DEFAULT, 15.15, 16.16, 17.17, 18.18, 'az', 'az', 'az', 'az', - '1988-11-20 12:55:28.123456', '1988-11-20'); + '1988-11-20 12:55:28.123000', '1988-11-20'); INSERT INTO primitives VALUES ( true, -2, -3, DEFAULT, DEFAULT, -6, -7, -8, DEFAULT, DEFAULT, -11, -12, DEFAULT, DEFAULT, -15.15, -16.16, -17.17, -18.18, 'буки', 'буки', 'буки', 'буки', - '1988-11-20 12:55:28.123456', '1988-11-20'); + '2023-03-21 11:21:31.456000', '2023-03-21'); INSERT INTO primitives VALUES ( NULL, NULL, NULL, DEFAULT, DEFAULT, NULL, NULL, NULL, DEFAULT, DEFAULT, NULL, NULL, diff --git a/tests/infra/datasource/postgresql/tables.go b/tests/infra/datasource/postgresql/tables.go index 23361485..c367e402 100644 --- a/tests/infra/datasource/postgresql/tables.go +++ b/tests/infra/datasource/postgresql/tables.go @@ -1,6 +1,8 @@ package postgresql import ( + "time" + "github.com/ydb-platform/ydb-go-genproto/protos/Ydb" api_service_protos "github.com/ydb-platform/fq-connector-go/api/service/protos" @@ -147,15 +149,126 @@ var Tables = map[string]*datasource.Table{ Records: []*datasource.Record{ { Columns: []any{ - []*int32{ptr.Int32(1), ptr.Int32(2), ptr.Int32(3), ptr.Int32(4), ptr.Int32(5)}, + []*uint8{ptr.Uint8(0), ptr.Uint8(1), nil}, + []*int16{ + ptr.Int16(2), + ptr.Int16(-2), + nil, + }, + []*int16{ + ptr.Int16(3), + ptr.Int16(-3), + nil, + }, + []*int16{ + ptr.Int16(1), + ptr.Int16(2), + ptr.Int16(3), + }, + []*int16{ + ptr.Int16(1), + ptr.Int16(2), + ptr.Int16(3), + }, + []*int32{ + ptr.Int32(6), + ptr.Int32(-6), + nil, + }, + []*int32{ + ptr.Int32(7), + ptr.Int32(-7), + nil, + }, + []*int32{ + ptr.Int32(8), + ptr.Int32(-8), + nil, + }, + []*int32{ + ptr.Int32(1), + ptr.Int32(2), + ptr.Int32(3), + }, + []*int32{ + ptr.Int32(1), + ptr.Int32(2), + ptr.Int32(3), + }, + []*int64{ + ptr.Int64(11), + ptr.Int64(-11), + nil, + }, + []*int64{ + ptr.Int64(12), + ptr.Int64(-12), + nil, + }, + []*int64{ + ptr.Int64(1), + ptr.Int64(2), + ptr.Int64(3), + }, + []*int64{ + ptr.Int64(1), + ptr.Int64(2), + ptr.Int64(3), + }, + []*float32{ + ptr.Float32(15.15), + ptr.Float32(-15.15), + nil, + }, + []*float32{ + ptr.Float32(16.16), + ptr.Float32(-16.16), + nil, + }, + []*float64{ + ptr.Float64(17.17), + ptr.Float64(-17.17), + nil, + }, + []*float64{ + ptr.Float64(18.18), + ptr.Float64(-18.18), + nil, + }, + []*[]byte{ + ptr.T[[]byte]([]byte("az")), + ptr.T[[]byte]([]byte("буки")), + nil, + }, []*string{ - ptr.String("pg_a"), - ptr.String("pg_b"), - ptr.String("pg_c"), - ptr.String("pg_d"), - ptr.String("pg_e"), + ptr.String("az "), + ptr.String("буки "), + nil, + }, + []*string{ + ptr.String("az"), + ptr.String("буки"), + nil, + }, + []*string{ + ptr.String("az"), + ptr.String("буки"), + nil, + }, + []*uint64{ + ptr.Uint64(common.MustTimeToYDBType[uint64]( + common.TimeToYDBTimestamp, time.Date(1988, 11, 20, 12, 55, 28, 123000000, time.UTC))), + ptr.Uint64(common.MustTimeToYDBType[uint64]( + common.TimeToYDBTimestamp, time.Date(2023, 03, 21, 11, 21, 31, 456000000, time.UTC))), + nil, + }, + []*uint16{ + ptr.Uint16(common.MustTimeToYDBType[uint16]( + common.TimeToYDBDate, time.Date(1988, 11, 20, 12, 55, 8, 0, time.UTC))), + ptr.Uint16(common.MustTimeToYDBType[uint16]( + common.TimeToYDBDate, time.Date(2023, 03, 21, 11, 21, 31, 0, time.UTC))), + nil, }, - []*int32{ptr.Int32(10), ptr.Int32(20), ptr.Int32(30), ptr.Int32(40), ptr.Int32(50)}, }, }, },