Skip to content

Commit be90c9a

Browse files
committed
Test that inverse matches work for DRONE_LIMIT_REPOS
Added some additional unit tests to verify that `DRONE_LIMIT_REPOS` works for inverse matches. Given that the matching is based on path/filepath, inverse matches are supported. Related docs: https://docs.drone.io/runner/docker/configuration/reference/drone-limit-repos/
1 parent d926749 commit be90c9a

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

internal/match/match_test.go

+25-1
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,22 @@ func TestFunc(t *testing.T) {
3030
match: true,
3131
matcher: Func([]string{"spaceghost/*", "octocat/*"}, []string{"push"}, true),
3232
},
33-
// repoisitory matching
33+
// repository matching
3434
{
3535
repo: "octocat/hello-world",
3636
event: "pull_request",
3737
trusted: false,
3838
match: true,
3939
matcher: Func([]string{"spaceghost/*", "octocat/*"}, []string{}, false),
4040
},
41+
// repository matching, skipping an org
42+
{
43+
repo: "octocat/hello-world",
44+
event: "pull_request",
45+
trusted: false,
46+
match: true,
47+
matcher: Func([]string{"!spaceghost/*", "octocat/*"}, []string{}, false),
48+
},
4149
// event matching
4250
{
4351
repo: "octocat/hello-world",
@@ -67,6 +75,22 @@ func TestFunc(t *testing.T) {
6775
match: false,
6876
matcher: Func([]string{"octocat/*"}, []string{}, false),
6977
},
78+
// repository matching, skip all repos in the org
79+
{
80+
repo: "spaceghost/hello-world",
81+
event: "pull_request",
82+
trusted: false,
83+
match: false,
84+
matcher: Func([]string{"!spaceghost/*"}, []string{}, false),
85+
},
86+
// repository matching, skip a concrete repo
87+
{
88+
repo: "spaceghost/hello-world",
89+
event: "pull_request",
90+
trusted: false,
91+
match: false,
92+
matcher: Func([]string{"!spaceghost/hello-world"}, []string{}, false),
93+
},
7094
// event matching
7195
{
7296
repo: "octocat/hello-world",

0 commit comments

Comments
 (0)