Skip to content

Commit 43e030f

Browse files
theakshaypantchmouel
authored andcommitted
test(ghe webhook): correct PLR count in regex marker test
Update TestGithubGHEWebhookCommentStrategyUpdateMarkerMatchingWithRegexChars to expect 2 pipeline runs instead of 4, matching actual behavior. Rename test data files to simpler names and update CEL expressions to use proper event type checks instead of hardcoded "true". Signed-off-by: Akshay Pant <akshay.akshaypant@gmail.com>
1 parent a676852 commit 43e030f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

test/github_comment_strategy_update_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,16 @@ func TestGithubGHEWebhookCommentStrategyUpdateMultiplePLRs(t *testing.T) {
244244
}
245245

246246
// TestGithubCommentStrategyUpdateMarkerMatchingWithRegexChars tests:
247-
// 1. PLR names containing regex-relevant characters (dots, brackets, etc.) are handled correctly
247+
// 1. PLR names containing regex-relevant characters are handled correctly
248248
// 2. Marker matching remains exact even with special characters
249249
// 3. No cross-contamination between PLRs with similar names.
250250
func TestGithubGHEWebhookCommentStrategyUpdateMarkerMatchingWithRegexChars(t *testing.T) {
251251
ctx := context.Background()
252252
g := &tgithub.PRTest{
253253
Label: "Github Comment Strategy Regex Chars",
254254
YamlFiles: []string{
255-
"testdata/pipelinerun-regex-chars-dots.yaml",
256-
"testdata/pipelinerun-regex-chars-brackets.yaml",
255+
"testdata/pipelinerun-regex-name.yaml",
256+
"testdata/pipelinerun2-regex-name.yaml",
257257
},
258258
GHE: true,
259259
Webhook: true,
@@ -339,7 +339,7 @@ func TestGithubGHEWebhookCommentStrategyUpdateMarkerMatchingWithRegexChars(t *te
339339
assert.NilError(t, err)
340340
g.Cnx.Clients.Log.Infof("Pushed dummy commit: %s", sha)
341341

342-
sopt.NumberofPRMatch = 4
342+
sopt.NumberofPRMatch = 2
343343
sopt.SHA = sha
344344
sopt.Title = "test: trigger comment update"
345345
twait.Succeeded(ctx, t, g.Cnx, g.Options, sopt)

test/testdata/pipelinerun-regex-chars-dots.yaml renamed to test/testdata/pipelinerun-regex-name.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
name: test.pipeline.v1.0
66
annotations:
77
pipelinesascode.tekton.dev/target-namespace: "\\ .TargetNamespace //"
8-
pipelinesascode.tekton.dev/on-cel-expression: "true"
8+
pipelinesascode.tekton.dev/on-cel-expression: event_type == "pull_request"
99
spec:
1010
pipelineSpec:
1111
tasks:

test/testdata/pipelinerun-regex-chars-brackets.yaml renamed to test/testdata/pipelinerun2-regex-name.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
apiVersion: tekton.dev/v1beta1
33
kind: PipelineRun
44
metadata:
5-
name: test-pipeline[0]
5+
name: test.pipeline.v120
66
annotations:
77
pipelinesascode.tekton.dev/target-namespace: "\\ .TargetNamespace //"
8-
pipelinesascode.tekton.dev/on-cel-expression: "true"
8+
pipelinesascode.tekton.dev/on-cel-expression: event_type == "pull_request"
99
spec:
1010
pipelineSpec:
1111
tasks:

0 commit comments

Comments
 (0)