Merge pull request #19 from grafana/jvrplmlmn/additional-tests-for-drone-limit-repos-inverse-match

Test that inverse matches work for `DRONE_LIMIT_REPOS`
This commit is contained in:
TP Honey
2021-07-06 10:45:36 +01:00
committed by GitHub

View File

@@ -30,7 +30,7 @@ func TestFunc(t *testing.T) {
match: true,
matcher: Func([]string{"spaceghost/*", "octocat/*"}, []string{"push"}, true),
},
// repoisitory matching
// repository matching
{
repo: "octocat/hello-world",
event: "pull_request",
@@ -38,6 +38,14 @@ func TestFunc(t *testing.T) {
match: true,
matcher: Func([]string{"spaceghost/*", "octocat/*"}, []string{}, false),
},
// repository matching, skipping an org
{
repo: "octocat/hello-world",
event: "pull_request",
trusted: false,
match: true,
matcher: Func([]string{"!spaceghost/*", "octocat/*"}, []string{}, false),
},
// event matching
{
repo: "octocat/hello-world",
@@ -67,6 +75,22 @@ func TestFunc(t *testing.T) {
match: false,
matcher: Func([]string{"octocat/*"}, []string{}, false),
},
// repository matching, skip all repos in the org
{
repo: "spaceghost/hello-world",
event: "pull_request",
trusted: false,
match: false,
matcher: Func([]string{"!spaceghost/*"}, []string{}, false),
},
// repository matching, skip a concrete repo
{
repo: "spaceghost/hello-world",
event: "pull_request",
trusted: false,
match: false,
matcher: Func([]string{"!spaceghost/hello-world"}, []string{}, false),
},
// event matching
{
repo: "octocat/hello-world",