Skip to content

Commit a9bd88f

Browse files
authored
fix: Fix test assertions for records (#1066)
We should check the first record higher up, because after the migration it will have an additional column and is therefore bound to differ from the original record.
1 parent 911762d commit a9bd88f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

plugin/testing_write_migrate.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ func (s *WriterTestSuite) migrate(ctx context.Context, target *schema.Table, sou
5353
if totalItems != 1 {
5454
return fmt.Errorf("expected 1 item, got %d", totalItems)
5555
}
56+
if diff := RecordDiff(records[0], resource1); diff != "" {
57+
return fmt.Errorf("first record differs from expectation: %s", diff)
58+
}
5659

5760
if err := s.plugin.writeOne(ctx, &message.WriteMigrateTable{
5861
Table: target,
@@ -78,19 +81,16 @@ func (s *WriterTestSuite) migrate(ctx context.Context, target *schema.Table, sou
7881
if totalItems != 2 {
7982
return fmt.Errorf("expected 2 items, got %d", totalItems)
8083
}
81-
if diff := RecordDiff(records[0], resource1); diff != "" {
82-
return fmt.Errorf("records[0] differs: %s", diff)
83-
}
8484
if diff := RecordDiff(records[1], resource2); diff != "" {
85-
return fmt.Errorf("records[1] differs: %s", diff)
85+
return fmt.Errorf("second record differs from expectation: %s", diff)
8686
}
8787
} else {
8888
totalItems = TotalRows(records)
8989
if totalItems != 1 {
9090
return fmt.Errorf("expected 1 item, got %d", totalItems)
9191
}
9292
if diff := RecordDiff(records[0], resource2); diff != "" {
93-
return fmt.Errorf("records[0] differs: %s", diff)
93+
return fmt.Errorf("record differs from expectation: %s", diff)
9494
}
9595
}
9696

0 commit comments

Comments
 (0)