@@ -197,7 +197,7 @@ func TestAdminAPIDataDistribution(t *testing.T) {
197197
198198 firstServer := tc .Server (0 ).ApplicationLayer ()
199199
200- sqlDB := sqlutils .MakeSQLRunner (tc . ServerConn ( 0 ))
200+ sqlDB := sqlutils .MakeSQLRunner (firstServer . SQLConn ( t ))
201201
202202 {
203203 // TODO(irfansharif): The data-distribution page and underyling APIs don't
@@ -217,6 +217,11 @@ func TestAdminAPIDataDistribution(t *testing.T) {
217217 post_id INT REFERENCES roachblog.posts,
218218 body text
219219 )` )
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+
220225 sqlDB .Exec (t , `CREATE SCHEMA roachblog."foo bar"` )
221226 sqlDB .Exec (t , `CREATE TABLE roachblog."foo bar".other_stuff(id INT PRIMARY KEY, body TEXT)` )
222227 // Test special characters in DB and table names.
@@ -265,31 +270,28 @@ func TestAdminAPIDataDistribution(t *testing.T) {
265270 },
266271 }
267272
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 ())
274274
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+ }
279280
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+ }
284286
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 )
287289
288290 // Verify that the request still works after a table has been dropped,
289291 // and that dropped_at is set on the dropped table.
290292 sqlDB .Exec (t , `DROP TABLE roachblog.comments` )
291293
292- var resp serverpb.DataDistributionResponse
294+ // var resp serverpb.DataDistributionResponse
293295 if err := srvtestutils .GetAdminJSONProto (firstServer , "data_distribution" , & resp ); err != nil {
294296 t .Fatal (err )
295297 }
0 commit comments