Skip to content

Commit

Permalink
test: update main to be default (#982)
Browse files Browse the repository at this point in the history
  • Loading branch information
KellyMerrick committed Oct 5, 2023
1 parent c20bdf7 commit ae4356a
Show file tree
Hide file tree
Showing 54 changed files with 153 additions and 153 deletions.
6 changes: 3 additions & 3 deletions compiler/registry/github/testdata/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"sha": "3d21ec53a331a6f037a91c368710b99387d012c1",
"url": "https://api.github.com/repos/octokit/octokit.rb/contents/template.yml",
"git_url": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
"html_url": "https://github.com/octokit/octokit.rb/blob/master/template.yml",
"download_url": "https://raw.githubusercontent.com/octokit/octokit.rb/master/template.yml",
"html_url": "https://github.com/octokit/octokit.rb/blob/main/template.yml",
"download_url": "https://raw.githubusercontent.com/octokit/octokit.rb/main/template.yml",
"_links": {
"git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
"self": "https://api.github.com/repos/octokit/octokit.rb/contents/template.yml",
"html": "https://github.com/octokit/octokit.rb/blob/master/template.yml"
"html": "https://github.com/octokit/octokit.rb/blob/main/template.yml"
}
}
2 changes: 1 addition & 1 deletion compiler/template/native/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func TestNative_RenderBuild(t *testing.T) {

got, err := RenderBuild("build", string(sFile), map[string]string{
"VELA_REPO_FULL_NAME": "octocat/hello-world",
"VELA_BUILD_BRANCH": "master",
"VELA_BUILD_BRANCH": "main",
}, map[string]interface{}{})
if (err != nil) != tt.wantErr {
t.Errorf("RenderBuild() error = %v, wantErr %v", err, tt.wantErr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version: "1"

steps:

{{ if (eq $br "master") }}
{{ if (eq $br "main") }}

- name: install
commands:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ steps:
vars:
image: golang:latest
pull_policy: "pull: true"
branch: master
branch: main


Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:

steps:

{{ if (eq $br "master") }}
{{ if (eq $br "main") }}

- name: install
commands:
Expand Down
2 changes: 1 addition & 1 deletion compiler/template/native/testdata/step/to_yaml/step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ steps:
vars:
ruleset:
event: [push, pull_request]
branch: [master]
branch: [main]
2 changes: 1 addition & 1 deletion compiler/template/native/testdata/step/to_yaml/want.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ steps:
image: alpine
ruleset:
event: [ push, pull_request ]
branch: [ master ]
branch: [ main ]
2 changes: 1 addition & 1 deletion compiler/template/starlark/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func TestNative_RenderBuild(t *testing.T) {

got, err := RenderBuild("build", string(sFile), map[string]string{
"VELA_REPO_FULL_NAME": "octocat/hello-world",
"VELA_BUILD_BRANCH": "master",
"VELA_BUILD_BRANCH": "main",
"VELA_REPO_ORG": "octocat",
}, map[string]interface{}{}, tt.execLimit)
if (err != nil) != tt.wantErr {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def main(ctx):
steps = []

for name in stepNames:
if name == "foo" and ctx["vela"]["build"]["branch"] == "master":
if name == "foo" and ctx["vela"]["build"]["branch"] == "main":
steps.append(step(name))

return {
Expand Down
8 changes: 4 additions & 4 deletions database/build/last_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestBuild_Engine_LastBuildForRepo(t *testing.T) {
_build.SetRepoID(1)
_build.SetNumber(1)
_build.SetDeployPayload(nil)
_build.SetBranch("master")
_build.SetBranch("main")

_repo := testRepo()
_repo.SetID(1)
Expand All @@ -35,10 +35,10 @@ func TestBuild_Engine_LastBuildForRepo(t *testing.T) {
// create expected result in mock
_rows := sqlmock.NewRows(
[]string{"id", "repo_id", "pipeline_id", "number", "parent", "event", "event_action", "status", "error", "enqueued", "created", "started", "finished", "deploy", "deploy_payload", "clone", "source", "title", "message", "commit", "sender", "author", "email", "link", "branch", "ref", "base_ref", "head_ref", "host", "runtime", "distribution", "timestamp"}).
AddRow(1, 1, nil, 1, 0, "", "", "", "", 0, 0, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "master", "", "", "", "", "", "", 0)
AddRow(1, 1, nil, 1, 0, "", "", "", "", 0, 0, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "main", "", "", "", "", "", "", 0)

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT * FROM "builds" WHERE repo_id = $1 AND branch = $2 ORDER BY number DESC LIMIT 1`).WithArgs(1, "master").WillReturnRows(_rows)
_mock.ExpectQuery(`SELECT * FROM "builds" WHERE repo_id = $1 AND branch = $2 ORDER BY number DESC LIMIT 1`).WithArgs(1, "main").WillReturnRows(_rows)

_sqlite := testSqlite(t)
defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }()
Expand Down Expand Up @@ -72,7 +72,7 @@ func TestBuild_Engine_LastBuildForRepo(t *testing.T) {
// run tests
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
got, err := test.database.LastBuildForRepo(context.TODO(), _repo, "master")
got, err := test.database.LastBuildForRepo(context.TODO(), _repo, "main")

if test.failure {
if err == nil {
Expand Down
4 changes: 2 additions & 2 deletions database/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,7 @@ func newResources() *Resources {
deploymentOne.SetURL("https://github.com/github/octocat/deployments/1")
deploymentOne.SetUser("octocat")
deploymentOne.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
deploymentOne.SetRef("refs/heads/master")
deploymentOne.SetRef("refs/heads/main")
deploymentOne.SetTask("vela-deploy")
deploymentOne.SetTarget("production")
deploymentOne.SetDescription("Deployment request from Vela")
Expand All @@ -1936,7 +1936,7 @@ func newResources() *Resources {
deploymentTwo.SetURL("https://github.com/github/octocat/deployments/2")
deploymentTwo.SetUser("octocat")
deploymentTwo.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135164")
deploymentTwo.SetRef("refs/heads/master")
deploymentTwo.SetRef("refs/heads/main")
deploymentTwo.SetTask("vela-deploy")
deploymentTwo.SetTarget("production")
deploymentTwo.SetDescription("Deployment request from Vela")
Expand Down
2 changes: 1 addition & 1 deletion database/pipeline/count_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestPipeline_Engine_CountPipelinesForRepo(t *testing.T) {
_pipelineOne.SetID(1)
_pipelineOne.SetRepoID(1)
_pipelineOne.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipelineOne.SetRef("refs/heads/master")
_pipelineOne.SetRef("refs/heads/main")
_pipelineOne.SetType("yaml")
_pipelineOne.SetVersion("1")

Expand Down
2 changes: 1 addition & 1 deletion database/pipeline/count_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestPipeline_Engine_CountPipelines(t *testing.T) {
_pipelineOne.SetID(1)
_pipelineOne.SetRepoID(1)
_pipelineOne.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipelineOne.SetRef("refs/heads/master")
_pipelineOne.SetRef("refs/heads/main")
_pipelineOne.SetType("yaml")
_pipelineOne.SetVersion("1")

Expand Down
4 changes: 2 additions & 2 deletions database/pipeline/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestPipeline_Engine_CreatePipeline(t *testing.T) {
_pipeline.SetID(1)
_pipeline.SetRepoID(1)
_pipeline.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipeline.SetRef("refs/heads/master")
_pipeline.SetRef("refs/heads/main")
_pipeline.SetType("yaml")
_pipeline.SetVersion("1")
_pipeline.SetData([]byte{})
Expand All @@ -31,7 +31,7 @@ func TestPipeline_Engine_CreatePipeline(t *testing.T) {
_mock.ExpectQuery(`INSERT INTO "pipelines"
("repo_id","commit","flavor","platform","ref","type","version","external_secrets","internal_secrets","services","stages","steps","templates","data","id")
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15) RETURNING "id"`).
WithArgs(1, "48afb5bdc41ad69bf22588491333f7cf71135163", nil, nil, "refs/heads/master", "yaml", "1", false, false, false, false, false, false, AnyArgument{}, 1).
WithArgs(1, "48afb5bdc41ad69bf22588491333f7cf71135163", nil, nil, "refs/heads/main", "yaml", "1", false, false, false, false, false, false, AnyArgument{}, 1).
WillReturnRows(_rows)

_sqlite := testSqlite(t)
Expand Down
2 changes: 1 addition & 1 deletion database/pipeline/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestPipeline_Engine_DeletePipeline(t *testing.T) {
_pipeline.SetID(1)
_pipeline.SetRepoID(1)
_pipeline.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipeline.SetRef("refs/heads/master")
_pipeline.SetRef("refs/heads/main")
_pipeline.SetType("yaml")
_pipeline.SetVersion("1")

Expand Down
4 changes: 2 additions & 2 deletions database/pipeline/get_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestPipeline_Engine_GetPipelineForRepo(t *testing.T) {
_pipeline.SetID(1)
_pipeline.SetRepoID(1)
_pipeline.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipeline.SetRef("refs/heads/master")
_pipeline.SetRef("refs/heads/main")
_pipeline.SetType("yaml")
_pipeline.SetVersion("1")
_pipeline.SetData([]byte("foo"))
Expand All @@ -28,7 +28,7 @@ func TestPipeline_Engine_GetPipelineForRepo(t *testing.T) {
// create expected result in mock
_rows := sqlmock.NewRows(
[]string{"id", "repo_id", "commit", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(1, 1, "48afb5bdc41ad69bf22588491333f7cf71135163", "", "", "refs/heads/master", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69})
AddRow(1, 1, "48afb5bdc41ad69bf22588491333f7cf71135163", "", "", "refs/heads/main", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69})

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE repo_id = $1 AND "commit" = $2 LIMIT 1`).WithArgs(1, "48afb5bdc41ad69bf22588491333f7cf71135163").WillReturnRows(_rows)
Expand Down
4 changes: 2 additions & 2 deletions database/pipeline/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestPipeline_Engine_GetPipeline(t *testing.T) {
_pipeline.SetID(1)
_pipeline.SetRepoID(1)
_pipeline.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipeline.SetRef("refs/heads/master")
_pipeline.SetRef("refs/heads/main")
_pipeline.SetType("yaml")
_pipeline.SetVersion("1")
_pipeline.SetData([]byte("foo"))
Expand All @@ -28,7 +28,7 @@ func TestPipeline_Engine_GetPipeline(t *testing.T) {
// create expected result in mock
_rows := sqlmock.NewRows(
[]string{"id", "repo_id", "commit", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(1, 1, "48afb5bdc41ad69bf22588491333f7cf71135163", "", "", "refs/heads/master", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69})
AddRow(1, 1, "48afb5bdc41ad69bf22588491333f7cf71135163", "", "", "refs/heads/main", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69})

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows)
Expand Down
4 changes: 2 additions & 2 deletions database/pipeline/list_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestPipeline_Engine_ListPipelinesForRepo(t *testing.T) {
_pipelineOne.SetID(1)
_pipelineOne.SetRepoID(1)
_pipelineOne.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipelineOne.SetRef("refs/heads/master")
_pipelineOne.SetRef("refs/heads/main")
_pipelineOne.SetType("yaml")
_pipelineOne.SetVersion("1")
_pipelineOne.SetData([]byte("foo"))
Expand All @@ -43,7 +43,7 @@ func TestPipeline_Engine_ListPipelinesForRepo(t *testing.T) {
// create expected result in mock
_rows = sqlmock.NewRows(
[]string{"id", "repo_id", "commit", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(1, 1, "48afb5bdc41ad69bf22588491333f7cf71135163", "", "", "refs/heads/master", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69}).
AddRow(1, 1, "48afb5bdc41ad69bf22588491333f7cf71135163", "", "", "refs/heads/main", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69}).
AddRow(2, 1, "a49aaf4afae6431a79239c95247a2b169fd9f067", "", "", "refs/heads/main", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69})

// ensure the mock expects the query
Expand Down
4 changes: 2 additions & 2 deletions database/pipeline/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestPipeline_Engine_ListPipelines(t *testing.T) {
_pipelineOne.SetID(1)
_pipelineOne.SetRepoID(1)
_pipelineOne.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipelineOne.SetRef("refs/heads/master")
_pipelineOne.SetRef("refs/heads/main")
_pipelineOne.SetType("yaml")
_pipelineOne.SetVersion("1")
_pipelineOne.SetData([]byte("foo"))
Expand All @@ -43,7 +43,7 @@ func TestPipeline_Engine_ListPipelines(t *testing.T) {
// create expected result in mock
_rows = sqlmock.NewRows(
[]string{"id", "repo_id", "commit", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(1, 1, "48afb5bdc41ad69bf22588491333f7cf71135163", "", "", "refs/heads/master", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69}).
AddRow(1, 1, "48afb5bdc41ad69bf22588491333f7cf71135163", "", "", "refs/heads/main", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69}).
AddRow(2, 2, "a49aaf4afae6431a79239c95247a2b169fd9f067", "", "", "refs/heads/main", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69})

// ensure the mock expects the query
Expand Down
4 changes: 2 additions & 2 deletions database/pipeline/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestPipeline_Engine_UpdatePipeline(t *testing.T) {
_pipeline.SetID(1)
_pipeline.SetRepoID(1)
_pipeline.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipeline.SetRef("refs/heads/master")
_pipeline.SetRef("refs/heads/main")
_pipeline.SetType("yaml")
_pipeline.SetVersion("1")
_pipeline.SetData([]byte{})
Expand All @@ -28,7 +28,7 @@ func TestPipeline_Engine_UpdatePipeline(t *testing.T) {
_mock.ExpectExec(`UPDATE "pipelines"
SET "repo_id"=$1,"commit"=$2,"flavor"=$3,"platform"=$4,"ref"=$5,"type"=$6,"version"=$7,"external_secrets"=$8,"internal_secrets"=$9,"services"=$10,"stages"=$11,"steps"=$12,"templates"=$13,"data"=$14
WHERE "id" = $15`).
WithArgs(1, "48afb5bdc41ad69bf22588491333f7cf71135163", nil, nil, "refs/heads/master", "yaml", "1", false, false, false, false, false, false, AnyArgument{}, 1).
WithArgs(1, "48afb5bdc41ad69bf22588491333f7cf71135163", nil, nil, "refs/heads/main", "yaml", "1", false, false, false, false, false, false, AnyArgument{}, 1).
WillReturnResult(sqlmock.NewResult(1, 1))

_sqlite := testSqlite(t)
Expand Down
12 changes: 6 additions & 6 deletions mock/server/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const (
"author": "OctoKitty",
"email": "[email protected]",
"link": "https://vela.example.company.com/github/octocat/1",
"branch": "master",
"ref": "refs/heads/master",
"branch": "main",
"ref": "refs/heads/main",
"base_ref": "",
"host": "example.company.com",
"runtime": "docker",
Expand Down Expand Up @@ -69,8 +69,8 @@ const (
"author": "OctoKitty",
"email": "[email protected]",
"link": "https://vela.example.company.com/github/octocat/1",
"branch": "master",
"ref": "refs/heads/master",
"branch": "main",
"ref": "refs/heads/main",
"base_ref": "",
"host": "ed95dcc0687c",
"runtime": "",
Expand Down Expand Up @@ -98,8 +98,8 @@ const (
"author": "OctoKitty",
"email": "[email protected]",
"link": "https://vela.example.company.com/github/octocat/1",
"branch": "master",
"ref": "refs/heads/master",
"branch": "main",
"ref": "refs/heads/main",
"base_ref": "",
"host": "82823eb770b0",
"runtime": "",
Expand Down
6 changes: 3 additions & 3 deletions mock/server/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
"url": "https://api.github.com/repos/github/octocat/deployments/1",
"user": "octocat",
"commit": "48afb5bdc41ad69bf22588491333f7cf71135163",
"ref": "master",
"ref": "main",
"task": "deploy:vela",
"target": "production",
"description": "Deployment request from Vela"
Expand All @@ -35,7 +35,7 @@ const (
"url": "https://api.github.com/repos/github/octocat/deployments/2",
"user": "octocat",
"commit": "48afb5bdc41ad69bf22588491333f7cf71135163",
"ref": "master",
"ref": "main",
"task": "deploy:vela",
"target": "production",
"description": "Deployment request from Vela"
Expand All @@ -46,7 +46,7 @@ const (
"url": "https://api.github.com/repos/github/octocat/deployments/1",
"user": "octocat",
"commit": "48afb5bdc41ad69bf22588491333f7cf71135163",
"ref": "master",
"ref": "main",
"task": "deploy:vela",
"target": "production",
"description": "Deployment request from Vela"
Expand Down
6 changes: 3 additions & 3 deletions mock/server/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
"created": 1563475419,
"host": "github.com",
"event": "push",
"branch": "master",
"branch": "main",
"error": "",
"status": "success",
"link": "https://github.com/github/octocat/settings/hooks/1"
Expand All @@ -42,7 +42,7 @@ const (
"created": 1563475420,
"host": "github.com",
"event": "push",
"branch": "master",
"branch": "main",
"error": "",
"status": "success",
"link": "https://github.com/github/octocat/settings/hooks/1"
Expand All @@ -56,7 +56,7 @@ const (
"created": 1563475419,
"host": "github.com",
"event": "push",
"branch": "master",
"branch": "main",
"error": "",
"status": "success",
"link": "https://github.com/github/octocat/settings/hooks/1"
Expand Down
6 changes: 3 additions & 3 deletions mock/server/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ templates:
"commit": "48afb5bdc41ad69bf22588491333f7cf71135163",
"flavor": "",
"platform": "",
"ref": "refs/heads/master",
"ref": "refs/heads/main",
"type": "yaml",
"version": "1",
"external_secrets": false,
Expand All @@ -130,7 +130,7 @@ templates:
"commit": "a49aaf4afae6431a79239c95247a2b169fd9f067",
"flavor": "",
"platform": "",
"ref": "refs/heads/master",
"ref": "refs/heads/main",
"type": "yaml",
"version": "1",
"external_secrets": false,
Expand All @@ -147,7 +147,7 @@ templates:
"commit": "48afb5bdc41ad69bf22588491333f7cf71135163",
"flavor": "",
"platform": "",
"ref": "refs/heads/master",
"ref": "refs/heads/main",
"type": "yaml",
"version": "1",
"external_secrets": false,
Expand Down
Loading

0 comments on commit ae4356a

Please sign in to comment.