Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runconfig: test task generation with on_skipped dependencies #302

Merged
merged 1 commit into from
Feb 1, 2022
Merged
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
86 changes: 86 additions & 0 deletions internal/runconfig/runconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,92 @@ func TestGenRunConfig(t *testing.T) {
},
},
},
{
name: "test run task depends on_skipped",
in: &config.Config{
Runs: []*config.Run{
&config.Run{
Name: "run01",
Tasks: []*config.Task{
&config.Task{
Name: "task01",
Runtime: &config.Runtime{
Type: "pod",
Arch: "",
Containers: []*config.Container{
&config.Container{
Image: "image01",
},
},
},
},
&config.Task{
Name: "task02",
Runtime: &config.Runtime{
Type: "pod",
Arch: "",
Containers: []*config.Container{
&config.Container{
Image: "image01",
},
},
},
Depends: config.Depends{
&config.Depend{
TaskName: "task01",
Conditions: []config.DependCondition{
config.DependConditionOnSkipped,
},
},
},
},
},
},
},
},
out: map[string]*rstypes.RunConfigTask{
uuid.New("task01").String(): &rstypes.RunConfigTask{
ID: uuid.New("task01").String(),
Name: "task01", Depends: map[string]*rstypes.RunConfigTaskDepend{},
Runtime: &rstypes.Runtime{Type: rstypes.RuntimeType("pod"),
Containers: []*rstypes.Container{
{
Image: "image01",
Environment: map[string]string{},
Volumes: []rstypes.Volume{},
},
},
},
DockerRegistriesAuth: map[string]rstypes.DockerRegistryAuth{},
Shell: "/bin/sh -e",
Environment: map[string]string{},
Steps: rstypes.Steps{},
},
uuid.New("task02").String(): &rstypes.RunConfigTask{
ID: uuid.New("task02").String(),
Name: "task02",
Depends: map[string]*rstypes.RunConfigTaskDepend{
uuid.New("task01").String(): &rstypes.RunConfigTaskDepend{
TaskID: uuid.New("task01").String(),
Conditions: []rstypes.RunConfigTaskDependCondition{rstypes.RunConfigTaskDependConditionOnSkipped},
},
},
DockerRegistriesAuth: map[string]rstypes.DockerRegistryAuth{},
Runtime: &rstypes.Runtime{Type: rstypes.RuntimeType("pod"),
Containers: []*rstypes.Container{
{
Image: "image01",
Environment: map[string]string{},
Volumes: []rstypes.Volume{},
},
},
},
Shell: "/bin/sh -e",
Environment: map[string]string{},
Steps: rstypes.Steps{},
},
},
},
}

for _, tt := range tests {
Expand Down