@@ -305,8 +305,6 @@ func TestServerQueryTenant(t *testing.T) {
305305 })
306306 defer s .Stopper ().Stop (context .Background ())
307307
308- systemDB := s .SystemLayer ().SQLConn (t )
309-
310308 // This metric exists in the tenant registry since it's SQL-specific.
311309 tenantMetricName := "sql.insert.count"
312310 // This metric exists only in the host/system registry since it's process-level.
@@ -571,12 +569,9 @@ func TestServerQueryTenant(t *testing.T) {
571569 }
572570
573571 tenant , _ := serverutils .StartTenant (t , s , base.TestTenantArgs {TenantID : tenantID })
574- _ , err = systemDB .Exec ("ALTER TENANT [2] GRANT CAPABILITY can_view_tsdb_metrics=true;\n " )
575- if err != nil {
576- t .Fatal (err )
577- }
578- capability := map [tenantcapabilitiespb.ID ]string {tenantcapabilitiespb .CanViewTSDBMetrics : "true" }
579- serverutils .WaitForTenantCapabilities (t , s , tenantID , capability , "" )
572+ require .NoError (t , s .GrantTenantCapabilities (
573+ context .Background (), tenantID ,
574+ map [tenantcapabilitiespb.ID ]string {tenantcapabilitiespb .CanViewTSDBMetrics : "true" }))
580575 tenantConn := tenant .RPCClientConn (t , username .RootUserName ())
581576 tenantClient := tenantConn .NewTimeSeriesClient ()
582577
@@ -638,12 +633,9 @@ func TestServerQueryTenant(t *testing.T) {
638633 },
639634 },
640635 }
641- _ , err = systemDB .Exec ("ALTER TENANT [2] GRANT CAPABILITY can_view_all_metrics=true;\n " )
642- if err != nil {
643- t .Fatal (err )
644- }
645- capability = map [tenantcapabilitiespb.ID ]string {tenantcapabilitiespb .CanViewAllMetrics : "true" }
646- serverutils .WaitForTenantCapabilities (t , s , tenantID , capability , "" )
636+ require .NoError (t , s .GrantTenantCapabilities (
637+ context .Background (), tenantID ,
638+ map [tenantcapabilitiespb.ID ]string {tenantcapabilitiespb .CanViewAllMetrics : "true" }))
647639
648640 tenantResponse , err = tenantClient .Query (context .Background (), & tspb.TimeSeriesQueryRequest {
649641 StartNanos : 400 * 1e9 ,
0 commit comments