Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions engine/test/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,19 @@ func (r *Runtime) Exec(executables ...Executable) error {
// Go does not allow type parameters on methods.
//
// Returns the task ID and error if the changeset execution fails.
func ExecChangeset[C any](r *Runtime, changeset fdeployment.ChangeSetV2[C], config C) (string, error) {
func ExecChangeset[C any](r *Runtime, changeset fdeployment.ChangeSetV2[C], config C) (fdeployment.ChangesetOutput, error) {
task := ChangesetTask(changeset, config)

return task.ID(), r.Exec(task)
if err := r.Exec(task); err != nil {
return fdeployment.ChangesetOutput{}, err
}

output, ok := r.state.Outputs[task.ID()]
if !ok {
return fdeployment.ChangesetOutput{}, fmt.Errorf("changeset output not found for task %s", task.ID())
}

return output, nil
}

// State returns the current state of the runtime.
Expand Down
5 changes: 2 additions & 3 deletions engine/test/runtime/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,9 @@ func TestRuntime_ExecChangeset(t *testing.T) {
changeset := &mockChangeset[mockChangesetConfig]{}
config := mockChangesetConfig{Value: "test"}

taskID, err := ExecChangeset(runtime, changeset, config)
output, err := ExecChangeset(runtime, changeset, config)
require.NoError(t, err)
require.NotEmpty(t, taskID)
require.Contains(t, runtime.state.Outputs, taskID)
require.NotNil(t, output)
}

func TestRuntime_State(t *testing.T) {
Expand Down
Loading