@@ -16,6 +16,7 @@ import (
1616 "github.com/signadot/go-sdk/client/sandboxes"
1717 "github.com/signadot/go-sdk/client/test_executions"
1818 "github.com/signadot/go-sdk/models"
19+ libconncommon "github.com/signadot/libconnect/common"
1920 "github.com/spf13/cobra"
2021)
2122
@@ -49,7 +50,7 @@ func run(ctx context.Context, cfg *config.SmartTestRun, wOut, wErr io.Writer,
4950 }
5051
5152 // create a run ID
52- runID := repoconfig .GenerateRunID ()
53+ runID := libconncommon .GenerateRunID ()
5354
5455 // trigger test executions
5556 err = triggerTests (cfg , runID , gitRepo , testFiles )
@@ -204,6 +205,7 @@ func triggerTests(cfg *config.SmartTestRun, runID string,
204205 ec := & models.TestExecutionContext {
205206 Cluster : cfg .Cluster ,
206207 Publish : cfg .Publish ,
208+ RunID : runID ,
207209 }
208210 if cfg .Sandbox != "" {
209211 ec .Routing = & models.JobRoutingContext {
@@ -216,13 +218,11 @@ func triggerTests(cfg *config.SmartTestRun, runID string,
216218 }
217219
218220 // define the common parts fields of the embedded spec
219- spec := & models.ExecutionSpec {
220- RunID : runID ,
221- }
221+ extSpec := & models.ExternalSpec {}
222222 if gitRepo != nil {
223- spec .Repo = gitRepo .Repo
224- spec .Branch = gitRepo .Branch
225- spec .CommitSHA = gitRepo .CommitSHA
223+ extSpec .Repo = gitRepo .Repo
224+ extSpec .Branch = gitRepo .Branch
225+ extSpec .CommitSHA = gitRepo .CommitSHA
226226 }
227227
228228 for _ , tf := range testFiles {
@@ -233,17 +233,17 @@ func triggerTests(cfg *config.SmartTestRun, runID string,
233233 if err != nil {
234234 return err
235235 }
236- spec .Path = repoPath
236+ extSpec .Path = repoPath
237237 } else {
238- spec .Path = tf .Path
238+ extSpec .Path = tf .Path
239239 }
240240 }
241241 // define the test name
242- spec .TestName = tf .Name
242+ extSpec .TestName = tf .Name
243243 // define the labels
244- spec . Labels = tf .Labels
244+ labels : = tf .Labels
245245 for k , v := range cfg .Labels {
246- spec . Labels [k ] = v
246+ labels [k ] = v
247247 }
248248 // define the script
249249 var (
@@ -258,17 +258,18 @@ func triggerTests(cfg *config.SmartTestRun, runID string,
258258 if err != nil {
259259 return fmt .Errorf ("failed to read test file %q: %w" , tf .Path , err )
260260 }
261- spec .Script = string (scriptContent )
261+ extSpec .Script = string (scriptContent )
262262
263- params := test_executions .NewCreateTestExecutionParams ().
263+ params := test_executions .NewCreateExternalTestExecutionParams ().
264264 WithOrgName (cfg .Org ).
265265 WithData (& models.TestExecution {
266266 Spec : & models.TestExecutionSpec {
267- EmbeddedSpec : spec ,
267+ External : extSpec ,
268268 ExecutionContext : ec ,
269+ Labels : labels ,
269270 },
270271 })
271- _ , err = cfg .Client .TestExecutions .CreateTestExecution (params , nil )
272+ _ , err = cfg .Client .TestExecutions .CreateExternalTestExecution (params , nil )
272273 if err != nil {
273274 return fmt .Errorf ("could not create test execution for %q: %w" , tf .Path , err )
274275 }
@@ -358,7 +359,7 @@ func getTestExecutionsForRunID(ctx context.Context, cfg *config.SmartTest,
358359 // add current page results to the collection
359360 for _ , item := range result .Payload {
360361 tx := item .Execution
361- if tx .Spec == nil || tx .Spec .EmbeddedSpec == nil {
362+ if tx .Spec == nil || tx .Spec .External == nil {
362363 // this should never happen
363364 continue
364365 }
0 commit comments