Skip to content

Commit 953fdcf

Browse files
fmudrymmorhun
authored andcommitted
fix tests for on-cel-expression
Changed the tests to contain correct naming. Before the change it was the same as on pull request, but there should be a difference between 'on push' and 'on pull' filenames in the on-cel-expression. Signed-off-by: Filip Mudry <[email protected]>
1 parent 5e5386f commit 953fdcf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/controller/component_build_controller_unit_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ func TestGenerateCelExpressionForPipeline(t *testing.T) {
384384
}(),
385385
targetBranch: "my-branch",
386386
wantOnPull: `event == "pull_request" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-pull-request.yaml".pathChanged() )`,
387-
wantOnPush: `event == "push" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-pull-request.yaml".pathChanged() )`,
387+
wantOnPush: `event == "push" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-push.yaml".pathChanged() )`,
388388
},
389389
{
390390
name: "should generate cel expression for component with context directory and its dockerfile in context directory",
@@ -398,7 +398,7 @@ func TestGenerateCelExpressionForPipeline(t *testing.T) {
398398
return true, nil
399399
},
400400
wantOnPull: `event == "pull_request" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-pull-request.yaml".pathChanged() )`,
401-
wantOnPush: `event == "push" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-pull-request.yaml".pathChanged() )`,
401+
wantOnPush: `event == "push" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-push.yaml".pathChanged() )`,
402402
},
403403
{
404404
name: "should generate cel expression for component with context directory and its dockerfile outside context directory",
@@ -412,7 +412,7 @@ func TestGenerateCelExpressionForPipeline(t *testing.T) {
412412
return false, nil
413413
},
414414
wantOnPull: `event == "pull_request" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-pull-request.yaml".pathChanged() || "docker-root-dir/Dockerfile".pathChanged() )`,
415-
wantOnPush: `event == "push" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-pull-request.yaml".pathChanged() || "docker-root-dir/Dockerfile".pathChanged() )`,
415+
wantOnPush: `event == "push" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-push.yaml".pathChanged() || "docker-root-dir/Dockerfile".pathChanged() )`,
416416
},
417417
{
418418
name: "should generate cel expression for component with context directory and its dockerfile outside git repository",
@@ -423,7 +423,7 @@ func TestGenerateCelExpressionForPipeline(t *testing.T) {
423423
}(),
424424
targetBranch: "my-branch",
425425
wantOnPull: `event == "pull_request" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-pull-request.yaml".pathChanged() )`,
426-
wantOnPush: `event == "push" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-pull-request.yaml".pathChanged() )`,
426+
wantOnPush: `event == "push" && target_branch == "my-branch" && ( "component-dir/***".pathChanged() || ".tekton/component-name-push.yaml".pathChanged() )`,
427427
},
428428
{
429429
name: "should fail to generate cel expression for component if isFileExist fails",

0 commit comments

Comments
 (0)