@@ -518,6 +518,18 @@ func Test_shardTableClients(t *testing.T) {
518518 shard : & shard {num : 1 , total : 2 },
519519 expected : []tableClient {},
520520 },
521+ {
522+ name : "invalid total number of shards" ,
523+ tableClients : []tableClient {
524+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_1" }},
525+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_2" }},
526+ },
527+ shard : & shard {num : 1 , total : 0 },
528+ expected : []tableClient {
529+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_1" }},
530+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_2" }},
531+ },
532+ },
521533 {
522534 name : "even shard 1 of 2" ,
523535 tableClients : []tableClient {
@@ -559,6 +571,7 @@ func Test_shardTableClients(t *testing.T) {
559571 expected : []tableClient {
560572 {client : & testExecutionClient {}, table : & schema.Table {Name : "table_1" }},
561573 {client : & testExecutionClient {}, table : & schema.Table {Name : "table_2" }},
574+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_3" }},
562575 },
563576 },
564577 {
@@ -572,10 +585,53 @@ func Test_shardTableClients(t *testing.T) {
572585 },
573586 shard : & shard {num : 2 , total : 2 },
574587 expected : []tableClient {
588+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_4" }},
589+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_5" }},
590+ },
591+ },
592+ {
593+ name : "uneven split 1 of 3" ,
594+ tableClients : []tableClient {
595+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_1" }},
596+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_2" }},
597+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_3" }},
598+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_4" }},
599+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_5" }},
600+ },
601+ shard : & shard {num : 1 , total : 3 },
602+ expected : []tableClient {
603+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_1" }},
604+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_2" }},
605+ },
606+ },
607+ {
608+ name : "uneven split 2 of 3" ,
609+ tableClients : []tableClient {
610+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_1" }},
611+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_2" }},
612+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_3" }},
613+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_4" }},
614+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_5" }},
615+ },
616+ shard : & shard {num : 2 , total : 3 },
617+ expected : []tableClient {
618+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_3" }},
619+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_4" }},
620+ },
621+ },
622+ {
623+ name : "uneven split 3 of 3" ,
624+ tableClients : []tableClient {
625+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_1" }},
626+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_2" }},
575627 {client : & testExecutionClient {}, table : & schema.Table {Name : "table_3" }},
576628 {client : & testExecutionClient {}, table : & schema.Table {Name : "table_4" }},
577629 {client : & testExecutionClient {}, table : & schema.Table {Name : "table_5" }},
578630 },
631+ shard : & shard {num : 3 , total : 3 },
632+ expected : []tableClient {
633+ {client : & testExecutionClient {}, table : & schema.Table {Name : "table_5" }},
634+ },
579635 },
580636 {
581637 name : "more shards than table clients" ,
0 commit comments