Skip to content

Commit

Permalink
add tests for auto-cancel types change
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Oct 12, 2023
1 parent e0fa965 commit 32a707c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
22 changes: 22 additions & 0 deletions compiler/native/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func TestNative_Compile_StagesPipeline(t *testing.T) {
Clone: true,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Stages: pipeline.StageSlice{
&pipeline.Stage{
Expand Down Expand Up @@ -482,6 +483,10 @@ func TestNative_Compile_StepsPipeline(t *testing.T) {
Clone: true,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{
Running: true,
Pending: true,
},
},
Steps: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -693,6 +698,7 @@ func TestNative_Compile_StagesPipelineTemplate(t *testing.T) {
Clone: true,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Stages: pipeline.StageSlice{
&pipeline.Stage{
Expand Down Expand Up @@ -960,6 +966,7 @@ func TestNative_Compile_StepsPipelineTemplate(t *testing.T) {
Clone: true,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -1155,6 +1162,7 @@ func TestNative_Compile_StepsPipelineTemplate_VelaFunction_TemplateName(t *testi
Clone: true,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -1275,6 +1283,7 @@ func TestNative_Compile_StepsPipelineTemplate_VelaFunction_TemplateName_Inline(t
Clone: true,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -1449,6 +1458,7 @@ func TestNative_Compile_Clone(t *testing.T) {
Clone: false,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -1479,6 +1489,7 @@ func TestNative_Compile_Clone(t *testing.T) {
Clone: true,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -1518,6 +1529,7 @@ func TestNative_Compile_Clone(t *testing.T) {
Clone: false,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -1638,6 +1650,7 @@ func TestNative_Compile_Pipeline_Type(t *testing.T) {
Clone: true,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -1683,6 +1696,7 @@ func TestNative_Compile_Pipeline_Type(t *testing.T) {
Clone: true,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -1728,6 +1742,7 @@ func TestNative_Compile_Pipeline_Type(t *testing.T) {
Clone: true,
Template: false,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -2232,6 +2247,7 @@ func Test_Compile_Inline(t *testing.T) {
Metadata: pipeline.Metadata{
Clone: true,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Stages: []*pipeline.Stage{
{
Expand Down Expand Up @@ -2387,6 +2403,7 @@ func Test_Compile_Inline(t *testing.T) {
Metadata: pipeline.Metadata{
Clone: true,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Stages: []*pipeline.Stage{
{
Expand Down Expand Up @@ -2560,6 +2577,7 @@ func Test_Compile_Inline(t *testing.T) {
Metadata: pipeline.Metadata{
Clone: true,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: []*pipeline.Container{
{
Expand Down Expand Up @@ -2676,6 +2694,7 @@ func Test_Compile_Inline(t *testing.T) {
Metadata: pipeline.Metadata{
Clone: true,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: []*pipeline.Container{
{
Expand Down Expand Up @@ -2773,6 +2792,7 @@ func Test_Compile_Inline(t *testing.T) {
Metadata: pipeline.Metadata{
Clone: true,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: []*pipeline.Container{
{
Expand Down Expand Up @@ -2848,6 +2868,7 @@ func Test_Compile_Inline(t *testing.T) {
Metadata: pipeline.Metadata{
Clone: true,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Steps: []*pipeline.Container{
{
Expand Down Expand Up @@ -2892,6 +2913,7 @@ func Test_Compile_Inline(t *testing.T) {
Metadata: pipeline.Metadata{
Clone: true,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &pipeline.CancelOptions{},
},
Stages: []*pipeline.Stage{
{
Expand Down
4 changes: 4 additions & 0 deletions compiler/native/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,17 @@ func TestNative_Parse_StagesPipeline(t *testing.T) {

func TestNative_Parse_StepsPipeline(t *testing.T) {
// setup types
tBool := true
client, _ := New(cli.NewContext(nil, flag.NewFlagSet("test", 0), nil))
want := &yaml.Build{
Version: "1",
Metadata: yaml.Metadata{
Template: false,
Clone: nil,
Environment: []string{"steps", "services", "secrets"},
AutoCancel: &yaml.CancelOptions{
Running: &tBool,
},
},
Environment: map[string]string{
"HELLO": "Hello, Global Environment",
Expand Down
2 changes: 2 additions & 0 deletions compiler/native/testdata/steps_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ version: "1"

metadata:
template: false
auto_cancel:
running: true

environment:
HELLO: "Hello, Global Environment"
Expand Down
12 changes: 8 additions & 4 deletions compiler/native/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ func TestNative_TransformStages(t *testing.T) {
ID: "__0",
Version: "v1",
Metadata: pipeline.Metadata{
Clone: true,
Clone: true,
AutoCancel: &pipeline.CancelOptions{},
},
Services: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -167,7 +168,8 @@ func TestNative_TransformStages(t *testing.T) {
ID: "localOrg_localRepo_1",
Version: "v1",
Metadata: pipeline.Metadata{
Clone: true,
Clone: true,
AutoCancel: &pipeline.CancelOptions{},
},
Services: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -339,7 +341,8 @@ func TestNative_TransformSteps(t *testing.T) {
ID: "__0",
Version: "v1",
Metadata: pipeline.Metadata{
Clone: true,
Clone: true,
AutoCancel: &pipeline.CancelOptions{},
},
Services: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down Expand Up @@ -389,7 +392,8 @@ func TestNative_TransformSteps(t *testing.T) {
ID: "localOrg_localRepo_1",
Version: "v1",
Metadata: pipeline.Metadata{
Clone: true,
Clone: true,
AutoCancel: &pipeline.CancelOptions{},
},
Services: pipeline.ContainerSlice{
&pipeline.Container{
Expand Down

0 comments on commit 32a707c

Please sign in to comment.