From 1a135e8e415e0f35e69a5d508d9ea6a258a4a7c5 Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:30:50 -0500 Subject: [PATCH] chore(deps): upgrade gorm and pull in types v0.23.1 (#1068) * chore(deps): upgrade gorm and pull in types v0.23.1 * clean --- database/build/get_repo_test.go | 2 +- database/build/get_test.go | 2 +- database/build/last_repo_test.go | 2 +- database/build/list_org_test.go | 6 +++--- database/build/list_repo_test.go | 2 +- database/deployment/get_repo_test.go | 2 +- database/deployment/get_test.go | 2 +- database/deployment/list_repo_test.go | 2 +- database/hook/get_repo_test.go | 2 +- database/hook/get_test.go | 2 +- database/hook/get_webhook_test.go | 2 +- database/hook/last_repo_test.go | 2 +- database/hook/list_repo_test.go | 2 +- database/log/get_service_test.go | 2 +- database/log/get_step_test.go | 2 +- database/log/get_test.go | 2 +- database/log/list_build_test.go | 2 +- database/pipeline/get_repo_test.go | 2 +- database/pipeline/get_test.go | 2 +- database/pipeline/list_repo_test.go | 2 +- database/repo/get_org_test.go | 2 +- database/repo/get_test.go | 2 +- database/repo/list_org_test.go | 4 ++-- database/repo/list_user_test.go | 4 ++-- database/schedule/get_repo_test.go | 2 +- database/schedule/get_test.go | 2 +- database/schedule/list_repo_test.go | 2 +- database/secret/get_org_test.go | 4 ++-- database/secret/get_repo_test.go | 4 ++-- database/secret/get_team_test.go | 4 ++-- database/secret/get_test.go | 2 +- database/secret/list_org_test.go | 4 ++-- database/secret/list_repo_test.go | 4 ++-- database/secret/list_team_test.go | 8 ++++---- database/service/get_build_test.go | 2 +- database/service/get_test.go | 2 +- database/service/list_build_test.go | 2 +- database/step/get_build_test.go | 2 +- database/step/get_test.go | 2 +- database/step/list_build_test.go | 2 +- database/user/get_name_test.go | 2 +- database/user/get_test.go | 2 +- database/user/list_lite_test.go | 2 +- database/worker/get_hostname_test.go | 2 +- database/worker/get_test.go | 2 +- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 47 files changed, 69 insertions(+), 69 deletions(-) diff --git a/database/build/get_repo_test.go b/database/build/get_repo_test.go index 5e4a46129..c34fa8a2e 100644 --- a/database/build/get_repo_test.go +++ b/database/build/get_repo_test.go @@ -38,7 +38,7 @@ func TestBuild_Engine_GetBuildForRepo(t *testing.T) { AddRow(1, 1, nil, 1, 0, "", "", "", "", 0, 0, 0, 0, "", 0, nil, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "builds" WHERE repo_id = $1 AND number = $2 LIMIT 1`).WithArgs(1, 1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "builds" WHERE repo_id = $1 AND number = $2 LIMIT $3`).WithArgs(1, 1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/build/get_test.go b/database/build/get_test.go index a9c8b822a..d48efa243 100644 --- a/database/build/get_test.go +++ b/database/build/get_test.go @@ -28,7 +28,7 @@ func TestBuild_Engine_GetBuild(t *testing.T) { AddRow(1, 1, nil, 1, 0, "", "", "", "", 0, 0, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, "", 0) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "builds" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "builds" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/build/last_repo_test.go b/database/build/last_repo_test.go index b6ec48842..7baebe01d 100644 --- a/database/build/last_repo_test.go +++ b/database/build/last_repo_test.go @@ -38,7 +38,7 @@ func TestBuild_Engine_LastBuildForRepo(t *testing.T) { AddRow(1, 1, nil, 1, 0, "", "", "", "", 0, 0, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "main", "", "", "", "", "", "", 0, "", 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, "main").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "builds" WHERE repo_id = $1 AND branch = $2 ORDER BY number DESC LIMIT $3`).WithArgs(1, "main", 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/build/list_org_test.go b/database/build/list_org_test.go index c12c2aa08..718517d3d 100644 --- a/database/build/list_org_test.go +++ b/database/build/list_org_test.go @@ -64,7 +64,7 @@ func TestBuild_Engine_ListBuildsForOrg(t *testing.T) { AddRow(1, 1, nil, 1, 0, "push", "", "", "", 0, 0, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, "", 0). AddRow(2, 2, nil, 2, 0, "push", "", "", "", 0, 0, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, "", 0) // ensure the mock expects the query without filters - _mock.ExpectQuery(`SELECT builds.* FROM "builds" JOIN repos ON builds.repo_id = repos.id WHERE repos.org = $1 ORDER BY created DESC,id LIMIT 10`).WithArgs("foo").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT builds.* FROM "builds" JOIN repos ON builds.repo_id = repos.id WHERE repos.org = $1 ORDER BY created DESC,id LIMIT $2`).WithArgs("foo", 10).WillReturnRows(_rows) // create expected count query with event filter result in mock _rows = sqlmock.NewRows([]string{"count"}).AddRow(2) @@ -76,7 +76,7 @@ func TestBuild_Engine_ListBuildsForOrg(t *testing.T) { AddRow(1, 1, nil, 1, 0, "push", "", "", "", 0, 0, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, "", 0). AddRow(2, 2, nil, 2, 0, "push", "", "", "", 0, 0, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, "", 0) // ensure the mock expects the query with event filter - _mock.ExpectQuery(`SELECT builds.* FROM "builds" JOIN repos ON builds.repo_id = repos.id WHERE repos.org = $1 AND "event" = $2 ORDER BY created DESC,id LIMIT 10`).WithArgs("foo", "push").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT builds.* FROM "builds" JOIN repos ON builds.repo_id = repos.id WHERE repos.org = $1 AND "event" = $2 ORDER BY created DESC,id LIMIT $3`).WithArgs("foo", "push", 10).WillReturnRows(_rows) // create expected count query with visibility filter result in mock _rows = sqlmock.NewRows([]string{"count"}).AddRow(2) @@ -88,7 +88,7 @@ func TestBuild_Engine_ListBuildsForOrg(t *testing.T) { AddRow(1, 1, nil, 1, 0, "push", "", "", "", 0, 0, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, "", 0). AddRow(2, 2, nil, 2, 0, "push", "", "", "", 0, 0, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, "", 0) // ensure the mock expects the query with visibility filter - _mock.ExpectQuery(`SELECT builds.* FROM "builds" JOIN repos ON builds.repo_id = repos.id WHERE repos.org = $1 AND "visibility" = $2 ORDER BY created DESC,id LIMIT 10`).WithArgs("foo", "public").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT builds.* FROM "builds" JOIN repos ON builds.repo_id = repos.id WHERE repos.org = $1 AND "visibility" = $2 ORDER BY created DESC,id LIMIT $3`).WithArgs("foo", "public", 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/build/list_repo_test.go b/database/build/list_repo_test.go index 4da425473..4cb4622a5 100644 --- a/database/build/list_repo_test.go +++ b/database/build/list_repo_test.go @@ -53,7 +53,7 @@ func TestBuild_Engine_ListBuildsForRepo(t *testing.T) { AddRow(1, 1, nil, 1, 0, "", "", "", "", 0, 1, 0, 0, "", nil, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, "", 0) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "builds" WHERE repo_id = $1 AND created < $2 AND created > $3 ORDER BY number DESC LIMIT 10`).WithArgs(1, AnyArgument{}, 0).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "builds" WHERE repo_id = $1 AND created < $2 AND created > $3 ORDER BY number DESC LIMIT $4`).WithArgs(1, AnyArgument{}, 0, 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/deployment/get_repo_test.go b/database/deployment/get_repo_test.go index 3a6458ece..5ddbb61d5 100644 --- a/database/deployment/get_repo_test.go +++ b/database/deployment/get_repo_test.go @@ -46,7 +46,7 @@ func TestDeployment_Engine_GetDeploymentForRepo(t *testing.T) { AddRow(1, 1, 1, "https://github.com/github/octocat/deployments/1", "48afb5bdc41ad69bf22588491333f7cf71135163", "refs/heads/master", "vela-deploy", "production", "Deployment request from Vela", "{\"foo\":\"test1\"}", 1, "octocat", "{}") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "deployments" WHERE repo_id = $1 AND number = $2 LIMIT 1`).WithArgs(1, 1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "deployments" WHERE repo_id = $1 AND number = $2 LIMIT $3`).WithArgs(1, 1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/deployment/get_test.go b/database/deployment/get_test.go index d962c798a..b557e9330 100644 --- a/database/deployment/get_test.go +++ b/database/deployment/get_test.go @@ -39,7 +39,7 @@ func TestDeployment_Engine_GetDeployment(t *testing.T) { AddRow(1, 1, 1, "https://github.com/github/octocat/deployments/1", "48afb5bdc41ad69bf22588491333f7cf71135163", "refs/heads/master", "vela-deploy", "production", "Deployment request from Vela", "{\"foo\":\"test1\"}", 1, "octocat", "{}") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "deployments" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "deployments" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/deployment/list_repo_test.go b/database/deployment/list_repo_test.go index 3297a4c4e..a62948b17 100644 --- a/database/deployment/list_repo_test.go +++ b/database/deployment/list_repo_test.go @@ -60,7 +60,7 @@ func TestDeployment_Engine_ListDeploymentsForRepo(t *testing.T) { AddRow(1, 1, 1, "https://github.com/github/octocat/deployments/1", "48afb5bdc41ad69bf22588491333f7cf71135163", "refs/heads/master", "vela-deploy", "production", "Deployment request from Vela", "{\"foo\":\"test1\"}", 1, "octocat", "{}") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "deployments" WHERE repo_id = $1 ORDER BY number DESC LIMIT 10`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "deployments" WHERE repo_id = $1 ORDER BY number DESC LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/hook/get_repo_test.go b/database/hook/get_repo_test.go index 979755d2b..e7c33c2d8 100644 --- a/database/hook/get_repo_test.go +++ b/database/hook/get_repo_test.go @@ -37,7 +37,7 @@ func TestHook_Engine_GetHookForRepo(t *testing.T) { AddRow(1, 1, 1, 1, "c8da1302-07d6-11ea-882f-4893bca275b8", 0, "", "", "", "", "", "", "", 1) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "hooks" WHERE repo_id = $1 AND number = $2 LIMIT 1`).WithArgs(1, 1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "hooks" WHERE repo_id = $1 AND number = $2 LIMIT $3`).WithArgs(1, 1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/hook/get_test.go b/database/hook/get_test.go index 548d64989..e5183fd62 100644 --- a/database/hook/get_test.go +++ b/database/hook/get_test.go @@ -30,7 +30,7 @@ func TestHook_Engine_GetHook(t *testing.T) { ).AddRow(1, 1, 1, 1, "c8da1302-07d6-11ea-882f-4893bca275b8", 0, "", "", "", "", "", "", "", 1) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "hooks" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "hooks" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/hook/get_webhook_test.go b/database/hook/get_webhook_test.go index 61f849315..57ced48f5 100644 --- a/database/hook/get_webhook_test.go +++ b/database/hook/get_webhook_test.go @@ -30,7 +30,7 @@ func TestHook_Engine_GetHookByWebhookID(t *testing.T) { ).AddRow(1, 1, 1, 1, "c8da1302-07d6-11ea-882f-4893bca275b8", 0, "", "", "", "", "", "", "", 123456) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "hooks" WHERE webhook_id = $1 LIMIT 1`).WithArgs(123456).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "hooks" WHERE webhook_id = $1 LIMIT $2`).WithArgs(123456, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/hook/last_repo_test.go b/database/hook/last_repo_test.go index 25e794073..b7911f91d 100644 --- a/database/hook/last_repo_test.go +++ b/database/hook/last_repo_test.go @@ -37,7 +37,7 @@ func TestHook_Engine_LastHookForRepo(t *testing.T) { AddRow(1, 1, 1, 1, "c8da1302-07d6-11ea-882f-4893bca275b8", 0, "", "", "", "", "", "", "", 1) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "hooks" WHERE repo_id = $1 ORDER BY number DESC LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "hooks" WHERE repo_id = $1 ORDER BY number DESC LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/hook/list_repo_test.go b/database/hook/list_repo_test.go index 20c1c9152..38e72a93f 100644 --- a/database/hook/list_repo_test.go +++ b/database/hook/list_repo_test.go @@ -52,7 +52,7 @@ func TestHook_Engine_ListHooksForRepo(t *testing.T) { AddRow(1, 1, 1, 1, "c8da1302-07d6-11ea-882f-4893bca275b8", 0, "", "", "", "", "", "", "", 1) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "hooks" WHERE repo_id = $1 ORDER BY id DESC LIMIT 10`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "hooks" WHERE repo_id = $1 ORDER BY id DESC LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/log/get_service_test.go b/database/log/get_service_test.go index df998ffc1..e6c9cde8c 100644 --- a/database/log/get_service_test.go +++ b/database/log/get_service_test.go @@ -36,7 +36,7 @@ func TestLog_Engine_GetLogForService(t *testing.T) { AddRow(1, 1, 1, 1, 0, []byte{}) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "logs" WHERE service_id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "logs" WHERE service_id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/log/get_step_test.go b/database/log/get_step_test.go index a6b3e324a..5eea62f56 100644 --- a/database/log/get_step_test.go +++ b/database/log/get_step_test.go @@ -36,7 +36,7 @@ func TestLog_Engine_GetLogForStep(t *testing.T) { AddRow(1, 1, 1, 0, 1, []byte{}) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "logs" WHERE step_id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "logs" WHERE step_id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/log/get_test.go b/database/log/get_test.go index a7ab5c2d1..db88112b0 100644 --- a/database/log/get_test.go +++ b/database/log/get_test.go @@ -29,7 +29,7 @@ func TestLog_Engine_GetLog(t *testing.T) { AddRow(1, 1, 1, 0, 1, []byte{}) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "logs" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "logs" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/log/list_build_test.go b/database/log/list_build_test.go index 2f1dde7e5..f18765ec3 100644 --- a/database/log/list_build_test.go +++ b/database/log/list_build_test.go @@ -48,7 +48,7 @@ func TestLog_Engine_ListLogsForBuild(t *testing.T) { AddRow(1, 1, 1, 1, 0, []byte{}).AddRow(2, 1, 1, 0, 1, []byte{}) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "logs" WHERE build_id = $1 ORDER BY service_id ASC NULLS LAST,step_id ASC LIMIT 10`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "logs" WHERE build_id = $1 ORDER BY service_id ASC NULLS LAST,step_id ASC LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/pipeline/get_repo_test.go b/database/pipeline/get_repo_test.go index e01a4514d..82b9669da 100644 --- a/database/pipeline/get_repo_test.go +++ b/database/pipeline/get_repo_test.go @@ -31,7 +31,7 @@ func TestPipeline_Engine_GetPipelineForRepo(t *testing.T) { 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) + _mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE repo_id = $1 AND "commit" = $2 LIMIT $3`).WithArgs(1, "48afb5bdc41ad69bf22588491333f7cf71135163", 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/pipeline/get_test.go b/database/pipeline/get_test.go index 61119e6bb..d90404c33 100644 --- a/database/pipeline/get_test.go +++ b/database/pipeline/get_test.go @@ -31,7 +31,7 @@ func TestPipeline_Engine_GetPipeline(t *testing.T) { 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) + _mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/pipeline/list_repo_test.go b/database/pipeline/list_repo_test.go index 840d4bd6b..aec274702 100644 --- a/database/pipeline/list_repo_test.go +++ b/database/pipeline/list_repo_test.go @@ -47,7 +47,7 @@ func TestPipeline_Engine_ListPipelinesForRepo(t *testing.T) { 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 - _mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE repo_id = $1 LIMIT 10`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE repo_id = $1 LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/repo/get_org_test.go b/database/repo/get_org_test.go index 51169d971..95e6d6a32 100644 --- a/database/repo/get_org_test.go +++ b/database/repo/get_org_test.go @@ -34,7 +34,7 @@ func TestRepo_Engine_GetRepoForOrg(t *testing.T) { AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", "", "") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "repos" WHERE org = $1 AND name = $2 LIMIT 1`).WithArgs("foo", "bar").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "repos" WHERE org = $1 AND name = $2 LIMIT $3`).WithArgs("foo", "bar", 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/repo/get_test.go b/database/repo/get_test.go index 9c9149d67..7a4fcdba8 100644 --- a/database/repo/get_test.go +++ b/database/repo/get_test.go @@ -34,7 +34,7 @@ func TestRepo_Engine_GetRepo(t *testing.T) { AddRow(1, 1, "baz", "foo", "bar", "foo/bar", "", "", "", "{}", 0, 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", "", "") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "repos" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "repos" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/repo/list_org_test.go b/database/repo/list_org_test.go index d432bcfbb..5d6bfb99f 100644 --- a/database/repo/list_org_test.go +++ b/database/repo/list_org_test.go @@ -68,7 +68,7 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) { AddRow(2, 1, "bar", "foo", "baz", "foo/baz", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil) // ensure the mock expects the name query - _mock.ExpectQuery(`SELECT * FROM "repos" WHERE org = $1 ORDER BY name LIMIT 10`).WithArgs("foo").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "repos" WHERE org = $1 ORDER BY name LIMIT $2`).WithArgs("foo", 10).WillReturnRows(_rows) // create expected latest count query result in mock _rows = sqlmock.NewRows([]string{"count"}).AddRow(2) @@ -83,7 +83,7 @@ func TestRepo_Engine_ListReposForOrg(t *testing.T) { AddRow(2, 1, "bar", "foo", "baz", "foo/baz", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil) // ensure the mock expects the latest query - _mock.ExpectQuery(`SELECT repos.* FROM "repos" LEFT JOIN (SELECT repos.id, MAX(builds.created) AS latest_build FROM "builds" INNER JOIN repos repos ON builds.repo_id = repos.id WHERE repos.org = $1 GROUP BY "repos"."id") t on repos.id = t.id ORDER BY latest_build DESC NULLS LAST LIMIT 10`).WithArgs("foo").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT repos.* FROM "repos" LEFT JOIN (SELECT repos.id, MAX(builds.created) AS latest_build FROM "builds" INNER JOIN repos repos ON builds.repo_id = repos.id WHERE repos.org = $1 GROUP BY "repos"."id") t on repos.id = t.id ORDER BY latest_build DESC NULLS LAST LIMIT $2`).WithArgs("foo", 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/repo/list_user_test.go b/database/repo/list_user_test.go index e7a606982..a387c4e5a 100644 --- a/database/repo/list_user_test.go +++ b/database/repo/list_user_test.go @@ -73,7 +73,7 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) { AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil) // ensure the mock expects the name query - _mock.ExpectQuery(`SELECT * FROM "repos" WHERE user_id = $1 ORDER BY name LIMIT 10`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "repos" WHERE user_id = $1 ORDER BY name LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) // create expected latest count query result in mock _rows = sqlmock.NewRows([]string{"count"}).AddRow(2) @@ -88,7 +88,7 @@ func TestRepo_Engine_ListReposForUser(t *testing.T) { AddRow(2, 1, "baz", "bar", "foo", "bar/foo", "", "", "", "{}", 0, 0, "public", false, false, false, false, false, false, false, false, 1, "yaml", nil, nil) // ensure the mock expects the latest query - _mock.ExpectQuery(`SELECT repos.* FROM "repos" LEFT JOIN (SELECT repos.id, MAX(builds.created) AS latest_build FROM "builds" INNER JOIN repos repos ON builds.repo_id = repos.id WHERE repos.user_id = $1 GROUP BY "repos"."id") t on repos.id = t.id ORDER BY latest_build DESC NULLS LAST LIMIT 10`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT repos.* FROM "repos" LEFT JOIN (SELECT repos.id, MAX(builds.created) AS latest_build FROM "builds" INNER JOIN repos repos ON builds.repo_id = repos.id WHERE repos.user_id = $1 GROUP BY "repos"."id") t on repos.id = t.id ORDER BY latest_build DESC NULLS LAST LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/schedule/get_repo_test.go b/database/schedule/get_repo_test.go index f21c11fb0..3745976b7 100644 --- a/database/schedule/get_repo_test.go +++ b/database/schedule/get_repo_test.go @@ -38,7 +38,7 @@ func TestSchedule_Engine_GetScheduleForRepo(t *testing.T) { ).AddRow(1, 1, false, "nightly", "0 0 * * *", 1, "user1", 1, "user2", nil, "main") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "schedules" WHERE repo_id = $1 AND name = $2 LIMIT 1`).WithArgs(1, "nightly").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "schedules" WHERE repo_id = $1 AND name = $2 LIMIT $3`).WithArgs(1, "nightly", 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/schedule/get_test.go b/database/schedule/get_test.go index 55b9321ea..d229f8cf1 100644 --- a/database/schedule/get_test.go +++ b/database/schedule/get_test.go @@ -32,7 +32,7 @@ func TestSchedule_Engine_GetSchedule(t *testing.T) { ).AddRow(1, 1, false, "nightly", "0 0 * * *", 1, "user1", 1, "user2", nil, "main") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "schedules" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "schedules" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/schedule/list_repo_test.go b/database/schedule/list_repo_test.go index baddeef6a..890f0f393 100644 --- a/database/schedule/list_repo_test.go +++ b/database/schedule/list_repo_test.go @@ -55,7 +55,7 @@ func TestSchedule_Engine_ListSchedulesForRepo(t *testing.T) { AddRow(1, 1, false, "nightly", "0 0 * * *", 1, "user1", 1, "user2", nil, "main") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "schedules" WHERE repo_id = $1 ORDER BY id DESC LIMIT 10`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "schedules" WHERE repo_id = $1 ORDER BY id DESC LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/secret/get_org_test.go b/database/secret/get_org_test.go index 71b65bf09..dec38ba8a 100644 --- a/database/secret/get_org_test.go +++ b/database/secret/get_org_test.go @@ -36,8 +36,8 @@ func TestSecret_Engine_GetSecretForOrg(t *testing.T) { AddRow(1, "org", "foo", "*", "", "baz", "bar", nil, nil, 1, false, 1, "user", 1, "user2") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND name = $3 LIMIT 1`). - WithArgs(constants.SecretOrg, "foo", "baz").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND name = $3 LIMIT $4`). + WithArgs(constants.SecretOrg, "foo", "baz", 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/secret/get_repo_test.go b/database/secret/get_repo_test.go index b3136ac1b..3f0282a6b 100644 --- a/database/secret/get_repo_test.go +++ b/database/secret/get_repo_test.go @@ -46,8 +46,8 @@ func TestSecret_Engine_GetSecretForRepo(t *testing.T) { AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, nil, 1, false, 1, "user", 1, "user2") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND repo = $3 AND name = $4 LIMIT 1`). - WithArgs(constants.SecretRepo, "foo", "bar", "baz").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND repo = $3 AND name = $4 LIMIT $5`). + WithArgs(constants.SecretRepo, "foo", "bar", "baz", 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/secret/get_team_test.go b/database/secret/get_team_test.go index 696cd2a37..e36674a35 100644 --- a/database/secret/get_team_test.go +++ b/database/secret/get_team_test.go @@ -36,8 +36,8 @@ func TestSecret_Engine_GetSecretForTeam(t *testing.T) { AddRow(1, "shared", "foo", "", "bar", "baz", "foob", nil, nil, 1, false, 1, "user", 1, "user2") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND team = $3 AND name = $4 LIMIT 1`). - WithArgs(constants.SecretShared, "foo", "bar", "baz").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND team = $3 AND name = $4 LIMIT $5`). + WithArgs(constants.SecretShared, "foo", "bar", "baz", 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/secret/get_test.go b/database/secret/get_test.go index c44175f86..979f626e0 100644 --- a/database/secret/get_test.go +++ b/database/secret/get_test.go @@ -35,7 +35,7 @@ func TestSecret_Engine_GetSecret(t *testing.T) { AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, nil, 1, false, 1, "user", 1, "user2") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/secret/list_org_test.go b/database/secret/list_org_test.go index 11967cd7d..9fe2da2e1 100644 --- a/database/secret/list_org_test.go +++ b/database/secret/list_org_test.go @@ -57,8 +57,8 @@ func TestSecret_Engine_ListSecretsForOrg(t *testing.T) { AddRow(1, "org", "foo", "*", "", "baz", "bar", nil, nil, 1, false, 1, "user", 1, "user2") // ensure the mock expects the name query - _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 ORDER BY id DESC LIMIT 10`). - WithArgs(constants.SecretOrg, "foo").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 ORDER BY id DESC LIMIT $3`). + WithArgs(constants.SecretOrg, "foo", 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/secret/list_repo_test.go b/database/secret/list_repo_test.go index 77d2d930f..838dd96f9 100644 --- a/database/secret/list_repo_test.go +++ b/database/secret/list_repo_test.go @@ -68,8 +68,8 @@ func TestSecret_Engine_ListSecretsForRepo(t *testing.T) { AddRow(1, "repo", "foo", "bar", "", "baz", "foob", nil, nil, 1, false, 1, "user", 1, "user2") // ensure the mock expects the name query - _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND repo = $3 ORDER BY id DESC LIMIT 10`). - WithArgs(constants.SecretRepo, "foo", "bar").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND repo = $3 ORDER BY id DESC LIMIT $4`). + WithArgs(constants.SecretRepo, "foo", "bar", 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/secret/list_team_test.go b/database/secret/list_team_test.go index 071ac371b..bed709312 100644 --- a/database/secret/list_team_test.go +++ b/database/secret/list_team_test.go @@ -58,8 +58,8 @@ func TestSecret_Engine_ListSecretsForTeam(t *testing.T) { AddRow(1, "shared", "foo", "", "bar", "baz", "foob", nil, nil, 1, false, 1, "user", 1, "user2") // ensure the mock expects the name query - _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND team = $3 ORDER BY id DESC LIMIT 10`). - WithArgs(constants.SecretShared, "foo", "bar").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND team = $3 ORDER BY id DESC LIMIT $4`). + WithArgs(constants.SecretShared, "foo", "bar", 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() @@ -164,8 +164,8 @@ func TestSecret_Engine_ListSecretsForTeams(t *testing.T) { AddRow(1, "shared", "foo", "", "bar", "baz", "foob", nil, nil, false, 1, "user", 1, "user2") // ensure the mock expects the name query - _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND LOWER(team) IN ($3,$4) ORDER BY id DESC LIMIT 10`). - WithArgs(constants.SecretShared, "foo", "foo", "bar").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "secrets" WHERE type = $1 AND org = $2 AND LOWER(team) IN ($3,$4) ORDER BY id DESC LIMIT $5`). + WithArgs(constants.SecretShared, "foo", "foo", "bar", 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/service/get_build_test.go b/database/service/get_build_test.go index cd188c818..b8f859649 100644 --- a/database/service/get_build_test.go +++ b/database/service/get_build_test.go @@ -35,7 +35,7 @@ func TestService_Engine_GetServiceForBuild(t *testing.T) { AddRow(1, 1, 1, 1, "foo", "bar", "", "", "", 0, 0, 0, 0, "", "", "") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "services" WHERE build_id = $1 AND number = $2 LIMIT 1`).WithArgs(1, 1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "services" WHERE build_id = $1 AND number = $2 LIMIT $3`).WithArgs(1, 1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/service/get_test.go b/database/service/get_test.go index e5d694b9c..8aa8961e5 100644 --- a/database/service/get_test.go +++ b/database/service/get_test.go @@ -30,7 +30,7 @@ func TestService_Engine_GetService(t *testing.T) { AddRow(1, 1, 1, 1, "foo", "bar", "", "", "", 0, 0, 0, 0, "", "", "") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "services" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "services" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/service/list_build_test.go b/database/service/list_build_test.go index 64ad9b1b2..f33e98ac3 100644 --- a/database/service/list_build_test.go +++ b/database/service/list_build_test.go @@ -50,7 +50,7 @@ func TestService_Engine_ListServicesForBuild(t *testing.T) { AddRow(1, 1, 1, 1, "foo", "bar", "", "", "", 0, 0, 0, 0, "", "", "") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "services" WHERE build_id = $1 ORDER BY id DESC LIMIT 10`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "services" WHERE build_id = $1 ORDER BY id DESC LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/step/get_build_test.go b/database/step/get_build_test.go index 13353178e..55669735c 100644 --- a/database/step/get_build_test.go +++ b/database/step/get_build_test.go @@ -38,7 +38,7 @@ func TestStep_Engine_GetStepForBuild(t *testing.T) { AddRow(1, 1, 1, 1, "foo", "bar", "", "", "", 0, 0, 0, 0, "", "", "") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "steps" WHERE build_id = $1 AND number = $2 LIMIT 1`).WithArgs(1, 1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "steps" WHERE build_id = $1 AND number = $2 LIMIT $3`).WithArgs(1, 1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/step/get_test.go b/database/step/get_test.go index 832108d3f..762e69988 100644 --- a/database/step/get_test.go +++ b/database/step/get_test.go @@ -31,7 +31,7 @@ func TestStep_Engine_GetStep(t *testing.T) { AddRow(1, 1, 1, 1, "foo", "bar", "", "", "", 0, 0, 0, 0, "", "", "") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "steps" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "steps" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/step/list_build_test.go b/database/step/list_build_test.go index 2f00ba1d6..db53531c2 100644 --- a/database/step/list_build_test.go +++ b/database/step/list_build_test.go @@ -52,7 +52,7 @@ func TestStep_Engine_ListStepsForBuild(t *testing.T) { AddRow(1, 1, 1, 1, "foo", "bar", "", "", "", 0, 0, 0, 0, "", "", "") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "steps" WHERE build_id = $1 ORDER BY id DESC LIMIT 10`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "steps" WHERE build_id = $1 ORDER BY id DESC LIMIT $2`).WithArgs(1, 10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/user/get_name_test.go b/database/user/get_name_test.go index 855fdfaaa..621a75c87 100644 --- a/database/user/get_name_test.go +++ b/database/user/get_name_test.go @@ -29,7 +29,7 @@ func TestUser_Engine_GetUserForName(t *testing.T) { AddRow(1, "foo", "", "bar", "baz", "{}", false, false) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "users" WHERE name = $1 LIMIT 1`).WithArgs("foo").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "users" WHERE name = $1 LIMIT $2`).WithArgs("foo", 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/user/get_test.go b/database/user/get_test.go index 8ad1b3c77..f879b8bd9 100644 --- a/database/user/get_test.go +++ b/database/user/get_test.go @@ -29,7 +29,7 @@ func TestUser_Engine_GetUser(t *testing.T) { AddRow(1, "foo", "", "bar", "baz", "{}", false, false) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "users" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "users" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/user/list_lite_test.go b/database/user/list_lite_test.go index 2f3a12dc5..431b7705b 100644 --- a/database/user/list_lite_test.go +++ b/database/user/list_lite_test.go @@ -43,7 +43,7 @@ func TestUser_Engine_ListLiteUsers(t *testing.T) { AddRow(2, "baz") // ensure the mock expects the query - _mock.ExpectQuery(`SELECT "id","name" FROM "users" LIMIT 10`).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT "id","name" FROM "users" LIMIT $1`).WithArgs(10).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/worker/get_hostname_test.go b/database/worker/get_hostname_test.go index fc4802d70..cf264ab0c 100644 --- a/database/worker/get_hostname_test.go +++ b/database/worker/get_hostname_test.go @@ -28,7 +28,7 @@ func TestWorker_Engine_GetWorkerForName(t *testing.T) { AddRow(1, "worker_0", "localhost", nil, true, nil, 0, nil, 0, 0, 0, 0) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "workers" WHERE hostname = $1 LIMIT 1`).WithArgs("worker_0").WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "workers" WHERE hostname = $1 LIMIT $2`).WithArgs("worker_0", 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/database/worker/get_test.go b/database/worker/get_test.go index e5249fda1..bfd9bf2a3 100644 --- a/database/worker/get_test.go +++ b/database/worker/get_test.go @@ -28,7 +28,7 @@ func TestWorker_Engine_GetWorker(t *testing.T) { AddRow(1, "worker_0", "localhost", nil, true, 0, 0) // ensure the mock expects the query - _mock.ExpectQuery(`SELECT * FROM "workers" WHERE id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows) + _mock.ExpectQuery(`SELECT * FROM "workers" WHERE id = $1 LIMIT $2`).WithArgs(1, 1).WillReturnRows(_rows) _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() diff --git a/go.mod b/go.mod index ad021da4c..b65595a3c 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/drone/envsubst v1.0.3 github.com/gin-gonic/gin v1.9.1 github.com/go-playground/assert/v2 v2.2.0 - github.com/go-vela/types v0.23.0 + github.com/go-vela/types v0.23.1 github.com/golang-jwt/jwt/v5 v5.2.0 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v59 v59.0.0 @@ -36,9 +36,9 @@ require ( golang.org/x/oauth2 v0.17.0 golang.org/x/sync v0.6.0 gopkg.in/square/go-jose.v2 v2.6.0 - gorm.io/driver/postgres v1.5.4 - gorm.io/driver/sqlite v1.5.4 - gorm.io/gorm v1.25.6 + gorm.io/driver/postgres v1.5.6 + gorm.io/driver/sqlite v1.5.5 + gorm.io/gorm v1.25.7 k8s.io/apimachinery v0.29.1 ) diff --git a/go.sum b/go.sum index 92c773dbd..660a2cff0 100644 --- a/go.sum +++ b/go.sum @@ -86,8 +86,8 @@ github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/go-vela/types v0.23.0 h1:CWICreHO4V9KqbE+AINkRJVwCZmggxOLIZh+e1n/XXA= -github.com/go-vela/types v0.23.0/go.mod h1:AAqgxIw1aRBgPkE/5juGuiwh/JZuOtL8fcPaEkjFWwQ= +github.com/go-vela/types v0.23.1 h1:st4BeDcYVyaaFqblU1YroztNvmYLBgmfZpWq0En0Sg0= +github.com/go-vela/types v0.23.1/go.mod h1:AAqgxIw1aRBgPkE/5juGuiwh/JZuOtL8fcPaEkjFWwQ= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -370,12 +370,12 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/postgres v1.5.4 h1:Iyrp9Meh3GmbSuyIAGyjkN+n9K+GHX9b9MqsTL4EJCo= -gorm.io/driver/postgres v1.5.4/go.mod h1:Bgo89+h0CRcdA33Y6frlaHHVuTdOf87pmyzwW9C/BH0= -gorm.io/driver/sqlite v1.5.4 h1:IqXwXi8M/ZlPzH/947tn5uik3aYQslP9BVveoax0nV0= -gorm.io/driver/sqlite v1.5.4/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4= -gorm.io/gorm v1.25.6 h1:V92+vVda1wEISSOMtodHVRcUIOPYa2tgQtyF+DfFx+A= -gorm.io/gorm v1.25.6/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/driver/postgres v1.5.6 h1:ydr9xEd5YAM0vxVDY0X139dyzNz10spDiDlC7+ibLeU= +gorm.io/driver/postgres v1.5.6/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA= +gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E= +gorm.io/driver/sqlite v1.5.5/go.mod h1:6NgQ7sQWAIFsPrJJl1lSNSu2TABh0ZZ/zm5fosATavE= +gorm.io/gorm v1.25.7 h1:VsD6acwRjz2zFxGO50gPO6AkNs7KKnvfzUjHQhZDz/A= +gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= k8s.io/apimachinery v0.29.1 h1:KY4/E6km/wLBguvCZv8cKTeOwwOBqFNjwJIdMkMbbRc= k8s.io/apimachinery v0.29.1/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0=