@@ -225,7 +225,7 @@ func (s *Stage) run(ctx context.Context) (returnErr error) {
225225 s .prepareClient ()
226226 s .propagateStates ()
227227 if len (s .Queries )+ len (s .QueryFiles ) > 0 {
228- if s . RandomExecution != nil && * s .RandomExecution {
228+ if * s .RandomExecution {
229229 returnErr = s .runRandomly (ctx )
230230 } else {
231231 returnErr = s .runSequentially (ctx )
@@ -271,7 +271,7 @@ func (s *Stage) runSequentially(ctx context.Context) (returnErr error) {
271271}
272272
273273func (s * Stage ) runQueryFile (ctx context.Context , queryFile string , expectedRowCountStartIndex * int , fileAlias * string ) error {
274- file , err := os . Open ( queryFile )
274+ // fileAlias is the query file name we will report. We try to make it short, so try to use relative path when possible.
275275 if fileAlias == nil {
276276 if relPath , relErr := filepath .Rel (s .BaseDir , queryFile ); relErr == nil {
277277 fileAlias = & relPath
@@ -280,6 +280,7 @@ func (s *Stage) runQueryFile(ctx context.Context, queryFile string, expectedRowC
280280 }
281281 }
282282
283+ file , err := os .Open (queryFile )
283284 var queries []string
284285 if err == nil {
285286 queries , err = presto .SplitQueries (file )
@@ -320,7 +321,7 @@ func (s *Stage) runRandomly(ctx context.Context) error {
320321 } else {
321322 err := fmt .Errorf ("failed to parse randomly_execute_until %s" , * s .RandomlyExecuteUntil )
322323 if * s .AbortOnError {
323- s .States .exitCode .CompareAndSwap (0 , 5 )
324+ s .States .exitCode .CompareAndSwap (0 , 2 ) // syntax error
324325 return err
325326 } else {
326327 log .Error ().Err (err ).Send ()
0 commit comments