@@ -100,11 +100,16 @@ func setup(ctx context.Context, t testing.TB) ([]ScriptEntry, *agentapisdk.Clien
100
100
cwd , err := os .Getwd ()
101
101
require .NoError (t , err , "Failed to get current working directory" )
102
102
binaryPath = filepath .Join (cwd , ".." , "out" , "agentapi" )
103
+ _ , err = os .Stat (binaryPath )
104
+ if err != nil {
105
+ t .Logf ("Building binary at %s" , binaryPath )
106
+ buildCmd := exec .CommandContext (ctx , "go" , "build" , "-o" , binaryPath , "." )
107
+ buildCmd .Dir = filepath .Join (cwd , ".." )
108
+ t .Logf ("run: %s" , buildCmd .String ())
109
+ require .NoError (t , buildCmd .Run (), "Failed to build binary" )
110
+ }
103
111
}
104
112
105
- _ , err = os .Stat (binaryPath )
106
- require .NoError (t , err , "Built binary not found at %s\n Run 'make build' to build the binary" , binaryPath )
107
-
108
113
serverPort , err := getFreePort ()
109
114
require .NoError (t , err , "Failed to get free port for server" )
110
115
@@ -188,6 +193,7 @@ func waitForServer(ctx context.Context, t testing.TB, url string, timeout time.D
188
193
_ = resp .Body .Close ()
189
194
return nil
190
195
}
196
+ t .Logf ("Server not ready yet: %s" , err )
191
197
}
192
198
}
193
199
}
0 commit comments