Skip to content

Commit faa64b0

Browse files
authored
fix(test): Truncate sync time based on test options in testDeleteStaleBasic (#1187)
1 parent 15cea46 commit faa64b0

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

plugin/testing_write_delete.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414

1515
func (s *WriterTestSuite) testDeleteStaleBasic(ctx context.Context) {
1616
tableName := s.tableNameForTest("delete_basic")
17-
// https://github.com/golang/go/issues/41087
18-
syncTime := time.Now().UTC().Truncate(time.Microsecond)
17+
syncTime := time.Now().UTC().Truncate(s.genDatOptions.TimePrecision).
18+
Truncate(time.Microsecond) // https://github.com/golang/go/issues/41087
1919
table := &schema.Table{
2020
Name: tableName,
2121
Columns: schema.ColumnList{schema.CqSourceNameColumn, schema.CqSyncTimeColumn},
@@ -65,7 +65,7 @@ func (s *WriterTestSuite) testDeleteStaleAll(ctx context.Context) {
6565
MaxRows: rowsPerRecord,
6666
TimePrecision: s.genDatOptions.TimePrecision,
6767
SourceName: "test",
68-
SyncTime: syncTime,
68+
SyncTime: syncTime, // Generate call may truncate the value further based on the options
6969
})
7070
require.NoErrorf(s.t, s.plugin.writeOne(ctx, &message.WriteInsert{Record: normalRecord}), "failed to insert record")
7171
normalRecord = s.handleNulls(normalRecord) // we process nulls after writing
@@ -77,7 +77,7 @@ func (s *WriterTestSuite) testDeleteStaleAll(ctx context.Context) {
7777
require.NoErrorf(s.t, s.plugin.writeOne(ctx, &message.WriteDeleteStale{
7878
TableName: table.Name,
7979
SourceName: "test",
80-
SyncTime: syncTime,
80+
SyncTime: syncTime, // Generate call may truncate the value further based on the options
8181
}), "failed to delete stale records")
8282

8383
readRecords, err = s.plugin.readAll(ctx, table)
@@ -91,7 +91,7 @@ func (s *WriterTestSuite) testDeleteStaleAll(ctx context.Context) {
9191
TimePrecision: s.genDatOptions.TimePrecision,
9292
NullRows: true,
9393
SourceName: "test",
94-
SyncTime: syncTime,
94+
SyncTime: syncTime, // Generate call may truncate the value further based on the options
9595
})
9696
require.NoErrorf(s.t, s.plugin.writeOne(ctx, &message.WriteInsert{Record: nullRecord}), "failed to insert record second time")
9797
nullRecord = s.handleNulls(nullRecord) // we process nulls after writing
@@ -105,7 +105,7 @@ func (s *WriterTestSuite) testDeleteStaleAll(ctx context.Context) {
105105
require.NoErrorf(s.t, s.plugin.writeOne(ctx, &message.WriteDeleteStale{
106106
TableName: table.Name,
107107
SourceName: "test",
108-
SyncTime: syncTime,
108+
SyncTime: syncTime, // Generate call may truncate the value further based on the options
109109
}), "failed to delete stale records second time")
110110

111111
readRecords, err = s.plugin.readAll(ctx, table)

0 commit comments

Comments
 (0)