-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: merge general-use steps properly (#6031)
- Loading branch information
Showing
3 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
pkg/testworkflows/testworkflowprocessor/action/containerize_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package action | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
testworkflowsv1 "github.com/kubeshop/testkube-operator/api/testworkflows/v1" | ||
"github.com/kubeshop/testkube/internal/common" | ||
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/action/actiontypes" | ||
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/constants" | ||
"github.com/kubeshop/testkube/pkg/testworkflows/testworkflowprocessor/stage" | ||
) | ||
|
||
func TestCreateContainer_MergingDefaultStepBefore(t *testing.T) { | ||
input := actiontypes.NewActionList(). | ||
MutateContainer("ref1", testworkflowsv1.ContainerConfig{ | ||
Command: common.Ptr([]string{"sleep"}), | ||
}). | ||
Start("ref1"). | ||
Execute("ref1", false, true). | ||
End("ref1"). | ||
CurrentStatus("ref1"). | ||
MutateContainer("ref2", testworkflowsv1.ContainerConfig{ | ||
Image: "custom-image:1.2.3", | ||
Command: common.Ptr([]string{"my-test"}), | ||
}). | ||
Start("ref2"). | ||
Execute("ref2", false, false). | ||
End("ref2"). | ||
End(constants.RootOperationName). | ||
End("") | ||
result, _, err := CreateContainer(1, stage.NewContainer(), input, false) | ||
|
||
assert.NoError(t, err) | ||
assert.Equal(t, result.Image, "custom-image:1.2.3") | ||
} | ||
|
||
func TestCreateContainer_MergingDefaultStepAfter(t *testing.T) { | ||
input := actiontypes.NewActionList(). | ||
MutateContainer("ref1", testworkflowsv1.ContainerConfig{ | ||
Image: "custom-image:1.2.3", | ||
Command: common.Ptr([]string{"my-test"}), | ||
}). | ||
Start("ref1"). | ||
Execute("ref1", false, false). | ||
End("ref1"). | ||
CurrentStatus("ref1"). | ||
MutateContainer("ref2", testworkflowsv1.ContainerConfig{ | ||
Command: common.Ptr([]string{"sleep"}), | ||
}). | ||
Start("ref2"). | ||
Execute("ref2", false, true). | ||
End("ref2"). | ||
End(constants.RootOperationName). | ||
End("") | ||
result, _, err := CreateContainer(1, stage.NewContainer(), input, false) | ||
|
||
assert.NoError(t, err) | ||
assert.Equal(t, result.Image, "custom-image:1.2.3") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters