@@ -80,6 +80,10 @@ func testTableResolverPanic() *schema.Table {
8080 }
8181}
8282
83+ func testNoTables () * schema.Table {
84+ return nil
85+ }
86+
8387func testTablePreResourceResolverPanic () * schema.Table {
8488 return & schema.Table {
8589 Name : "test_table_pre_resource_resolver_panic" ,
@@ -132,6 +136,7 @@ type syncTestCase struct {
132136 table * schema.Table
133137 data []scalar.Vector
134138 deterministicCQID bool
139+ err error
135140}
136141
137142var syncTestCases = []syncTestCase {
@@ -152,6 +157,12 @@ var syncTestCases = []syncTestCase{
152157 data : nil ,
153158 },
154159
160+ {
161+ table : testNoTables (),
162+ data : nil ,
163+ err : ErrNoTables ,
164+ },
165+
155166 {
156167 table : testTableRelationSuccess (),
157168 data : []scalar.Vector {
@@ -210,8 +221,12 @@ func TestScheduler(t *testing.T) {
210221 for _ , strategy := range AllStrategies {
211222 for _ , tc := range syncTestCases {
212223 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 ) {
215230 testSyncTable (t , tc , strategy , tc .deterministicCQID )
216231 })
217232 }
@@ -220,8 +235,9 @@ func TestScheduler(t *testing.T) {
220235
221236func testSyncTable (t * testing.T , tc syncTestCase , strategy Strategy , deterministicCQID bool ) {
222237 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 )
225241 }
226242 c := testExecutionClient {}
227243 opts := []Option {
@@ -230,7 +246,8 @@ func testSyncTable(t *testing.T, tc syncTestCase, strategy Strategy, determinist
230246 }
231247 sc := NewScheduler (opts ... )
232248 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 {
234251 t .Fatal (err )
235252 }
236253 close (msgs )
0 commit comments