Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
9186ca1
feat(database): add support for pipelines
jbrockopp Jan 19, 2022
e9e05bd
chore: update copyright year to 2022
jbrockopp Jan 19, 2022
0a28d42
chore: cleanup comments and imports
jbrockopp Jan 19, 2022
1ab6afe
enhance(pipeline): add fields for secrets
jbrockopp Jan 21, 2022
57e5162
Merge branch 'master' of github.com:go-vela/server
jbrockopp Feb 23, 2022
5366bb3
chore: update go-vela/types dependency
jbrockopp Feb 25, 2022
e07e7bc
enhance(pipeline): add field for commit
jbrockopp Mar 7, 2022
66d626f
Merge branch 'master' into feature/database/pipeline
jbrockopp Mar 7, 2022
b6b840c
Merge branch 'master' of github.com:go-vela/server
jbrockopp Mar 10, 2022
858c818
Merge branch 'master' of github.com:go-vela/server
jbrockopp Mar 16, 2022
6f314e4
Merge branch 'master' into feature/database/pipeline
jbrockopp Mar 16, 2022
7b688cb
Merge branch 'feature/database/pipeline' of github.com:go-vela/server…
jbrockopp Mar 16, 2022
9a14f8c
chore: fix tests
jbrockopp Mar 17, 2022
c2fed8f
feat: add pipeline engine opts
jbrockopp Mar 17, 2022
b4589f8
refactor: structure for creating pipeline engine
jbrockopp Mar 17, 2022
35b52b6
chore: finalize pipeline engine setup
jbrockopp Mar 17, 2022
4a8f272
chore: clean up pipeline database engine
jbrockopp Mar 17, 2022
1195c76
chore: clean up imports
jbrockopp Mar 17, 2022
740e5e0
Merge branch 'feature/database/pipeline' of github.com:go-vela/server…
jbrockopp Mar 18, 2022
0ec78e3
feat(compiler): add support for pipelines
jbrockopp Mar 18, 2022
c763621
feat(api): add support for pipelines
jbrockopp Mar 18, 2022
3958114
Merge branch 'master' into feature/api/pipeline
jbrockopp Mar 18, 2022
4b5bc54
Merge branch 'master' into feature/api/pipeline
jbrockopp Mar 20, 2022
d6fe4f7
Merge branch 'feature/api/pipeline' of github.com:go-vela/server into…
jbrockopp Mar 20, 2022
29888a6
chore: address linter feedback
jbrockopp Mar 20, 2022
ceddb11
Merge branch 'master' of github.com:go-vela/server
jbrockopp Mar 28, 2022
b90e443
Merge branch 'master' into feature/api/pipeline
jbrockopp Mar 31, 2022
cb1ac35
Merge branch 'master' into feature/api/pipeline
jbrockopp Apr 11, 2022
331b2a2
Merge branch 'master' of github.com:go-vela/server
jbrockopp Apr 11, 2022
dc6c732
Merge branch 'feature/api/pipeline' of github.com:go-vela/server into…
jbrockopp Apr 11, 2022
9ee0017
chore: remove unused code
jbrockopp Apr 11, 2022
a6997a8
chore: update go-vela/types dependency
jbrockopp Apr 11, 2022
133439e
Merge branch 'master' into feature/api/pipeline
jbrockopp Apr 12, 2022
45f7fd1
Merge branch 'feature/api/pipeline' of github.com:go-vela/server into…
jbrockopp Apr 12, 2022
9c1825e
enhance: use pipeline commit instead of number
jbrockopp Apr 13, 2022
8a66a15
Merge branch 'master' into feature/api/pipeline
jbrockopp Apr 18, 2022
f858ecd
Merge branch 'feature/api/pipeline' of github.com:go-vela/server into…
jbrockopp Apr 18, 2022
be6c877
chore: remove pipeline number
jbrockopp Apr 18, 2022
c4ec5fb
Merge branches 'master' and 'master' of github.com:go-vela/server
jbrockopp Apr 18, 2022
b3423d4
chore: remove number field from pipelines
jbrockopp Apr 18, 2022
edbc030
Merge branch 'chore/pipeline/number' of github.com:go-vela/server int…
jbrockopp Apr 18, 2022
f8eb267
Merge branch 'master' into feature/api/pipeline
jbrockopp Apr 19, 2022
bfbc27f
Merge branch 'feature/api/pipeline' of github.com:go-vela/server into…
jbrockopp Apr 19, 2022
782c15f
Merge branch 'master' into feature/api/pipeline
jbrockopp Apr 20, 2022
0ef35b5
Merge branch 'feature/api/pipeline' of github.com:go-vela/server into…
jbrockopp Apr 20, 2022
a794666
fix: merge with master
jbrockopp Apr 20, 2022
159df8e
chore: clean go dependencies
jbrockopp Apr 20, 2022
760ed7c
fix(pipeline): update mocks for API changes
jbrockopp Apr 21, 2022
d973677
Merge branch 'master' into feature/api/pipeline
jbrockopp Apr 21, 2022
33d0d03
Merge branch 'master' into feature/api/pipeline
jbrockopp Apr 22, 2022
1183bd4
Merge branch 'feature/api/pipeline' of github.com:go-vela/server into…
jbrockopp Apr 22, 2022
2e147f7
chore: fix go formatting
jbrockopp Apr 22, 2022
256369e
chore: address linter feedback
jbrockopp Apr 22, 2022
c17860d
fix: mock changes for pipelines
jbrockopp Apr 22, 2022
7050468
chore: address review feedback
jbrockopp Apr 26, 2022
da3142e
enhance: add permissions to pipeline endpoints
jbrockopp Apr 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: clean up pipeline database engine
  • Loading branch information
