Skip to content

Commit

Permalink
kind/fix: allow-pipelinetask-execution-evaluation v1beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzzzzzzz committed Jan 16, 2024
1 parent 21189e6 commit cdc986c
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion pkg/apis/pipeline/v1beta1/when_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,36 @@ func TestAllowsExecution(t *testing.T) {
},
evaluatedCEL: map[string]bool{"'foo'!='foo'": false},
expected: false,
}}
},
{
name: "multiple expressions - 1. CEL is true 2. In Op is false, expect false",
whenExpressions: WhenExpressions{
{
CEL: "'foo'=='foo'",
},
{
Input: "foo",
Operator: selection.In,
Values: []string{"bar"},
},
},
evaluatedCEL: map[string]bool{"'foo'=='foo'": true},
expected: false,
},
{
name: "multiple expressions - 1. CEL is true 2. CEL is false, expect false",
whenExpressions: WhenExpressions{
{
CEL: "'foo'!='foo'",
},
{
CEL: "'xxx'!='xxx'",
},
},
evaluatedCEL: map[string]bool{"'foo'=='foo'": true, "'xxx'!='xxx'": false},
expected: false,
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
got := tc.whenExpressions.AllowsExecution(tc.evaluatedCEL)
Expand Down

0 comments on commit cdc986c

Please sign in to comment.