@@ -80,6 +80,10 @@ func testTableResolverPanic() *schema.Table {
80
80
}
81
81
}
82
82
83
+ func testNoTables () * schema.Table {
84
+ return nil
85
+ }
86
+
83
87
func testTablePreResourceResolverPanic () * schema.Table {
84
88
return & schema.Table {
85
89
Name : "test_table_pre_resource_resolver_panic" ,
@@ -132,6 +136,7 @@ type syncTestCase struct {
132
136
table * schema.Table
133
137
data []scalar.Vector
134
138
deterministicCQID bool
139
+ err error
135
140
}
136
141
137
142
var syncTestCases = []syncTestCase {
@@ -152,6 +157,12 @@ var syncTestCases = []syncTestCase{
152
157
data : nil ,
153
158
},
154
159
160
+ {
161
+ table : testNoTables (),
162
+ data : nil ,
163
+ err : ErrNoTables ,
164
+ },
165
+
155
166
{
156
167
table : testTableRelationSuccess (),
157
168
data : []scalar.Vector {
@@ -210,8 +221,12 @@ func TestScheduler(t *testing.T) {
210
221
for _ , strategy := range AllStrategies {
211
222
for _ , tc := range syncTestCases {
212
223
tc := tc
213
- tc .table = tc .table .Copy (nil )
214
- t .Run (tc .table .Name + "_" + strategy .String (), func (t * testing.T ) {
224
+ testName := "No table_" + strategy .String ()
225
+ if tc .table != nil {
226
+ tc .table = tc .table .Copy (nil )
227
+ testName = tc .table .Name + "_" + strategy .String ()
228
+ }
229
+ t .Run (testName , func (t * testing.T ) {
215
230
testSyncTable (t , tc , strategy , tc .deterministicCQID )
216
231
})
217
232
}
@@ -220,8 +235,9 @@ func TestScheduler(t *testing.T) {
220
235
221
236
func testSyncTable (t * testing.T , tc syncTestCase , strategy Strategy , deterministicCQID bool ) {
222
237
ctx := context .Background ()
223
- tables := []* schema.Table {
224
- tc .table ,
238
+ tables := []* schema.Table {}
239
+ if tc .table != nil {
240
+ tables = append (tables , tc .table )
225
241
}
226
242
c := testExecutionClient {}
227
243
opts := []Option {
@@ -230,7 +246,8 @@ func testSyncTable(t *testing.T, tc syncTestCase, strategy Strategy, determinist
230
246
}
231
247
sc := NewScheduler (opts ... )
232
248
msgs := make (chan message.SyncMessage , 10 )
233
- if err := sc .Sync (ctx , & c , tables , msgs , WithSyncDeterministicCQID (deterministicCQID )); err != nil {
249
+ err := sc .Sync (ctx , & c , tables , msgs , WithSyncDeterministicCQID (deterministicCQID ))
250
+ if err != tc .err {
234
251
t .Fatal (err )
235
252
}
236
253
close (msgs )
0 commit comments