jbrockopp committed Mar 17, 2022
commit 4a8f27219d71b738065be7156d49a0df4bc83805
4 changes: 1 addition & 3 deletions database/pipeline/count_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ func TestPipeline_Engine_CountPipelinesForRepo(t *testing.T) {
_rows := sqlmock.NewRows([]string{"count"}).AddRow(1)

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT count(*) FROM "pipelines" WHERE repo_id = $1`).
WithArgs(1).
WillReturnRows(_rows)
_mock.ExpectQuery(`SELECT count(*) FROM "pipelines" WHERE repo_id = $1`).WithArgs(1).WillReturnRows(_rows)

_sqlite := testSqlite(t)
defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }()
Expand Down
7 changes: 3 additions & 4 deletions database/pipeline/count_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ func TestPipeline_Engine_CountPipelines(t *testing.T) {
_pipelineOne.SetID(1)
_pipelineOne.SetRepoID(1)
_pipelineOne.SetNumber(1)
_pipelineOne.SetRef("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipelineOne.SetRef("refs/heads/master")
_pipelineOne.SetType("yaml")
_pipelineOne.SetVersion("1")

_pipelineTwo := testPipeline()
_pipelineTwo.SetID(2)
_pipelineTwo.SetRepoID(2)
_pipelineTwo.SetNumber(1)
_pipelineTwo.SetRef("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipelineTwo.SetRef("refs/heads/main")
_pipelineTwo.SetType("yaml")
_pipelineTwo.SetVersion("1")

Expand All @@ -36,8 +36,7 @@ func TestPipeline_Engine_CountPipelines(t *testing.T) {
_rows := sqlmock.NewRows([]string{"count"}).AddRow(2)

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT count(*) FROM "pipelines"`).
WillReturnRows(_rows)
_mock.ExpectQuery(`SELECT count(*) FROM "pipelines"`).WillReturnRows(_rows)

