@@ -197,7 +197,7 @@ func TestAdminAPIDataDistribution(t *testing.T) {
197
197
198
198
firstServer := tc .Server (0 ).ApplicationLayer ()
199
199
200
- sqlDB := sqlutils .MakeSQLRunner (tc . ServerConn ( 0 ))
200
+ sqlDB := sqlutils .MakeSQLRunner (firstServer . SQLConn ( t ))
201
201
202
202
{
203
203
// TODO(irfansharif): The data-distribution page and underyling APIs don't
@@ -217,6 +217,11 @@ func TestAdminAPIDataDistribution(t *testing.T) {
217
217
post_id INT REFERENCES roachblog.posts,
218
218
body text
219
219
)` )
220
+
221
+ // Test for null raw sql config column in crdb_internal.zones,
222
+ // see: https://github.com/cockroachdb/cockroach/issues/140044
223
+ //sqlDB.Exec(t, `-- ALTER TABLE roachblog.posts CONFIGURE ZONE = ''`)
224
+
220
225
sqlDB .Exec (t , `CREATE SCHEMA roachblog."foo bar"` )
221
226
sqlDB .Exec (t , `CREATE TABLE roachblog."foo bar".other_stuff(id INT PRIMARY KEY, body TEXT)` )
222
227
// Test special characters in DB and table names.
@@ -265,31 +270,28 @@ func TestAdminAPIDataDistribution(t *testing.T) {
265
270
},
266
271
}
267
272
268
- // Wait for the new tables' ranges to be created and replicated.
269
- testutils .SucceedsSoon (t , func () error {
270
- var resp serverpb.DataDistributionResponse
271
- if err := srvtestutils .GetAdminJSONProto (firstServer , "data_distribution" , & resp ); err != nil {
272
- t .Fatal (err )
273
- }
273
+ require .NoError (t , tc .WaitForFullReplication ())
274
274
275
- delete (resp .DatabaseInfo , "system" ) // delete results for system database.
276
- if ! reflect .DeepEqual (resp .DatabaseInfo , expectedDatabaseInfo ) {
277
- return fmt .Errorf ("expected %v; got %v" , expectedDatabaseInfo , resp .DatabaseInfo )
278
- }
275
+ // Wait for the new tables' ranges to be created and replicated.
276
+ var resp serverpb.DataDistributionResponse
277
+ if err := srvtestutils .GetAdminJSONProto (firstServer , "data_distribution" , & resp ); err != nil {
278
+ t .Fatal (err )
279
+ }
279
280
280
- // Don't test anything about the zone configs for now; just verify that something is there.
281
- if len (resp .ZoneConfigs ) == 0 {
282
- return fmt .Errorf ("no zone configs returned" )
283
- }
281
+ delete (resp .DatabaseInfo , "system" ) // delete results for system database.
282
+ if ! reflect .DeepEqual (resp .DatabaseInfo , expectedDatabaseInfo ) {
283
+ t .Fatal ("unexpected data distribution response" , resp .DatabaseInfo )
284
+ //return fmt.Errorf("expected %v; got %v", expectedDatabaseInfo, resp.DatabaseInfo)
285
+ }
284
286
285
- return nil
286
- } )
287
+ // Don't test anything about the zone configs for now; just verify that something is there.
288
+ require . NotEmpty ( t , resp . ZoneConfigs )
287
289
288
290
// Verify that the request still works after a table has been dropped,
289
291
// and that dropped_at is set on the dropped table.
290
292
sqlDB .Exec (t , `DROP TABLE roachblog.comments` )
291
293
292
- var resp serverpb.DataDistributionResponse
294
+ // var resp serverpb.DataDistributionResponse
293
295
if err := srvtestutils .GetAdminJSONProto (firstServer , "data_distribution" , & resp ); err != nil {
294
296
t .Fatal (err )
295
297
}
0 commit comments