@@ -89,12 +89,13 @@ func TestParseTablets(t *testing.T) {
89
89
})
90
90
91
91
t .Run ("with-cell" , func (t * testing.T ) {
92
- tablets , err := ParseTablets ( config.VitessConfigurationSettings {
92
+ settings := config.VitessConfigurationSettings {
93
93
API : vitessApi .URL ,
94
94
Cells : []string {"cell2" },
95
95
Keyspace : "test" ,
96
96
Shard : "00" ,
97
- })
97
+ }
98
+ tablets , err := ParseTablets (settings )
98
99
if err != nil {
99
100
t .Fatalf ("Expected no error, got %q" , err )
100
101
}
@@ -106,8 +107,15 @@ func TestParseTablets(t *testing.T) {
106
107
if tablets [0 ].MysqlHostname != "replica1" {
107
108
t .Fatalf ("Expected hostname %q, got %q" , "replica1" , tablets [0 ].MysqlHostname )
108
109
}
109
- if tablets [0 ].Alias .Cell != "cell2" {
110
- t .Fatalf ("Expected vitess cell %s, got %s" , "cell2" , tablets [0 ].Alias .Cell )
110
+ if tablets [0 ].Alias .GetCell () != "cell2" {
111
+ t .Fatalf ("Expected vitess cell %s, got %s" , "cell2" , tablets [0 ].Alias .GetCell ())
112
+ }
113
+
114
+ // empty cell names should cause no filtering
115
+ settings .Cells = []string {"" , "" }
116
+ tablets , _ = ParseTablets (settings )
117
+ if len (tablets ) != 2 {
118
+ t .Fatalf ("Expected 2 tablet, got %d" , len (tablets ))
111
119
}
112
120
})
113
121
0 commit comments