Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik committed Sep 14, 2023
1 parent de430a6 commit ca5deee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions flow/connectors/postgres/postgres_cdc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/PeerDB-io/peer-flow/model"
"github.com/PeerDB-io/peer-flow/model/qvalue"
"github.com/jackc/pgx/v5"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)

Expand Down Expand Up @@ -690,8 +691,16 @@ func (suite *PostgresCDCTestSuite) TestAllTypesHappyFlow() {
RelationMessageMapping: relationMessageMapping,
})
suite.failTestError(err)
suite.Equal(1, len(records.RecordBatch.Records))
suite.Equal(35, records.RecordBatch.Records[0].GetItems().Len())
require.Equal(suite.T(), 1, len(records.RecordBatch.Records))

items := records.RecordBatch.Records[0].GetItems()
numCols := items.Len()
if numCols != 35 {
jsonStr, err := items.ToJSON()
suite.failTestError(err)
fmt.Printf("record batch json: %s\n", jsonStr)
suite.FailNow("expected 35 columns, got %d", numCols)
}

err = suite.connector.PullFlowCleanup(allTypesHappyFlowName)
suite.failTestError(err)
Expand Down
2 changes: 1 addition & 1 deletion flow/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewRecordItems() *RecordItems {
colToValIdx: make(map[string]int),
// create a slice of 64 qvalues so that we don't have to allocate memory
// for each record to reduce GC pressure
values: make([]*qvalue.QValue, 16),
values: make([]*qvalue.QValue, 0, 32),
}
}

Expand Down

0 comments on commit ca5deee

Please sign in to comment.