@@ -30,23 +30,16 @@ import (
3030 "gopkg.in/yaml.v3"
3131)
3232
33- type RunCommand int
34-
35- const (
36- UpdateFilesCommand RunCommand = iota
37- UpdateGraphCommand
38- )
39-
40- var runCmds = map [RunCommand ]string {
41- UpdateFilesCommand : "bin/run fetch_files && bin/run update_files" ,
42- UpdateGraphCommand : "bin/run fetch_files && bin/run update_graph" ,
33+ var runCmds = map [model.RunCommand ]string {
34+ model .UpdateFilesCommand : "bin/run fetch_files && bin/run update_files" ,
35+ model .UpdateGraphCommand : "bin/run fetch_files && bin/run update_graph" ,
4336}
4437
4538type RunParams struct {
4639 // Input file
4740 Input string
4841 // Which command to use, this will default to UpdateFilesCommand
49- Command RunCommand
42+ Command model. RunCommand
5043 // job definition passed to the updater
5144 Job * model.Job
5245 // expectations asserted at the end of a test
@@ -102,6 +95,10 @@ func (p *RunParams) Validate() error {
10295 if p .Job .Source .Commit != "" && ! gitShaRegex .MatchString (p .Job .Source .Commit ) {
10396 return fmt .Errorf ("commit must be a SHA, or not provided" )
10497 }
98+ // Allows for older smoke tests without the command field to keep working.
99+ if p .Command == "" {
100+ p .Command = model .UpdateFilesCommand
101+ }
105102 return nil
106103}
107104
@@ -177,6 +174,7 @@ func generateOutput(params RunParams, api *server.API, outFile *os.File) ([]byte
177174 // store the SHA we worked with for reproducible tests
178175 params .Job .Source .Commit = api .Actual .Input .Job .Source .Commit
179176 }
177+ api .Actual .Command = params .Command
180178 api .Actual .Input .Job = * params .Job
181179
182180 // ignore conditions help make tests reproducible, so they are generated if there aren't any yet
0 commit comments