From bbc5e4cab767ddfce818aa5e035cf4e91d6ba671 Mon Sep 17 00:00:00 2001 From: Maxim Pertsov Date: Tue, 20 Aug 2024 18:03:37 -0400 Subject: [PATCH] flyby: use idiomatic testing env check [APP-2917] --- robot/client/client.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/robot/client/client.go b/robot/client/client.go index 6c4d02b3808..556324b8445 100644 --- a/robot/client/client.go +++ b/robot/client/client.go @@ -4,12 +4,12 @@ package client import ( "context" "errors" - "flag" "fmt" "io" "strings" "sync" "sync/atomic" + "testing" "time" "github.com/fullstorydev/grpcurl" @@ -583,10 +583,7 @@ func (rc *RobotClient) resources(ctx context.Context) ([]resource.Status, []reso // pauses for longer than 5s, below calls to ResourceNames or // ResourceRPCSubtypes can result in context errors that appear in client.New // and remote logic. - // - // TODO(APP-2917): Once we upgrade to go 1.21, replace this if check with if - // !testing.Testing(). - if flag.Lookup("test.v") == nil { + if !testing.Testing() { var cancel func() ctx, cancel = contextutils.ContextWithTimeoutIfNoDeadline(ctx, defaultResourcesTimeout) defer cancel()