@@ -89,10 +89,13 @@ func (*PluginTestSuite) destinationPluginTestWriteOverwriteDeleteStale(ctx conte
8989 StableUUID : u ,
9090 MaxRows : 1 ,
9191 }
92- updatedResources := schema .GenTestData (table , opts )[0 ]
92+ updatedResources := schema .GenTestData (table , opts )
93+ updatedIncResources := schema .GenTestData (incTable , opts )
94+ allUpdatedResources := updatedResources
95+ allUpdatedResources = append (allUpdatedResources , updatedIncResources ... )
9396
94- if err := p .writeOne (ctx , sourceSpec , secondSyncTime , updatedResources ); err != nil {
95- return fmt .Errorf ("failed to write one second time: %w" , err )
97+ if err := p .writeAll (ctx , sourceSpec , secondSyncTime , allUpdatedResources ); err != nil {
98+ return fmt .Errorf ("failed to write all second time: %w" , err )
9699 }
97100
98101 resourcesRead , err = p .readAll (ctx , table , sourceName )
@@ -108,7 +111,7 @@ func (*PluginTestSuite) destinationPluginTestWriteOverwriteDeleteStale(ctx conte
108111 return fmt .Errorf ("after overwrite expected first resource to be different. diff: %s" , diff )
109112 }
110113
111- resourcesRead , err = p .readAll (ctx , tables [ 0 ] , sourceName )
114+ resourcesRead , err = p .readAll (ctx , table , sourceName )
112115 if err != nil {
113116 return fmt .Errorf ("failed to read all second time: %w" , err )
114117 }
@@ -117,19 +120,19 @@ func (*PluginTestSuite) destinationPluginTestWriteOverwriteDeleteStale(ctx conte
117120 }
118121
119122 // we expect the only resource returned to match the updated resource we wrote
120- if ! array .RecordApproxEqual (updatedResources , resourcesRead [0 ]) {
121- diff := RecordDiff (updatedResources , resourcesRead [0 ])
123+ if ! array .RecordApproxEqual (updatedResources [ 0 ] , resourcesRead [0 ]) {
124+ diff := RecordDiff (updatedResources [ 0 ] , resourcesRead [0 ])
122125 return fmt .Errorf ("after delete stale expected resource to be equal. diff: %s" , diff )
123126 }
124127
125- // we expect the incremental table to still have 2 resources, because delete-stale should
128+ // we expect the incremental table to still have 3 resources, because delete-stale should
126129 // not apply there
127- resourcesRead , err = p .readAll (ctx , tables [ 1 ] , sourceName )
130+ resourcesRead , err = p .readAll (ctx , incTable , sourceName )
128131 if err != nil {
129132 return fmt .Errorf ("failed to read all from incremental table: %w" , err )
130133 }
131- if len (resourcesRead ) != 2 {
132- return fmt .Errorf ("expected 2 resources in incremental table after delete-stale, got %d" , len (resourcesRead ))
134+ if len (resourcesRead ) != 3 {
135+ return fmt .Errorf ("expected 3 resources in incremental table after delete-stale, got %d" , len (resourcesRead ))
133136 }
134137
135138 return nil
0 commit comments