_sqlite := testSqlite(t)
defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }()
Expand Down
3 changes: 1 addition & 2 deletions database/pipeline/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func TestPipeline_Engine_CreatePipeline(t *testing.T) {
_pipeline.SetID(1)
_pipeline.SetRepoID(1)
_pipeline.SetNumber(1)
_pipeline.SetCommit("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipeline.SetRef("refs/heads/master")
_pipeline.SetType("yaml")
_pipeline.SetVersion("1")
Expand All @@ -31,7 +30,7 @@ func TestPipeline_Engine_CreatePipeline(t *testing.T) {
_mock.ExpectQuery(`INSERT INTO "pipelines"
("repo_id","number","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,$16) RETURNING "id"`).
WithArgs(1, 1, "48afb5bdc41ad69bf22588491333f7cf71135163", nil, nil, "refs/heads/master", "yaml", "1", false, false, false, false, false, false, AnyArgument{}, 1).
WithArgs(1, 1, nil, nil, nil, "refs/heads/master", "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 @@ -16,7 +16,7 @@ func TestPipeline_Engine_DeletePipeline(t *testing.T) {
_pipeline.SetID(1)
_pipeline.SetRepoID(1)
_pipeline.SetNumber(1)
_pipeline.SetRef("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipeline.SetRef("refs/heads/master")
_pipeline.SetType("yaml")
_pipeline.SetVersion("1")

Expand Down
19 changes: 7 additions & 12 deletions database/pipeline/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@
package pipeline

import (
"errors"

"github.com/go-vela/types/constants"
"github.com/go-vela/types/database"
"github.com/go-vela/types/library"

"gorm.io/gorm"
)

// GetPipeline gets a pipeline by ID from the database.
Expand All @@ -22,27 +18,26 @@ func (e *engine) GetPipeline(id int64) (*library.Pipeline, error) {
p := new(database.Pipeline)

// send query to the database and store result in variable
result := e.client.
err := e.client.
Table(constants.TablePipeline).
Where("id = ?", id).
Limit(1).
Scan(p)

// check if the query returned a record not found error or no rows were returned
if errors.Is(result.Error, gorm.ErrRecordNotFound) || result.RowsAffected == 0 {
return nil, gorm.ErrRecordNotFound
Scan(p).
Error
if err != nil {
return nil, err
}

// decompress data for the pipeline
//
// https://pkg.go.dev/github.com/go-vela/types/database#Pipeline.Decompress
err := p.Decompress()
err = p.Decompress()
if err != nil {
return nil, err
}

// return the decompressed pipeline
//
// https://pkg.go.dev/github.com/go-vela/types/database#Pipeline.ToLibrary
return p.ToLibrary(), result.Error
return p.ToLibrary(), nil
}
19 changes: 7 additions & 12 deletions database/pipeline/get_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
package pipeline

import (
"errors"

"github.com/go-vela/types/constants"
"github.com/go-vela/types/database"
"github.com/go-vela/types/library"
"github.com/sirupsen/logrus"

"gorm.io/gorm"
)

// GetPipelineForRepo gets a pipeline by number and repo ID from the database.
Expand All @@ -27,28 +23,27 @@ func (e *engine) GetPipelineForRepo(number int, r *library.Repo) (*library.Pipel
p := new(database.Pipeline)

// send query to the database and store result in variable
result := e.client.
err := e.client.
Table(constants.TablePipeline).
Where("repo_id = ?", r.GetID()).
Where("number = ?", number).
Limit(1).
Scan(p)

// check if the query returned a record not found error or no rows were returned
if errors.Is(result.Error, gorm.ErrRecordNotFound) || result.RowsAffected == 0 {
return nil, gorm.ErrRecordNotFound
Scan(p).
Error
if err != nil {
return nil, err
}

// decompress data for the pipeline
//
// https://pkg.go.dev/github.com/go-vela/types/database#Pipeline.Decompress
err := p.Decompress()
err = p.Decompress()
if err != nil {
return nil, err
}

// return the decompressed pipeline
//
// https://pkg.go.dev/github.com/go-vela/types/database#Pipeline.ToLibrary
return p.ToLibrary(), result.Error
return p.ToLibrary(), nil
}
9 changes: 4 additions & 5 deletions database/pipeline/get_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestPipeline_Engine_GetPipelineForRepo(t *testing.T) {
_pipeline.SetID(1)
_pipeline.SetRepoID(1)
_pipeline.SetNumber(1)
_pipeline.SetRef("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipeline.SetRef("refs/heads/master")
_pipeline.SetType("yaml")
_pipeline.SetVersion("1")
_pipeline.SetData([]byte("foo"))
Expand All @@ -28,12 +28,11 @@ func TestPipeline_Engine_GetPipelineForRepo(t *testing.T) {

// create expected result in mock
_rows := sqlmock.NewRows(
[]string{"id", "repo_id", "number", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(1, 1, 1, "", "", "48afb5bdc41ad69bf22588491333f7cf71135163", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69})
[]string{"id", "repo_id", "number", "commit", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(1, 1, 1, "", "", "", "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})

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE repo_id = $1 AND number = $2 LIMIT 1`).
WithArgs(1, 1).WillReturnRows(_rows)
_mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE repo_id = $1 AND number = $2 LIMIT 1`).WithArgs(1, 1).WillReturnRows(_rows)

_sqlite := testSqlite(t)
defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }()
Expand Down
9 changes: 4 additions & 5 deletions database/pipeline/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestPipeline_Engine_GetPipeline(t *testing.T) {
_pipeline.SetID(1)
_pipeline.SetRepoID(1)
_pipeline.SetNumber(1)
_pipeline.SetRef("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipeline.SetRef("refs/heads/master")
_pipeline.SetType("yaml")
_pipeline.SetVersion("1")
_pipeline.SetData([]byte("foo"))
Expand All @@ -28,12 +28,11 @@ func TestPipeline_Engine_GetPipeline(t *testing.T) {

// create expected result in mock
_rows := sqlmock.NewRows(
[]string{"id", "repo_id", "number", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(1, 1, 1, "", "", "48afb5bdc41ad69bf22588491333f7cf71135163", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69})
[]string{"id", "repo_id", "number", "commit", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(1, 1, 1, "", "", "", "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})

// 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 1`).WithArgs(1).WillReturnRows(_rows)

_sqlite := testSqlite(t)
defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }()
Expand Down
20 changes: 7 additions & 13 deletions database/pipeline/last_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
package pipeline

import (
"errors"

"github.com/go-vela/types/constants"
"github.com/go-vela/types/database"
"github.com/go-vela/types/library"
"github.com/sirupsen/logrus"

"gorm.io/gorm"
)

// LastPipelineForRepo gets the last pipeline by repo ID from the database.
Expand All @@ -26,29 +22,27 @@ func (e *engine) LastPipelineForRepo(r *library.Repo) (*library.Pipeline, error)
p := new(database.Pipeline)

// send query to the database and store result in variable
result := e.client.
err := e.client.
Table(constants.TablePipeline).
Where("repo_id = ?", r.GetID()).
Order("number DESC").
Limit(1).
Scan(p)

// check if the query returned a record not found error or no rows were returned
if errors.Is(result.Error, gorm.ErrRecordNotFound) || result.RowsAffected == 0 {
// the record will not exist if it's a new repo
return nil, nil
Scan(p).
Error
if err != nil {
return nil, err
}

// decompress data for the pipeline
//
// https://pkg.go.dev/github.com/go-vela/types/database#Pipeline.Decompress
err := p.Decompress()
err = p.Decompress()
if err != nil {
return nil, err
}

// return the decompressed pipeline
//
// https://pkg.go.dev/github.com/go-vela/types/database#Pipeline.ToLibrary
return p.ToLibrary(), result.Error
return p.ToLibrary(), nil
}
11 changes: 5 additions & 6 deletions database/pipeline/last_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestPipeline_Engine_LastPipelineForRepo(t *testing.T) {
_pipelineOne.SetID(1)
_pipelineOne.SetRepoID(1)
_pipelineOne.SetNumber(1)
_pipelineOne.SetRef("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipelineOne.SetRef("refs/heads/master")
_pipelineOne.SetType("yaml")
_pipelineOne.SetVersion("1")
_pipelineOne.SetData([]byte("foo"))
Expand All @@ -27,7 +27,7 @@ func TestPipeline_Engine_LastPipelineForRepo(t *testing.T) {
_pipelineTwo.SetID(2)
_pipelineTwo.SetRepoID(1)
_pipelineTwo.SetNumber(2)
_pipelineTwo.SetRef("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipelineTwo.SetRef("refs/heads/main")
_pipelineTwo.SetType("yaml")
_pipelineTwo.SetVersion("1")
_pipelineTwo.SetData([]byte("foo"))
Expand All @@ -37,12 +37,11 @@ func TestPipeline_Engine_LastPipelineForRepo(t *testing.T) {

// create expected result in mock
_rows := sqlmock.NewRows(
[]string{"id", "repo_id", "number", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(2, 1, 2, "", "", "48afb5bdc41ad69bf22588491333f7cf71135163", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69})
[]string{"id", "repo_id", "number", "commit", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(2, 1, 2, "", "", "", "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 ORDER BY number DESC LIMIT 1`).
WithArgs(1).WillReturnRows(_rows)
_mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE repo_id = $1 ORDER BY number DESC LIMIT 1`).WithArgs(1).WillReturnRows(_rows)

_sqlite := testSqlite(t)
defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }()
Expand Down
14 changes: 13 additions & 1 deletion database/pipeline/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,23 @@ func (e *engine) ListPipelines() ([]*library.Pipeline, error) {
e.logger.Trace("listing all pipelines from the database")

// variables to store query results and return value
count := int64(0)
p := new([]database.Pipeline)
pipelines := []*library.Pipeline{}

// count the results
count, err := e.CountPipelines()
if err != nil {
return nil, err
}

// short-circuit if there are no results
if count == 0 {
return pipelines, nil
}

// send query to the database and store result in variable
err := e.client.
err = e.client.
Table(constants.TablePipeline).
Find(&p).
Error
Expand Down
16 changes: 6 additions & 10 deletions database/pipeline/list_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestPipeline_Engine_ListPipelinesForRepo(t *testing.T) {
_pipelineOne.SetID(1)
_pipelineOne.SetRepoID(1)
_pipelineOne.SetNumber(1)
_pipelineOne.SetRef("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipelineOne.SetRef("refs/heads/master")
_pipelineOne.SetType("yaml")
_pipelineOne.SetVersion("1")
_pipelineOne.SetData([]byte("foo"))
Expand All @@ -27,7 +27,7 @@ func TestPipeline_Engine_ListPipelinesForRepo(t *testing.T) {
_pipelineTwo.SetID(2)
_pipelineTwo.SetRepoID(2)
_pipelineTwo.SetNumber(1)
_pipelineTwo.SetRef("48afb5bdc41ad69bf22588491333f7cf71135163")
_pipelineTwo.SetRef("refs/heads/main")
_pipelineTwo.SetType("yaml")
_pipelineTwo.SetVersion("1")
_pipelineTwo.SetData([]byte("foo"))
Expand All @@ -39,19 +39,15 @@ func TestPipeline_Engine_ListPipelinesForRepo(t *testing.T) {
_rows := sqlmock.NewRows([]string{"count"}).AddRow(1)

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT count(*) FROM "pipelines" WHERE repo_id = $1`).
WithArgs(1).
WillReturnRows(_rows)
_mock.ExpectQuery(`SELECT count(*) FROM "pipelines" WHERE repo_id = $1`).WithArgs(1).WillReturnRows(_rows)

// create expected result in mock
_rows = sqlmock.NewRows(
[]string{"id", "repo_id", "number", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(1, 1, 1, "", "", "48afb5bdc41ad69bf22588491333f7cf71135163", "yaml", "1", false, false, false, false, []byte{120, 94, 74, 203, 207, 7, 4, 0, 0, 255, 255, 2, 130, 1, 69})
[]string{"id", "repo_id", "number", "commit", "flavor", "platform", "ref", "type", "version", "services", "stages", "steps", "templates", "data"}).
AddRow(1, 1, 1, "", "", "", "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})

// ensure the mock expects the query
_mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE repo_id = $1 LIMIT 1`).
WithArgs(1).
WillReturnRows(_rows)
_mock.ExpectQuery(`SELECT * FROM "pipelines" WHERE repo_id = $1 LIMIT 1`).WithArgs(1).WillReturnRows(_rows)

_sqlite := testSqlite(t)
defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }()
Expand Down
Loading