@@ -26,7 +26,7 @@ func TestValidSetShowZones(t *testing.T) {
26
26
defer leaktest .AfterTest (t )()
27
27
defer log .Scope (t ).Close (t )
28
28
29
- params , _ := createTestServerParams ()
29
+ params , _ := createTestServerParamsAllowTenants ()
30
30
s , db , _ := serverutils .StartServer (t , params )
31
31
defer s .Stopper ().Stop (context .Background ())
32
32
@@ -95,6 +95,8 @@ func TestValidSetShowZones(t *testing.T) {
95
95
Config : partialZoneOverride ,
96
96
}
97
97
98
+ includeMetaRange := ! s .StartedDefaultTestTenant ()
99
+
98
100
// Remove stock zone configs installed at cluster bootstrap. Otherwise this
99
101
// test breaks whenever these stock zone configs are adjusted.
100
102
sqlutils .RemoveAllZoneConfigs (t , sqlDB )
@@ -112,7 +114,9 @@ func TestValidSetShowZones(t *testing.T) {
112
114
// no other zones.
113
115
sqlutils .SetZoneConfig (t , sqlDB , "DATABASE d" , gcOverride )
114
116
sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultRow , partialDbRow )
115
- sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , defaultRow )
117
+ if includeMetaRange {
118
+ sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , defaultRow )
119
+ }
116
120
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE system" , defaultRow )
117
121
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE system.lease" , defaultRow )
118
122
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE d" , dbRow )
@@ -121,26 +125,34 @@ func TestValidSetShowZones(t *testing.T) {
121
125
// Ensure a table zone config applies to that table and no others.
122
126
sqlutils .SetZoneConfig (t , sqlDB , "TABLE d.t" , gcOverride )
123
127
sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultRow , partialDbRow , partialTableRow )
124
- sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , defaultRow )
128
+ if includeMetaRange {
129
+ sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , defaultRow )
130
+ }
125
131
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE system" , defaultRow )
126
132
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE system.lease" , defaultRow )
127
133
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE d" , dbRow )
128
134
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE d.t" , tableRow )
129
135
130
- // Ensure a named zone config applies to that named zone and no others.
131
- sqlutils .SetZoneConfig (t , sqlDB , "RANGE meta" , gcOverride )
132
- sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultRow , partialMetaRow , partialDbRow , partialTableRow )
133
- sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , metaRow )
134
- sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE system" , defaultRow )
135
- sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE system.lease" , defaultRow )
136
- sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE d" , dbRow )
137
- sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE d.t" , tableRow )
136
+ if includeMetaRange {
137
+ // Ensure a named zone config applies to that named zone and no others.
138
+ sqlutils .SetZoneConfig (t , sqlDB , "RANGE meta" , gcOverride )
139
+ sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultRow , partialMetaRow , partialDbRow , partialTableRow )
140
+ sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , metaRow )
141
+ sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE system" , defaultRow )
142
+ sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE system.lease" , defaultRow )
143
+ sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE d" , dbRow )
144
+ sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE d.t" , tableRow )
145
+ }
138
146
139
147
// Ensure updating the default zone propagates to zones without an override,
140
148
// but not to those with overrides.
141
149
sqlutils .SetZoneConfig (t , sqlDB , "RANGE default" , gcOverride )
142
- sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow , partialMetaRow , partialDbRow , partialTableRow )
143
- sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , metaRow )
150
+ if includeMetaRange {
151
+ sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow , partialMetaRow , partialDbRow , partialTableRow )
152
+ sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , metaRow )
153
+ } else {
154
+ sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow , partialDbRow , partialTableRow )
155
+ }
144
156
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE system" , defaultOverrideRow )
145
157
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE system.lease" , defaultOverrideRow )
146
158
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE d" , dbRow )
@@ -149,22 +161,34 @@ func TestValidSetShowZones(t *testing.T) {
149
161
// Ensure deleting a database deletes only the database zone, and not the
150
162
// table zone.
151
163
sqlutils .DeleteZoneConfig (t , sqlDB , "DATABASE d" )
152
- sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow , partialMetaRow , partialTableRow )
164
+ if includeMetaRange {
165
+ sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow , partialMetaRow , partialTableRow )
166
+ } else {
167
+ sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow , partialTableRow )
168
+ }
153
169
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE d" , defaultOverrideRow )
154
170
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE d.t" , tableRow )
155
171
156
172
// Ensure deleting a table zone works.
157
173
sqlutils .DeleteZoneConfig (t , sqlDB , "TABLE d.t" )
158
- sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow , partialMetaRow )
174
+ if includeMetaRange {
175
+ sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow , partialMetaRow )
176
+ } else {
177
+ sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow )
178
+ }
159
179
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE d.t" , defaultOverrideRow )
160
180
161
- // Ensure deleting a named zone works.
162
- sqlutils .DeleteZoneConfig (t , sqlDB , "RANGE meta" )
163
- sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow )
164
- sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , defaultOverrideRow )
181
+ if includeMetaRange {
182
+ // Ensure deleting a named zone works.
183
+ sqlutils .DeleteZoneConfig (t , sqlDB , "RANGE meta" )
184
+ sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultOverrideRow )
185
+ sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , defaultOverrideRow )
186
+ }
165
187
166
188
// Ensure deleting non-overridden zones is not an error.
167
- sqlutils .DeleteZoneConfig (t , sqlDB , "RANGE meta" )
189
+ if includeMetaRange {
190
+ sqlutils .DeleteZoneConfig (t , sqlDB , "RANGE meta" )
191
+ }
168
192
sqlutils .DeleteZoneConfig (t , sqlDB , "DATABASE d" )
169
193
sqlutils .DeleteZoneConfig (t , sqlDB , "TABLE d.t" )
170
194
@@ -173,7 +197,9 @@ func TestValidSetShowZones(t *testing.T) {
173
197
sqlutils .SetZoneConfig (t , sqlDB , "RANGE default" , gcDefault )
174
198
sqlutils .VerifyAllZoneConfigs (t , sqlDB , defaultRow )
175
199
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE default" , defaultRow )
176
- sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , defaultRow )
200
+ if includeMetaRange {
201
+ sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "RANGE meta" , defaultRow )
202
+ }
177
203
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE system" , defaultRow )
178
204
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "TABLE system.lease" , defaultRow )
179
205
sqlutils .VerifyZoneConfigForTarget (t , sqlDB , "DATABASE d" , defaultRow )
@@ -234,7 +260,7 @@ func TestZoneInheritField(t *testing.T) {
234
260
defer leaktest .AfterTest (t )()
235
261
defer log .Scope (t ).Close (t )
236
262
237
- params , _ := createTestServerParams ()
263
+ params , _ := createTestServerParamsAllowTenants ()
238
264
s , db , _ := serverutils .StartServer (t , params )
239
265
defer s .Stopper ().Stop (context .Background ())
240
266
@@ -281,7 +307,7 @@ func TestInvalidSetShowZones(t *testing.T) {
281
307
defer leaktest .AfterTest (t )()
282
308
defer log .Scope (t ).Close (t )
283
309
284
- params , _ := createTestServerParams ()
310
+ params , _ := createTestServerParamsAllowTenants ()
285
311
s , db , _ := serverutils .StartServer (t , params )
286
312
defer s .Stopper ().Stop (context .Background ())
287
313
0 commit comments