From 9b2ca77fa0114782f075acb3122805c1b1d27e80 Mon Sep 17 00:00:00 2001 From: Kelly Merrick Date: Thu, 5 Oct 2023 08:20:01 -0500 Subject: [PATCH] test: update main to be default (#324) --- database/build_test.go | 12 +- database/hook_test.go | 10 +- database/pipeline_test.go | 14 +-- database/repo_test.go | 6 +- library/build_test.go | 36 +++--- library/deployment_test.go | 2 +- library/hook_test.go | 2 +- library/pipeline_test.go | 2 +- library/repo_test.go | 6 +- pipeline/build_test.go | 4 +- pipeline/container_test.go | 76 ++++++------ pipeline/ruleset_test.go | 184 ++++++++++++++--------------- pipeline/secret_test.go | 4 +- pipeline/stage_test.go | 4 +- yaml/build_test.go | 2 +- yaml/ruleset_test.go | 20 ++-- yaml/stage_test.go | 8 +- yaml/step_test.go | 8 +- yaml/testdata/build.yml | 2 +- yaml/testdata/ruleset_advanced.yml | 2 +- yaml/testdata/ruleset_regex.yml | 2 +- yaml/testdata/ruleset_simple.yml | 2 +- 22 files changed, 204 insertions(+), 204 deletions(-) diff --git a/database/build_test.go b/database/build_test.go index 08643818..972b4cf2 100644 --- a/database/build_test.go +++ b/database/build_test.go @@ -131,8 +131,8 @@ func TestDatabase_Build_ToLibrary(t *testing.T) { want.SetAuthor("OctoKitty") want.SetEmail("OctoKitty@github.com") want.SetLink("https://example.company.com/github/octocat/1") - want.SetBranch("master") - want.SetRef("refs/heads/master") + want.SetBranch("main") + want.SetRef("refs/heads/main") want.SetBaseRef("") want.SetHeadRef("") want.SetHost("example.company.com") @@ -220,8 +220,8 @@ func TestDatabase_BuildFromLibrary(t *testing.T) { b.SetAuthor("OctoKitty") b.SetEmail("OctoKitty@github.com") b.SetLink("https://example.company.com/github/octocat/1") - b.SetBranch("master") - b.SetRef("refs/heads/master") + b.SetBranch("main") + b.SetRef("refs/heads/main") b.SetBaseRef("") b.SetHeadRef("") b.SetHost("example.company.com") @@ -279,8 +279,8 @@ func testBuild() *Build { Author: sql.NullString{String: "OctoKitty", Valid: true}, Email: sql.NullString{String: "OctoKitty@github.com", Valid: true}, Link: sql.NullString{String: "https://example.company.com/github/octocat/1", Valid: true}, - Branch: sql.NullString{String: "master", Valid: true}, - Ref: sql.NullString{String: "refs/heads/master", Valid: true}, + Branch: sql.NullString{String: "main", Valid: true}, + Ref: sql.NullString{String: "refs/heads/main", Valid: true}, BaseRef: sql.NullString{String: "", Valid: false}, HeadRef: sql.NullString{String: "", Valid: false}, Host: sql.NullString{String: "example.company.com", Valid: true}, diff --git a/database/hook_test.go b/database/hook_test.go index 1ec31a6d..9247ba0d 100644 --- a/database/hook_test.go +++ b/database/hook_test.go @@ -73,7 +73,7 @@ func TestDatabase_Hook_ToLibrary(t *testing.T) { want.SetHost("github.com") want.SetEvent("push") want.SetEventAction("") - want.SetBranch("master") + want.SetBranch("main") want.SetError("") want.SetStatus("success") want.SetLink("https://github.com/github/octocat/settings/hooks/1") @@ -89,7 +89,7 @@ func TestDatabase_Hook_ToLibrary(t *testing.T) { Host: sql.NullString{String: "github.com", Valid: true}, Event: sql.NullString{String: "push", Valid: true}, EventAction: sql.NullString{String: "", Valid: true}, - Branch: sql.NullString{String: "master", Valid: true}, + Branch: sql.NullString{String: "main", Valid: true}, Error: sql.NullString{String: "", Valid: true}, Status: sql.NullString{String: "success", Valid: true}, Link: sql.NullString{String: "https://github.com/github/octocat/settings/hooks/1", Valid: true}, @@ -182,7 +182,7 @@ func TestDatabase_HookFromLibrary(t *testing.T) { Host: sql.NullString{String: "github.com", Valid: true}, Event: sql.NullString{String: "pull_request", Valid: true}, EventAction: sql.NullString{String: "opened", Valid: true}, - Branch: sql.NullString{String: "master", Valid: true}, + Branch: sql.NullString{String: "main", Valid: true}, Error: sql.NullString{String: "", Valid: false}, Status: sql.NullString{String: "success", Valid: true}, Link: sql.NullString{String: "https://github.com/github/octocat/settings/hooks/1", Valid: true}, @@ -199,7 +199,7 @@ func TestDatabase_HookFromLibrary(t *testing.T) { h.SetHost("github.com") h.SetEvent("pull_request") h.SetEventAction("opened") - h.SetBranch("master") + h.SetBranch("main") h.SetError("") h.SetStatus("success") h.SetLink("https://github.com/github/octocat/settings/hooks/1") @@ -226,7 +226,7 @@ func testHook() *Hook { Host: sql.NullString{String: "github.com", Valid: true}, Event: sql.NullString{String: "push", Valid: true}, EventAction: sql.NullString{String: "", Valid: false}, - Branch: sql.NullString{String: "master", Valid: true}, + Branch: sql.NullString{String: "main", Valid: true}, Error: sql.NullString{String: "", Valid: false}, Status: sql.NullString{String: "success", Valid: true}, Link: sql.NullString{String: "https://github.com/github/octocat/settings/hooks/1", Valid: true}, diff --git a/database/pipeline_test.go b/database/pipeline_test.go index b6e3ab2f..3e8ceb12 100644 --- a/database/pipeline_test.go +++ b/database/pipeline_test.go @@ -276,7 +276,7 @@ func TestDatabase_Pipeline_ToLibrary(t *testing.T) { want.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163") want.SetFlavor("large") want.SetPlatform("docker") - want.SetRef("refs/heads/master") + want.SetRef("refs/heads/main") want.SetType(constants.PipelineTypeYAML) want.SetVersion("1") want.SetExternalSecrets(false) @@ -310,7 +310,7 @@ func TestDatabase_Pipeline_Validate(t *testing.T) { pipeline: &Pipeline{ ID: sql.NullInt64{Int64: 1, Valid: true}, RepoID: sql.NullInt64{Int64: 1, Valid: true}, - Ref: sql.NullString{String: "refs/heads/master", Valid: true}, + Ref: sql.NullString{String: "refs/heads/main", Valid: true}, Type: sql.NullString{String: constants.PipelineTypeYAML, Valid: true}, Version: sql.NullString{String: "1", Valid: true}, }, @@ -330,7 +330,7 @@ func TestDatabase_Pipeline_Validate(t *testing.T) { pipeline: &Pipeline{ ID: sql.NullInt64{Int64: 1, Valid: true}, Commit: sql.NullString{String: "48afb5bdc41ad69bf22588491333f7cf71135163", Valid: true}, - Ref: sql.NullString{String: "refs/heads/master", Valid: true}, + Ref: sql.NullString{String: "refs/heads/main", Valid: true}, Type: sql.NullString{String: constants.PipelineTypeYAML, Valid: true}, Version: sql.NullString{String: "1", Valid: true}, }, @@ -341,7 +341,7 @@ func TestDatabase_Pipeline_Validate(t *testing.T) { ID: sql.NullInt64{Int64: 1, Valid: true}, RepoID: sql.NullInt64{Int64: 1, Valid: true}, Commit: sql.NullString{String: "48afb5bdc41ad69bf22588491333f7cf71135163", Valid: true}, - Ref: sql.NullString{String: "refs/heads/master", Valid: true}, + Ref: sql.NullString{String: "refs/heads/main", Valid: true}, Version: sql.NullString{String: "1", Valid: true}, }, }, @@ -351,7 +351,7 @@ func TestDatabase_Pipeline_Validate(t *testing.T) { ID: sql.NullInt64{Int64: 1, Valid: true}, RepoID: sql.NullInt64{Int64: 1, Valid: true}, Commit: sql.NullString{String: "48afb5bdc41ad69bf22588491333f7cf71135163", Valid: true}, - Ref: sql.NullString{String: "refs/heads/master", Valid: true}, + Ref: sql.NullString{String: "refs/heads/main", Valid: true}, Type: sql.NullString{String: constants.PipelineTypeYAML, Valid: true}, }, @@ -385,7 +385,7 @@ func TestDatabase_PipelineFromLibrary(t *testing.T) { p.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163") p.SetFlavor("large") p.SetPlatform("docker") - p.SetRef("refs/heads/master") + p.SetRef("refs/heads/main") p.SetType(constants.PipelineTypeYAML) p.SetVersion("1") p.SetExternalSecrets(false) @@ -415,7 +415,7 @@ func testPipeline() *Pipeline { Commit: sql.NullString{String: "48afb5bdc41ad69bf22588491333f7cf71135163", Valid: true}, Flavor: sql.NullString{String: "large", Valid: true}, Platform: sql.NullString{String: "docker", Valid: true}, - Ref: sql.NullString{String: "refs/heads/master", Valid: true}, + Ref: sql.NullString{String: "refs/heads/main", Valid: true}, Type: sql.NullString{String: constants.PipelineTypeYAML, Valid: true}, Version: sql.NullString{String: "1", Valid: true}, ExternalSecrets: sql.NullBool{Bool: false, Valid: true}, diff --git a/database/repo_test.go b/database/repo_test.go index de3613de..f5f24966 100644 --- a/database/repo_test.go +++ b/database/repo_test.go @@ -161,7 +161,7 @@ func TestDatabase_Repo_ToLibrary(t *testing.T) { want.SetFullName("github/octocat") want.SetLink("https://github.com/github/octocat") want.SetClone("https://github.com/github/octocat.git") - want.SetBranch("master") + want.SetBranch("main") want.SetTopics([]string{"cloud", "security"}) want.SetBuildLimit(10) want.SetTimeout(30) @@ -314,7 +314,7 @@ func TestDatabase_RepoFromLibrary(t *testing.T) { r.SetFullName("github/octocat") r.SetLink("https://github.com/github/octocat") r.SetClone("https://github.com/github/octocat.git") - r.SetBranch("master") + r.SetBranch("main") r.SetTopics([]string{"cloud", "security"}) r.SetBuildLimit(10) r.SetTimeout(30) @@ -353,7 +353,7 @@ func testRepo() *Repo { FullName: sql.NullString{String: "github/octocat", Valid: true}, Link: sql.NullString{String: "https://github.com/github/octocat", Valid: true}, Clone: sql.NullString{String: "https://github.com/github/octocat.git", Valid: true}, - Branch: sql.NullString{String: "master", Valid: true}, + Branch: sql.NullString{String: "main", Valid: true}, Topics: []string{"cloud", "security"}, BuildLimit: sql.NullInt64{Int64: 10, Valid: true}, Timeout: sql.NullInt64{Int64: 30, Valid: true}, diff --git a/library/build_test.go b/library/build_test.go index b2d5b8c4..64e4c5ca 100644 --- a/library/build_test.go +++ b/library/build_test.go @@ -89,7 +89,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "VELA_BUILD_AUTHOR": "OctoKitty", "VELA_BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "VELA_BUILD_BASE_REF": "", - "VELA_BUILD_BRANCH": "master", + "VELA_BUILD_BRANCH": "main", "VELA_BUILD_CHANNEL": "TODO", "VELA_BUILD_CLONE": "https://github.com/github/octocat.git", "VELA_BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -103,7 +103,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "VELA_BUILD_MESSAGE": "First commit...", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", - "VELA_BUILD_REF": "refs/heads/master", + "VELA_BUILD_REF": "refs/heads/main", "VELA_BUILD_RUNTIME": "docker", "VELA_BUILD_SENDER": "OctoKitty", "VELA_BUILD_STARTED": "1563474078", @@ -114,7 +114,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "BUILD_AUTHOR": "OctoKitty", "BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "BUILD_BASE_REF": "", - "BUILD_BRANCH": "master", + "BUILD_BRANCH": "main", "BUILD_CHANNEL": "TODO", "BUILD_CLONE": "https://github.com/github/octocat.git", "BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -126,7 +126,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "BUILD_MESSAGE": "First commit...", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", - "BUILD_REF": "refs/heads/master", + "BUILD_REF": "refs/heads/main", "BUILD_SENDER": "OctoKitty", "BUILD_STARTED": "1563474078", "BUILD_SOURCE": "https://github.com/github/octocat/48afb5bdc41ad69bf22588491333f7cf71135163", @@ -141,7 +141,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "VELA_BUILD_AUTHOR": "OctoKitty", "VELA_BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "VELA_BUILD_BASE_REF": "", - "VELA_BUILD_BRANCH": "master", + "VELA_BUILD_BRANCH": "main", "VELA_BUILD_CHANNEL": "TODO", "VELA_BUILD_CLONE": "https://github.com/github/octocat.git", "VELA_BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -168,7 +168,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "BUILD_AUTHOR": "OctoKitty", "BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "BUILD_BASE_REF": "", - "BUILD_BRANCH": "master", + "BUILD_BRANCH": "main", "BUILD_CHANNEL": "TODO", "BUILD_CLONE": "https://github.com/github/octocat.git", "BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -196,7 +196,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "VELA_BUILD_AUTHOR": "OctoKitty", "VELA_BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "VELA_BUILD_BASE_REF": "", - "VELA_BUILD_BRANCH": "master", + "VELA_BUILD_BRANCH": "main", "VELA_BUILD_CHANNEL": "TODO", "VELA_BUILD_CLONE": "https://github.com/github/octocat.git", "VELA_BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -210,7 +210,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "VELA_BUILD_MESSAGE": "First commit...", "VELA_BUILD_NUMBER": "1", "VELA_BUILD_PARENT": "1", - "VELA_BUILD_REF": "refs/heads/master", + "VELA_BUILD_REF": "refs/heads/main", "VELA_BUILD_RUNTIME": "docker", "VELA_BUILD_SENDER": "OctoKitty", "VELA_BUILD_STARTED": "1563474078", @@ -224,7 +224,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "BUILD_AUTHOR": "OctoKitty", "BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "BUILD_BASE_REF": "", - "BUILD_BRANCH": "master", + "BUILD_BRANCH": "main", "BUILD_CHANNEL": "TODO", "BUILD_CLONE": "https://github.com/github/octocat.git", "BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -236,7 +236,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "BUILD_MESSAGE": "First commit...", "BUILD_NUMBER": "1", "BUILD_PARENT": "1", - "BUILD_REF": "refs/heads/master", + "BUILD_REF": "refs/heads/main", "BUILD_SENDER": "OctoKitty", "BUILD_STARTED": "1563474078", "BUILD_SOURCE": "https://github.com/github/octocat/48afb5bdc41ad69bf22588491333f7cf71135163", @@ -253,7 +253,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "VELA_BUILD_AUTHOR": "OctoKitty", "VELA_BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "VELA_BUILD_BASE_REF": "", - "VELA_BUILD_BRANCH": "master", + "VELA_BUILD_BRANCH": "main", "VELA_BUILD_CHANNEL": "TODO", "VELA_BUILD_CLONE": "https://github.com/github/octocat.git", "VELA_BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -281,7 +281,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "BUILD_AUTHOR": "OctoKitty", "BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "BUILD_BASE_REF": "", - "BUILD_BRANCH": "master", + "BUILD_BRANCH": "main", "BUILD_CHANNEL": "TODO", "BUILD_CLONE": "https://github.com/github/octocat.git", "BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -312,7 +312,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "VELA_BUILD_AUTHOR": "OctoKitty", "VELA_BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "VELA_BUILD_BASE_REF": "", - "VELA_BUILD_BRANCH": "master", + "VELA_BUILD_BRANCH": "main", "VELA_BUILD_CHANNEL": "TODO", "VELA_BUILD_CLONE": "https://github.com/github/octocat.git", "VELA_BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -341,7 +341,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "BUILD_AUTHOR": "OctoKitty", "BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "BUILD_BASE_REF": "", - "BUILD_BRANCH": "master", + "BUILD_BRANCH": "main", "BUILD_CHANNEL": "TODO", "BUILD_CLONE": "https://github.com/github/octocat.git", "BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -369,7 +369,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "VELA_BUILD_AUTHOR": "OctoKitty", "VELA_BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "VELA_BUILD_BASE_REF": "", - "VELA_BUILD_BRANCH": "master", + "VELA_BUILD_BRANCH": "main", "VELA_BUILD_CHANNEL": "TODO", "VELA_BUILD_CLONE": "https://github.com/github/octocat.git", "VELA_BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -395,7 +395,7 @@ func TestLibrary_Build_Environment(t *testing.T) { "BUILD_AUTHOR": "OctoKitty", "BUILD_AUTHOR_EMAIL": "OctoKitty@github.com", "BUILD_BASE_REF": "", - "BUILD_BRANCH": "master", + "BUILD_BRANCH": "main", "BUILD_CHANNEL": "TODO", "BUILD_CLONE": "https://github.com/github/octocat.git", "BUILD_COMMIT": "48afb5bdc41ad69bf22588491333f7cf71135163", @@ -858,8 +858,8 @@ func testBuild() *Build { b.SetAuthor("OctoKitty") b.SetEmail("OctoKitty@github.com") b.SetLink("https://example.company.com/github/octocat/1") - b.SetBranch("master") - b.SetRef("refs/heads/master") + b.SetBranch("main") + b.SetRef("refs/heads/main") b.SetBaseRef("") b.SetHeadRef("changes") b.SetHost("example.company.com") diff --git a/library/deployment_test.go b/library/deployment_test.go index 10661ff9..03ce452e 100644 --- a/library/deployment_test.go +++ b/library/deployment_test.go @@ -190,7 +190,7 @@ func testDeployment() *Deployment { d.SetURL("https://api.github.com/repos/github/octocat/deployments/1") d.SetUser("octocat") d.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163") - d.SetRef("refs/heads/master") + d.SetRef("refs/heads/main") d.SetTask("vela-deploy") d.SetTarget("production") d.SetDescription("Deployment request from Vela") diff --git a/library/hook_test.go b/library/hook_test.go index cc13e8b0..d0b6c0de 100644 --- a/library/hook_test.go +++ b/library/hook_test.go @@ -237,7 +237,7 @@ func testHook() *Hook { h.SetHost("github.com") h.SetEvent("push") h.SetEventAction("") - h.SetBranch("master") + h.SetBranch("main") h.SetError("") h.SetStatus("success") h.SetLink("https://github.com/github/octocat/settings/hooks/1") diff --git a/library/pipeline_test.go b/library/pipeline_test.go index fe10e64e..ddc15aea 100644 --- a/library/pipeline_test.go +++ b/library/pipeline_test.go @@ -243,7 +243,7 @@ func testPipeline() *Pipeline { p.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163") p.SetFlavor("large") p.SetPlatform("docker") - p.SetRef("refs/heads/master") + p.SetRef("refs/heads/main") p.SetRef("yaml") p.SetVersion("1") p.SetExternalSecrets(false) diff --git a/library/repo_test.go b/library/repo_test.go index 7296ab3c..0dc48830 100644 --- a/library/repo_test.go +++ b/library/repo_test.go @@ -17,7 +17,7 @@ func TestLibrary_Repo_Environment(t *testing.T) { "VELA_REPO_ALLOW_PULL": "false", "VELA_REPO_ALLOW_PUSH": "true", "VELA_REPO_ALLOW_TAG": "false", - "VELA_REPO_BRANCH": "master", + "VELA_REPO_BRANCH": "main", "VELA_REPO_TOPICS": "cloud,security", "VELA_REPO_BUILD_LIMIT": "10", "VELA_REPO_CLONE": "https://github.com/github/octocat.git", @@ -36,7 +36,7 @@ func TestLibrary_Repo_Environment(t *testing.T) { "REPOSITORY_ALLOW_PULL": "false", "REPOSITORY_ALLOW_PUSH": "true", "REPOSITORY_ALLOW_TAG": "false", - "REPOSITORY_BRANCH": "master", + "REPOSITORY_BRANCH": "main", "REPOSITORY_CLONE": "https://github.com/github/octocat.git", "REPOSITORY_FULL_NAME": "github/octocat", "REPOSITORY_LINK": "https://github.com/github/octocat", @@ -381,7 +381,7 @@ func testRepo() *Repo { r.SetFullName("github/octocat") r.SetLink("https://github.com/github/octocat") r.SetClone("https://github.com/github/octocat.git") - r.SetBranch("master") + r.SetBranch("main") r.SetTopics([]string{"cloud", "security"}) r.SetBuildLimit(10) r.SetTimeout(30) diff --git a/pipeline/build_test.go b/pipeline/build_test.go index 70fabcac..b43418fa 100644 --- a/pipeline/build_test.go +++ b/pipeline/build_test.go @@ -71,11 +71,11 @@ func TestPipeline_Build_Purge(t *testing.T) { // run tests for _, test := range tests { r := &RuleData{ - Branch: "master", + Branch: "main", Event: "pull_request", Path: []string{}, Repo: "foo/bar", - Tag: "refs/heads/master", + Tag: "refs/heads/main", } got := test.pipeline.Purge(r) diff --git a/pipeline/container_test.go b/pipeline/container_test.go index 971f0743..9c94e2fc 100644 --- a/pipeline/container_test.go +++ b/pipeline/container_test.go @@ -32,11 +32,11 @@ func TestPipeline_ContainerSlice_Purge(t *testing.T) { // run tests for _, test := range tests { r := &RuleData{ - Branch: "master", + Branch: "main", Event: "pull_request", Path: []string{}, Repo: "foo/bar", - Tag: "refs/heads/master", + Tag: "refs/heads/main", } got := test.containers.Purge(r) @@ -155,7 +155,7 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "running", @@ -170,7 +170,7 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "success", @@ -185,7 +185,7 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "failure", @@ -205,7 +205,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "running", @@ -225,7 +225,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "success", @@ -244,7 +244,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "failure", @@ -263,7 +263,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "running", @@ -282,7 +282,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "success", @@ -301,7 +301,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "failure", @@ -315,13 +315,13 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{constants.EventPush}, }, }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "running", @@ -335,13 +335,13 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{constants.EventPush}, }, }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "failure", @@ -355,14 +355,14 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{constants.EventPush}, Path: []string{"README.md"}, }, }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "running", @@ -376,14 +376,14 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{constants.EventPush}, Path: []string{"README.md"}, }, }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "success", @@ -397,14 +397,14 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{constants.EventPush}, Path: []string{"README.md"}, }, }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "failure", @@ -481,14 +481,14 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{constants.EventPush}, Status: []string{constants.StatusSuccess}, }, }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "running", @@ -502,14 +502,14 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{constants.EventPush}, Status: []string{constants.StatusSuccess}, }, }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "success", @@ -523,14 +523,14 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{constants.EventPush}, Status: []string{constants.StatusSuccess}, }, }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "failure", @@ -544,7 +544,7 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{constants.EventPush}, Status: []string{constants.StatusSuccess}, }, @@ -552,7 +552,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "failure", @@ -573,7 +573,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "tag", Repo: "foo/bar", Status: "running", @@ -595,7 +595,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "tag", Repo: "foo/bar", Status: "success", @@ -617,7 +617,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "tag", Repo: "foo/bar", Status: "failure", @@ -637,7 +637,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "running", @@ -656,7 +656,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "success", @@ -675,7 +675,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "failure", @@ -689,14 +689,14 @@ func TestPipeline_Container_Execute(t *testing.T) { Commands: []string{"echo \"Hey Vela\""}, Ruleset: Ruleset{ Unless: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{constants.EventPush}, Status: []string{constants.StatusSuccess}, }, }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Repo: "foo/bar", Status: "success", @@ -717,7 +717,7 @@ func TestPipeline_Container_Execute(t *testing.T) { }, }, ruleData: &RuleData{ - Branch: "master", + Branch: "main", Event: "pull_request", Repo: "foo/bar", Status: "failure", diff --git a/pipeline/ruleset_test.go b/pipeline/ruleset_test.go index 9ee268d5..fb97a696 100644 --- a/pipeline/ruleset_test.go +++ b/pipeline/ruleset_test.go @@ -14,144 +14,144 @@ func TestPipeline_Ruleset_Match(t *testing.T) { want bool }{ // Empty - {ruleset: &Ruleset{}, data: &RuleData{Branch: "master"}, want: true}, + {ruleset: &Ruleset{}, data: &RuleData{Branch: "main"}, want: true}, // If with and operator { - ruleset: &Ruleset{If: Rules{Branch: []string{"master"}}}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{If: Rules{Branch: []string{"main"}}}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, { - ruleset: &Ruleset{If: Rules{Branch: []string{"master"}}}, - data: &RuleData{Branch: "dev", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{If: Rules{Branch: []string{"main"}}}, + data: &RuleData{Branch: "dev", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, { - ruleset: &Ruleset{If: Rules{Branch: []string{"master"}, Event: []string{"push"}}}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{If: Rules{Branch: []string{"main"}, Event: []string{"push"}}}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, { - ruleset: &Ruleset{If: Rules{Branch: []string{"master"}, Event: []string{"push"}}}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{If: Rules{Branch: []string{"main"}, Event: []string{"push"}}}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, { ruleset: &Ruleset{If: Rules{Path: []string{"foo.txt", "/foo/bar.txt"}}}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "pull_request", Path: []string{}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "pull_request", Path: []string{}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, { ruleset: &Ruleset{If: Rules{Comment: []string{"rerun"}}}, - data: &RuleData{Branch: "dev", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "dev", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, { ruleset: &Ruleset{If: Rules{Comment: []string{"rerun"}}}, - data: &RuleData{Branch: "dev", Comment: "ok to test", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "dev", Comment: "ok to test", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, { ruleset: &Ruleset{If: Rules{Event: []string{"deployment"}, Target: []string{"production"}}}, - data: &RuleData{Branch: "dev", Comment: "", Event: "deployment", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: "production"}, + data: &RuleData{Branch: "dev", Comment: "", Event: "deployment", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: "production"}, want: true, }, { ruleset: &Ruleset{If: Rules{Event: []string{"deployment"}, Target: []string{"production"}}}, - data: &RuleData{Branch: "dev", Comment: "", Event: "deployment", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: "stage"}, + data: &RuleData{Branch: "dev", Comment: "", Event: "deployment", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: "stage"}, want: false, }, { ruleset: &Ruleset{If: Rules{Event: []string{"schedule"}, Target: []string{"weekly"}}}, - data: &RuleData{Branch: "dev", Comment: "", Event: "schedule", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: "weekly"}, + data: &RuleData{Branch: "dev", Comment: "", Event: "schedule", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: "weekly"}, want: true, }, { ruleset: &Ruleset{If: Rules{Event: []string{"schedule"}, Target: []string{"weekly"}}}, - data: &RuleData{Branch: "dev", Comment: "", Event: "schedule", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: "nightly"}, + data: &RuleData{Branch: "dev", Comment: "", Event: "schedule", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: "nightly"}, want: false, }, { ruleset: &Ruleset{If: Rules{Status: []string{"success", "failure"}}}, - data: &RuleData{Branch: "dev", Comment: "ok to test", Event: "push", Repo: "octocat/hello-world", Status: "failure", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "dev", Comment: "ok to test", Event: "push", Repo: "octocat/hello-world", Status: "failure", Tag: "refs/heads/main", Target: ""}, want: true, }, // If with or operator { - ruleset: &Ruleset{If: Rules{Branch: []string{"master"}, Event: []string{"push"}}, Operator: "or"}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{If: Rules{Branch: []string{"main"}, Event: []string{"push"}}, Operator: "or"}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, { - ruleset: &Ruleset{If: Rules{Branch: []string{"master"}, Event: []string{"push"}}, Operator: "or"}, - data: &RuleData{Branch: "dev", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{If: Rules{Branch: []string{"main"}, Event: []string{"push"}}, Operator: "or"}, + data: &RuleData{Branch: "dev", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, { - ruleset: &Ruleset{If: Rules{Branch: []string{"master"}, Event: []string{"push"}}, Operator: "or"}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{If: Rules{Branch: []string{"main"}, Event: []string{"push"}}, Operator: "or"}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, { - ruleset: &Ruleset{If: Rules{Branch: []string{"master"}, Event: []string{"push"}}, Operator: "or"}, - data: &RuleData{Branch: "dev", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{If: Rules{Branch: []string{"main"}, Event: []string{"push"}}, Operator: "or"}, + data: &RuleData{Branch: "dev", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, { ruleset: &Ruleset{If: Rules{Path: []string{"foo.txt", "/foo/bar.txt"}}, Operator: "or"}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "pull_request", Path: []string{}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "pull_request", Path: []string{}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, // Unless with and operator { - ruleset: &Ruleset{Unless: Rules{Branch: []string{"master"}}}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{Unless: Rules{Branch: []string{"main"}}}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, { - ruleset: &Ruleset{Unless: Rules{Branch: []string{"master"}}}, - data: &RuleData{Branch: "dev", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{Unless: Rules{Branch: []string{"main"}}}, + data: &RuleData{Branch: "dev", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, { - ruleset: &Ruleset{Unless: Rules{Branch: []string{"master"}, Event: []string{"push"}}}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{Unless: Rules{Branch: []string{"main"}, Event: []string{"push"}}}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, { - ruleset: &Ruleset{Unless: Rules{Branch: []string{"master"}, Event: []string{"push"}}}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{Unless: Rules{Branch: []string{"main"}, Event: []string{"push"}}}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, { ruleset: &Ruleset{Unless: Rules{Path: []string{"foo.txt", "/foo/bar.txt"}}}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "pull_request", Path: []string{}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "pull_request", Path: []string{}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, // Unless with or operator { - ruleset: &Ruleset{Unless: Rules{Branch: []string{"master"}, Event: []string{"push"}}, Operator: "or"}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{Unless: Rules{Branch: []string{"main"}, Event: []string{"push"}}, Operator: "or"}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, { - ruleset: &Ruleset{Unless: Rules{Branch: []string{"master"}, Event: []string{"push"}}, Operator: "or"}, - data: &RuleData{Branch: "dev", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{Unless: Rules{Branch: []string{"main"}, Event: []string{"push"}}, Operator: "or"}, + data: &RuleData{Branch: "dev", Comment: "rerun", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, { - ruleset: &Ruleset{Unless: Rules{Branch: []string{"master"}, Event: []string{"push"}}, Operator: "or"}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{Unless: Rules{Branch: []string{"main"}, Event: []string{"push"}}, Operator: "or"}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, { - ruleset: &Ruleset{Unless: Rules{Branch: []string{"master"}, Event: []string{"push"}}, Operator: "or"}, - data: &RuleData{Branch: "dev", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + ruleset: &Ruleset{Unless: Rules{Branch: []string{"main"}, Event: []string{"push"}}, Operator: "or"}, + data: &RuleData{Branch: "dev", Comment: "rerun", Event: "pull_request", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, { ruleset: &Ruleset{Unless: Rules{Path: []string{"foo.txt", "/foo/bar.txt"}}, Operator: "or"}, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "pull_request", Path: []string{}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "pull_request", Path: []string{}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: true, }, // Advanced Rulesets @@ -163,7 +163,7 @@ func TestPipeline_Ruleset_Match(t *testing.T) { }, Operator: "or", }, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "release/*", Target: ""}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "release/*", Target: ""}, want: true, }, { @@ -174,7 +174,7 @@ func TestPipeline_Ruleset_Match(t *testing.T) { }, Operator: "or", }, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "release/*", Target: ""}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "release/*", Target: ""}, want: true, }, { @@ -185,7 +185,7 @@ func TestPipeline_Ruleset_Match(t *testing.T) { }, Operator: "or", }, - data: &RuleData{Branch: "master", Comment: "rerun", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "main", Comment: "rerun", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, want: false, }, } @@ -226,7 +226,7 @@ func TestPipeline_Rules_Empty(t *testing.T) { func TestPipeline_Rules_Empty_Invalid(t *testing.T) { // setup types - r := Rules{Branch: []string{"master"}} + r := Rules{Branch: []string{"main"}} // run test got := r.Empty() @@ -246,37 +246,37 @@ func TestPipeline_Rules_Match_Regex_Tag(t *testing.T) { }{ { rules: &Rules{Event: []string{"tag"}, Tag: []string{"refs/tags/20.*"}}, - data: &RuleData{Branch: "master", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/20.4.42.167", Target: ""}, + data: &RuleData{Branch: "main", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/20.4.42.167", Target: ""}, operator: "and", want: true, }, { rules: &Rules{Event: []string{"tag"}, Tag: []string{"[0-9][0-9].[0-9].[0-9][0-9].[0-9][0-9][0-9]"}}, - data: &RuleData{Branch: "master", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/20.4.42.167", Target: ""}, + data: &RuleData{Branch: "main", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/20.4.42.167", Target: ""}, operator: "and", want: true, }, { rules: &Rules{Event: []string{"tag"}, Tag: []string{"[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"}}, - data: &RuleData{Branch: "master", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/20.4.42.167", Target: ""}, + data: &RuleData{Branch: "main", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/20.4.42.167", Target: ""}, operator: "and", want: true, }, { rules: &Rules{Event: []string{"tag"}, Tag: []string{"^refs/tags/(\\d+\\.)+\\d+$"}}, - data: &RuleData{Branch: "master", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/20.4.42.167", Target: ""}, + data: &RuleData{Branch: "main", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/20.4.42.167", Target: ""}, operator: "and", want: true, }, { rules: &Rules{Event: []string{"tag"}, Tag: []string{"^refs/tags/(\\d+\\.)+\\d+"}}, - data: &RuleData{Branch: "master", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/2.4.42.165-prod", Target: ""}, + data: &RuleData{Branch: "main", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/2.4.42.165-prod", Target: ""}, operator: "and", want: true, }, { rules: &Rules{Event: []string{"tag"}, Tag: []string{"^refs/tags/(\\d+\\.)+\\d+$"}}, - data: &RuleData{Branch: "master", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/2.4.42.165-prod", Target: ""}, + data: &RuleData{Branch: "main", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/2.4.42.165-prod", Target: ""}, operator: "and", want: false, }, @@ -303,112 +303,112 @@ func TestPipeline_Rules_Match(t *testing.T) { // Empty { rules: &Rules{}, - data: &RuleData{Branch: "master", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "main", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "and", want: true, }, { rules: &Rules{}, - data: &RuleData{Branch: "master", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "main", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "or", want: false, }, // and operator { - rules: &Rules{Branch: []string{"master"}}, - data: &RuleData{Branch: "master", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + rules: &Rules{Branch: []string{"main"}}, + data: &RuleData{Branch: "main", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "and", want: true, }, { - rules: &Rules{Branch: []string{"master"}}, - data: &RuleData{Branch: "dev", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + rules: &Rules{Branch: []string{"main"}}, + data: &RuleData{Branch: "dev", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "and", want: false, }, { - rules: &Rules{Branch: []string{"master"}, Event: []string{"push"}}, - data: &RuleData{Branch: "master", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + rules: &Rules{Branch: []string{"main"}, Event: []string{"push"}}, + data: &RuleData{Branch: "main", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "and", want: true, }, { - rules: &Rules{Branch: []string{"master"}, Event: []string{"push"}}, - data: &RuleData{Branch: "master", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + rules: &Rules{Branch: []string{"main"}, Event: []string{"push"}}, + data: &RuleData{Branch: "main", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "and", want: false, }, { rules: &Rules{Path: []string{"foob.txt"}}, - data: &RuleData{Branch: "master", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "main", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "and", want: false, }, { rules: &Rules{Status: []string{"success", "failure"}}, - data: &RuleData{Branch: "master", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "main", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Tag: "refs/heads/main", Target: ""}, operator: "and", want: true, }, { rules: &Rules{Event: []string{"tag"}, Tag: []string{"refs/tags/[0-9].*-prod"}}, - data: &RuleData{Branch: "master", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/2.4.42.167-prod", Target: ""}, + data: &RuleData{Branch: "main", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/tags/2.4.42.167-prod", Target: ""}, operator: "and", want: true, }, { rules: &Rules{Event: []string{"tag"}, Tag: []string{"path/to/thing/*/*"}}, - data: &RuleData{Branch: "master", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "path/to/thing/stage/1.0.2-rc", Target: ""}, + data: &RuleData{Branch: "main", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "path/to/thing/stage/1.0.2-rc", Target: ""}, operator: "and", want: true, }, // or operator { - rules: &Rules{Branch: []string{"master"}, Event: []string{"push"}}, - data: &RuleData{Branch: "master", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + rules: &Rules{Branch: []string{"main"}, Event: []string{"push"}}, + data: &RuleData{Branch: "main", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "or", want: true, }, { - rules: &Rules{Branch: []string{"master"}, Event: []string{"push"}}, - data: &RuleData{Branch: "dev", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + rules: &Rules{Branch: []string{"main"}, Event: []string{"push"}}, + data: &RuleData{Branch: "dev", Event: "push", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "or", want: true, }, { - rules: &Rules{Branch: []string{"master"}, Event: []string{"push"}}, - data: &RuleData{Branch: "master", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + rules: &Rules{Branch: []string{"main"}, Event: []string{"push"}}, + data: &RuleData{Branch: "main", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "or", want: true, }, { - rules: &Rules{Branch: []string{"master"}, Event: []string{"push"}}, - data: &RuleData{Branch: "dev", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + rules: &Rules{Branch: []string{"main"}, Event: []string{"push"}}, + data: &RuleData{Branch: "dev", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "or", want: false, }, { rules: &Rules{Path: []string{"foob.txt"}}, - data: &RuleData{Branch: "dev", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "dev", Event: "pull_request", Path: []string{"foo.txt", "/foo/bar.txt"}, Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "or", want: false, }, // Advanced Rulesets { rules: &Rules{Event: []string{"push", "pull_request"}, Tag: []string{"release/*"}}, - data: &RuleData{Branch: "master", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "release/*", Target: ""}, + data: &RuleData{Branch: "main", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "release/*", Target: ""}, operator: "or", want: true, }, { rules: &Rules{Event: []string{"push", "pull_request"}, Tag: []string{"release/*"}}, - data: &RuleData{Branch: "master", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "release/*", Target: ""}, + data: &RuleData{Branch: "main", Event: "push", Repo: "octocat/hello-world", Status: "pending", Tag: "release/*", Target: ""}, operator: "or", want: true, }, { rules: &Rules{Event: []string{"push", "pull_request"}, Tag: []string{"release/*"}}, - data: &RuleData{Branch: "master", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/master", Target: ""}, + data: &RuleData{Branch: "main", Event: "tag", Repo: "octocat/hello-world", Status: "pending", Tag: "refs/heads/main", Target: ""}, operator: "or", want: false, }, @@ -433,14 +433,14 @@ func TestPipeline_Ruletype_MatchAnd(t *testing.T) { want bool }{ // Empty with filepath matcher - {matcher: "filepath", rule: []string{}, pattern: "master", want: true}, + {matcher: "filepath", rule: []string{}, pattern: "main", want: true}, {matcher: "filepath", rule: []string{}, pattern: "push", want: true}, {matcher: "filepath", rule: []string{}, pattern: "foo/bar", want: true}, {matcher: "filepath", rule: []string{}, pattern: "success", want: true}, {matcher: "filepath", rule: []string{}, pattern: "release/*", want: true}, // Branch with filepath matcher - {matcher: "filepath", rule: []string{"master"}, pattern: "master", want: true}, - {matcher: "filepath", rule: []string{"master"}, pattern: "dev", want: false}, + {matcher: "filepath", rule: []string{"main"}, pattern: "main", want: true}, + {matcher: "filepath", rule: []string{"main"}, pattern: "dev", want: false}, // Comment with filepath matcher {matcher: "filepath", rule: []string{"ok to test"}, pattern: "ok to test", want: true}, {matcher: "filepath", rule: []string{"ok to test"}, pattern: "rerun", want: false}, @@ -468,14 +468,14 @@ func TestPipeline_Ruletype_MatchAnd(t *testing.T) { {matcher: "filepath", rule: []string{"production"}, pattern: "production", want: true}, {matcher: "filepath", rule: []string{"stage"}, pattern: "production", want: false}, // Empty with regex matcher - {matcher: "regexp", rule: []string{}, pattern: "master", want: true}, + {matcher: "regexp", rule: []string{}, pattern: "main", want: true}, {matcher: "regexp", rule: []string{}, pattern: "push", want: true}, {matcher: "regexp", rule: []string{}, pattern: "foo/bar", want: true}, {matcher: "regexp", rule: []string{}, pattern: "success", want: true}, {matcher: "regexp", rule: []string{}, pattern: "release/*", want: true}, // Branch with regex matcher - {matcher: "regexp", rule: []string{"master"}, pattern: "master", want: true}, - {matcher: "regexp", rule: []string{"master"}, pattern: "dev", want: false}, + {matcher: "regexp", rule: []string{"main"}, pattern: "main", want: true}, + {matcher: "regexp", rule: []string{"main"}, pattern: "dev", want: false}, // Comment with regex matcher {matcher: "regexp", rule: []string{"ok to test"}, pattern: "ok to test", want: true}, {matcher: "regexp", rule: []string{"ok to test"}, pattern: "rerun", want: false}, @@ -523,14 +523,14 @@ func TestPipeline_Ruletype_MatchOr(t *testing.T) { want bool }{ // Empty with filepath matcher - {matcher: "filepath", rule: []string{}, pattern: "master", want: false}, + {matcher: "filepath", rule: []string{}, pattern: "main", want: false}, {matcher: "filepath", rule: []string{}, pattern: "push", want: false}, {matcher: "filepath", rule: []string{}, pattern: "foo/bar", want: false}, {matcher: "filepath", rule: []string{}, pattern: "success", want: false}, {matcher: "filepath", rule: []string{}, pattern: "release/*", want: false}, // Branch with filepath matcher - {matcher: "filepath", rule: []string{"master"}, pattern: "master", want: true}, - {matcher: "filepath", rule: []string{"master"}, pattern: "dev", want: false}, + {matcher: "filepath", rule: []string{"main"}, pattern: "main", want: true}, + {matcher: "filepath", rule: []string{"main"}, pattern: "dev", want: false}, // Comment with filepath matcher {matcher: "filepath", rule: []string{"ok to test"}, pattern: "ok to test", want: true}, {matcher: "filepath", rule: []string{"ok to test"}, pattern: "rerun", want: false}, @@ -550,14 +550,14 @@ func TestPipeline_Ruletype_MatchOr(t *testing.T) { {matcher: "filepath", rule: []string{"production"}, pattern: "production", want: true}, {matcher: "filepath", rule: []string{"stage"}, pattern: "production", want: false}, // Empty with regexp matcher - {matcher: "regexp", rule: []string{}, pattern: "master", want: false}, + {matcher: "regexp", rule: []string{}, pattern: "main", want: false}, {matcher: "regexp", rule: []string{}, pattern: "push", want: false}, {matcher: "regexp", rule: []string{}, pattern: "foo/bar", want: false}, {matcher: "regexp", rule: []string{}, pattern: "success", want: false}, {matcher: "regexp", rule: []string{}, pattern: "release/*", want: false}, // Branch with regexp matcher - {matcher: "regexp", rule: []string{"master"}, pattern: "master", want: true}, - {matcher: "regexp", rule: []string{"master"}, pattern: "dev", want: false}, + {matcher: "regexp", rule: []string{"main"}, pattern: "main", want: true}, + {matcher: "regexp", rule: []string{"main"}, pattern: "dev", want: false}, // Comment with regexp matcher {matcher: "regexp", rule: []string{"ok to test"}, pattern: "ok to test", want: true}, {matcher: "regexp", rule: []string{"ok to test"}, pattern: "rerun", want: false}, diff --git a/pipeline/secret_test.go b/pipeline/secret_test.go index e59f8f40..a4ff7a10 100644 --- a/pipeline/secret_test.go +++ b/pipeline/secret_test.go @@ -32,11 +32,11 @@ func TestPipeline_SecretSlice_Purge(t *testing.T) { // run tests for _, test := range tests { r := &RuleData{ - Branch: "master", + Branch: "main", Event: "push", Path: []string{}, Repo: "foo/bar", - Tag: "refs/heads/master", + Tag: "refs/heads/main", } got := test.secrets.Purge(r) diff --git a/pipeline/stage_test.go b/pipeline/stage_test.go index 2b96cfaf..919803dc 100644 --- a/pipeline/stage_test.go +++ b/pipeline/stage_test.go @@ -32,11 +32,11 @@ func TestPipeline_StageSlice_Purge(t *testing.T) { // run tests for _, test := range tests { r := &RuleData{ - Branch: "master", + Branch: "main", Event: "pull_request", Path: []string{}, Repo: "foo/bar", - Tag: "refs/heads/master", + Tag: "refs/heads/main", } got := test.stages.Purge(r) diff --git a/yaml/build_test.go b/yaml/build_test.go index 7600ba1e..4b652e98 100644 --- a/yaml/build_test.go +++ b/yaml/build_test.go @@ -238,7 +238,7 @@ func TestYaml_Build_UnmarshalYAML(t *testing.T) { Image: "plugins/docker:18.09", Pull: "always", Ruleset: Ruleset{ - If: Rules{Branch: []string{"master"}, Event: []string{"push"}}, + If: Rules{Branch: []string{"main"}, Event: []string{"push"}}, Matcher: "filepath", Operator: "and", }, diff --git a/yaml/ruleset_test.go b/yaml/ruleset_test.go index f4b721e6..31ce53a0 100644 --- a/yaml/ruleset_test.go +++ b/yaml/ruleset_test.go @@ -20,7 +20,7 @@ func TestYaml_Ruleset_ToPipeline(t *testing.T) { { ruleset: &Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"test comment"}, Event: []string{"push"}, Path: []string{"foo.txt"}, @@ -30,7 +30,7 @@ func TestYaml_Ruleset_ToPipeline(t *testing.T) { Target: []string{"production"}, }, Unless: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"real comment"}, Event: []string{"pull_request"}, Path: []string{"bar.txt"}, @@ -45,7 +45,7 @@ func TestYaml_Ruleset_ToPipeline(t *testing.T) { }, want: &pipeline.Ruleset{ If: pipeline.Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"test comment"}, Event: []string{"push"}, Path: []string{"foo.txt"}, @@ -55,7 +55,7 @@ func TestYaml_Ruleset_ToPipeline(t *testing.T) { Target: []string{"production"}, }, Unless: pipeline.Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"real comment"}, Event: []string{"pull_request"}, Path: []string{"bar.txt"}, @@ -91,7 +91,7 @@ func TestYaml_Ruleset_UnmarshalYAML(t *testing.T) { file: "testdata/ruleset_simple.yml", want: &Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"test comment"}, Event: []string{"push"}, Path: []string{"foo.txt"}, @@ -109,7 +109,7 @@ func TestYaml_Ruleset_UnmarshalYAML(t *testing.T) { file: "testdata/ruleset_advanced.yml", want: &Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{"push"}, Tag: []string{"^refs/tags/(\\d+\\.)+\\d+$"}, }, @@ -126,7 +126,7 @@ func TestYaml_Ruleset_UnmarshalYAML(t *testing.T) { file: "testdata/ruleset_regex.yml", want: &Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Event: []string{"tag"}, Tag: []string{"^refs/tags/(\\d+\\.)+\\d+$"}, }, @@ -165,7 +165,7 @@ func TestYaml_Rules_ToPipeline(t *testing.T) { }{ { rules: &Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"test comment"}, Event: []string{"push"}, Path: []string{"foo.txt"}, @@ -175,7 +175,7 @@ func TestYaml_Rules_ToPipeline(t *testing.T) { Target: []string{"production"}, }, want: &pipeline.Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"test comment"}, Event: []string{"push"}, Path: []string{"foo.txt"}, @@ -214,7 +214,7 @@ func TestYaml_Rules_UnmarshalYAML(t *testing.T) { failure: false, file: "testdata/ruleset_simple.yml", want: &Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"test comment"}, Event: []string{"push"}, Path: []string{"foo.txt"}, diff --git a/yaml/stage_test.go b/yaml/stage_test.go index 98d3d197..cf90ba48 100644 --- a/yaml/stage_test.go +++ b/yaml/stage_test.go @@ -35,7 +35,7 @@ func TestYaml_StageSlice_ToPipeline(t *testing.T) { Pull: "not_present", Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"test comment"}, Event: []string{"push"}, Path: []string{"foo.txt"}, @@ -45,7 +45,7 @@ func TestYaml_StageSlice_ToPipeline(t *testing.T) { Target: []string{"production"}, }, Unless: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"real comment"}, Event: []string{"pull_request"}, Path: []string{"bar.txt"}, @@ -97,7 +97,7 @@ func TestYaml_StageSlice_ToPipeline(t *testing.T) { Pull: "not_present", Ruleset: pipeline.Ruleset{ If: pipeline.Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"test comment"}, Event: []string{"push"}, Path: []string{"foo.txt"}, @@ -107,7 +107,7 @@ func TestYaml_StageSlice_ToPipeline(t *testing.T) { Target: []string{"production"}, }, Unless: pipeline.Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"real comment"}, Event: []string{"pull_request"}, Path: []string{"bar.txt"}, diff --git a/yaml/step_test.go b/yaml/step_test.go index 4d9c6f0d..e1cead4c 100644 --- a/yaml/step_test.go +++ b/yaml/step_test.go @@ -32,7 +32,7 @@ func TestYaml_StepSlice_ToPipeline(t *testing.T) { Pull: "not_present", Ruleset: Ruleset{ If: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"test comment"}, Event: []string{"push"}, Path: []string{"foo.txt"}, @@ -42,7 +42,7 @@ func TestYaml_StepSlice_ToPipeline(t *testing.T) { Target: []string{"production"}, }, Unless: Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"real comment"}, Event: []string{"pull_request"}, Path: []string{"bar.txt"}, @@ -88,7 +88,7 @@ func TestYaml_StepSlice_ToPipeline(t *testing.T) { Pull: "not_present", Ruleset: pipeline.Ruleset{ If: pipeline.Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"test comment"}, Event: []string{"push"}, Path: []string{"foo.txt"}, @@ -98,7 +98,7 @@ func TestYaml_StepSlice_ToPipeline(t *testing.T) { Target: []string{"production"}, }, Unless: pipeline.Rules{ - Branch: []string{"master"}, + Branch: []string{"main"}, Comment: []string{"real comment"}, Event: []string{"pull_request"}, Path: []string{"bar.txt"}, diff --git a/yaml/testdata/build.yml b/yaml/testdata/build.yml index 008bf989..e1a7fbc9 100644 --- a/yaml/testdata/build.yml +++ b/yaml/testdata/build.yml @@ -93,7 +93,7 @@ steps: pull: true ruleset: if: - branch: master + branch: main event: push operator: and secrets: diff --git a/yaml/testdata/ruleset_advanced.yml b/yaml/testdata/ruleset_advanced.yml index dfd92ca1..24039e2a 100644 --- a/yaml/testdata/ruleset_advanced.yml +++ b/yaml/testdata/ruleset_advanced.yml @@ -1,6 +1,6 @@ --- if: - branch: [ master ] + branch: [ main ] event: push tag: "^refs/tags/(\\d+\\.)+\\d+$" unless: diff --git a/yaml/testdata/ruleset_regex.yml b/yaml/testdata/ruleset_regex.yml index 794a03d5..eb6b1fd3 100644 --- a/yaml/testdata/ruleset_regex.yml +++ b/yaml/testdata/ruleset_regex.yml @@ -1,6 +1,6 @@ --- if: - branch: master + branch: main event: tag tag: [ "^refs/tags/(\\d+\\.)+\\d+$" ] operator: and diff --git a/yaml/testdata/ruleset_simple.yml b/yaml/testdata/ruleset_simple.yml index 21f5e5ab..7696e49b 100644 --- a/yaml/testdata/ruleset_simple.yml +++ b/yaml/testdata/ruleset_simple.yml @@ -1,5 +1,5 @@ --- -branch: master +branch: main comment: "test comment" continue: true event: push