From 6991d6a5bc4c33282e3309cbcfe1145ef5c04f88 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Tue, 23 Aug 2022 17:19:24 -0300 Subject: [PATCH 01/55] feat: update rulesheet --- controllers/v1/rulesheets.go | 12 +++++++++++- docs/docs.go | 3 +++ docs/swagger.json | 3 +++ docs/swagger.yaml | 2 ++ dtos/rulesheets.go | 2 ++ go.mod | 2 ++ go.sum | 4 ++++ models/rulesheet.go | 2 ++ payloads/v1/rulesheet.go | 1 + responses/v1/rulesheet.go | 2 ++ services/rulesheets.go | 5 +++++ 11 files changed, 37 insertions(+), 1 deletion(-) diff --git a/controllers/v1/rulesheets.go b/controllers/v1/rulesheets.go index c9a0f1b..cad170d 100644 --- a/controllers/v1/rulesheets.go +++ b/controllers/v1/rulesheets.go @@ -288,7 +288,7 @@ func (rc *rulesheets) UpdateRulesheet() gin.HandlerFunc { return } - _, err := rc.service.Get(ctx, id) + foudedEntity, err := rc.service.Get(ctx, id) if err != nil { c.String(http.StatusNotFound, "") log.Errorf("You are trying to update a non existing record: %v", err) @@ -296,6 +296,7 @@ func (rc *rulesheets) UpdateRulesheet() gin.HandlerFunc { } var payload payloads.Rulesheet + // validate the request body if err := c.BindJSON(&payload); err != nil { c.JSON(http.StatusBadRequest, responses.Error{ @@ -314,6 +315,15 @@ func (rc *rulesheets) UpdateRulesheet() gin.HandlerFunc { iid, _ := strconv.ParseUint(id, 10, 32) payload.ID = uint(iid) + if payload.Slug != "" { + c.JSON(http.StatusBadRequest, responses.Error{ + Error: "You can't update a slug already defined", + }) + log.Errorf("You can't update a slug already defined: %v", err) + return + } + payload.Slug = foudedEntity.Slug + dto, err := dtos.NewRulesheetV1(payload) if err != nil { c.JSON(http.StatusInternalServerError, responses.Error{ diff --git a/docs/docs.go b/docs/docs.go index 49639f4..6fb1e23 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -416,6 +416,9 @@ const docTemplate = `{ "type": "object", "additionalProperties": true }, + "slug": { + "type": "string" + }, "version": { "type": "string" } diff --git a/docs/swagger.json b/docs/swagger.json index ed288f9..9a9999f 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -409,6 +409,9 @@ "type": "object", "additionalProperties": true }, + "slug": { + "type": "string" + }, "version": { "type": "string" } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 8120d47..e6afe45 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -27,6 +27,8 @@ definitions: rules: additionalProperties: true type: object + slug: + type: string version: type: string required: diff --git a/dtos/rulesheets.go b/dtos/rulesheets.go index 469243c..cff80f9 100644 --- a/dtos/rulesheets.go +++ b/dtos/rulesheets.go @@ -26,6 +26,7 @@ type Rulesheet struct { ID uint Name string Description string + Slug string HasStringRule bool Version string Features *[]interface{} @@ -40,6 +41,7 @@ func NewRulesheetV1(payload v1.Rulesheet) (dto Rulesheet, err error) { ID: payload.ID, Name: payload.Name, Description: payload.Description, + Slug: payload.Slug, Version: payload.Version, Features: payload.Features, Parameters: payload.Parameters, diff --git a/go.mod b/go.mod index fce93ac..8e95e5b 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/gin-contrib/cors v1.3.1 github.com/gin-gonic/gin v1.7.7 github.com/go-playground/validator/v10 v10.10.1 + github.com/gosimple/slug v1.12.0 github.com/gsdenys/healthcheck v0.0.0-20220412001953-64e5089fa0bc github.com/prometheus/client_golang v1.12.1 github.com/sirupsen/logrus v1.9.0 @@ -43,6 +44,7 @@ require ( github.com/go-sql-driver/mysql v1.6.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-querystring v1.1.0 // indirect + github.com/gosimple/unidecode v1.0.1 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.6.8 // indirect github.com/hashicorp/hcl v1.0.0 // indirect diff --git a/go.sum b/go.sum index 01a07ea..9ae1ab9 100644 --- a/go.sum +++ b/go.sum @@ -265,6 +265,10 @@ github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pf github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gosimple/slug v1.12.0 h1:xzuhj7G7cGtd34NXnW/yF0l+AGNfWqwgh/IXgFy7dnc= +github.com/gosimple/slug v1.12.0/go.mod h1:UiRaFH+GEilHstLUmcBgWcI42viBN7mAb818JrYOeFQ= +github.com/gosimple/unidecode v1.0.1 h1:hZzFTMMqSswvf0LBJZCZgThIZrpDHFXux9KeGmn6T/o= +github.com/gosimple/unidecode v1.0.1/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsdenys/healthcheck v0.0.0-20220412001953-64e5089fa0bc h1:+e9Mzex/kDzm5O9jOsVDwuWfLXBVEbHBIAjkfuzi6vA= github.com/gsdenys/healthcheck v0.0.0-20220412001953-64e5089fa0bc/go.mod h1:/UTGzC0R4heMzz69zVkcx36w4RqQ23kFdyY7H5TICK4= diff --git a/models/rulesheet.go b/models/rulesheet.go index ddc1c09..7f85432 100644 --- a/models/rulesheet.go +++ b/models/rulesheet.go @@ -12,6 +12,7 @@ type Rulesheet struct { gorm.Model Name string Description string + Slug string //`gorm:"unique_index"` HasStringRule bool CreatedAt *time.Time UpdatedAt *time.Time @@ -26,6 +27,7 @@ func NewRulesheetV1(dto dtos.Rulesheet) (entity Rulesheet, err error) { }, Name: dto.Name, Description: dto.Description, + Slug: dto.Slug, } return diff --git a/payloads/v1/rulesheet.go b/payloads/v1/rulesheet.go index ad33897..fc3fdcd 100644 --- a/payloads/v1/rulesheet.go +++ b/payloads/v1/rulesheet.go @@ -9,6 +9,7 @@ type Rulesheet struct { ID uint `json:"id,omitempty"` Name string `json:"name,omitempty" validate:"required"` Description string `json:"description,omitempty"` + Slug string `json:"slug,omitempty"` Version string `json:"version,omitempty"` HasStringRule bool `json:"hasStringRule,omitempty"` Features *[]interface{} `json:"features,omitempty"` diff --git a/responses/v1/rulesheet.go b/responses/v1/rulesheet.go index e73c2a9..0f58b04 100644 --- a/responses/v1/rulesheet.go +++ b/responses/v1/rulesheet.go @@ -8,6 +8,7 @@ type Rulesheet struct { ID uint `json:"id,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` + Slug string `json:"slug,omitempty"` Version string `json:"version,omitempty"` Features *[]interface{} `json:"features,omitempty"` Parameters *[]interface{} `json:"parameters,omitempty"` @@ -20,6 +21,7 @@ func NewRulesheet(dto *dtos.Rulesheet) Rulesheet { ID: dto.ID, Name: dto.Name, Description: dto.Description, + Slug: dto.Slug, Version: dto.Version, Features: dto.Features, Parameters: dto.Parameters, diff --git a/services/rulesheets.go b/services/rulesheets.go index 8710592..9d40b1d 100644 --- a/services/rulesheets.go +++ b/services/rulesheets.go @@ -2,10 +2,12 @@ package services import ( "context" + "fmt" "github.com/bancodobrasil/featws-api/dtos" "github.com/bancodobrasil/featws-api/models" "github.com/bancodobrasil/featws-api/repository" + "github.com/gosimple/slug" log "github.com/sirupsen/logrus" ) @@ -43,6 +45,8 @@ func (rs rulesheets) Create(ctx context.Context, rulesheetDTO *dtos.Rulesheet) ( //TODO verifica unicidade do nome rulesheet, err := models.NewRulesheetV1(*rulesheetDTO) + rulesheet.Slug = slug.Make(rulesheet.Slug) + fmt.Print(rulesheet.Slug) if err != nil { log.Errorf("Error on create rulesheet on create model: %v", err) return @@ -186,6 +190,7 @@ func newRulesheetDTO(entity *models.Rulesheet) *dtos.Rulesheet { ID: entity.ID, Name: entity.Name, Description: entity.Description, + Slug: entity.Slug, HasStringRule: entity.HasStringRule, } } From 677be6540f0663d1fd997bc237dea0dbab48fd7a Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Wed, 24 Aug 2022 19:41:53 -0300 Subject: [PATCH 02/55] feat: implementing test WIP --- mocks/repository/Repository.go | 155 +++++++++++++++++++++ mocks/services/Gitlab.go | 4 +- mocks/services/Rulesheets.go | 20 +-- services/gitlab_test.go | 2 +- services/rulesheets_test.go | 240 ++++++++++++++++++++++++++++++++- 5 files changed, 404 insertions(+), 17 deletions(-) create mode 100644 mocks/repository/Repository.go diff --git a/mocks/repository/Repository.go b/mocks/repository/Repository.go new file mode 100644 index 0000000..630916b --- /dev/null +++ b/mocks/repository/Repository.go @@ -0,0 +1,155 @@ +// Code generated by mockery. DO NOT EDIT. + +package mocks + +import ( + context "context" + + repository "github.com/bancodobrasil/featws-api/repository" + mock "github.com/stretchr/testify/mock" +) + +// Repository is an autogenerated mock type for the Repository type +type Repository[T interface{}] struct { + mock.Mock +} + +// Count provides a mock function with given fields: ctx, entity +func (_m *Repository[T]) Count(ctx context.Context, entity interface{}) (int64, error) { + ret := _m.Called(ctx, entity) + + var r0 int64 + if rf, ok := ret.Get(0).(func(context.Context, interface{}) int64); ok { + r0 = rf(ctx, entity) + } else { + r0 = ret.Get(0).(int64) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, interface{}) error); ok { + r1 = rf(ctx, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Create provides a mock function with given fields: ctx, entity +func (_m *Repository[T]) Create(ctx context.Context, entity *T) error { + ret := _m.Called(ctx, entity) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *T) error); ok { + r0 = rf(ctx, entity) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Delete provides a mock function with given fields: ctx, id +func (_m *Repository[T]) Delete(ctx context.Context, id string) (bool, error) { + ret := _m.Called(ctx, id) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, string) bool); ok { + r0 = rf(ctx, id) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Find provides a mock function with given fields: ctx, entity, options +func (_m *Repository[T]) Find(ctx context.Context, entity interface{}, options *repository.FindOptions) ([]*T, error) { + ret := _m.Called(ctx, entity, options) + + var r0 []*T + if rf, ok := ret.Get(0).(func(context.Context, interface{}, *repository.FindOptions) []*T); ok { + r0 = rf(ctx, entity, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*T) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, interface{}, *repository.FindOptions) error); ok { + r1 = rf(ctx, entity, options) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Get provides a mock function with given fields: ctx, id +func (_m *Repository[T]) Get(ctx context.Context, id string) (*T, error) { + ret := _m.Called(ctx, id) + + var r0 *T + if rf, ok := ret.Get(0).(func(context.Context, string) *T); ok { + r0 = rf(ctx, id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*T) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Update provides a mock function with given fields: ctx, entity +func (_m *Repository[T]) Update(ctx context.Context, entity T) (*T, error) { + ret := _m.Called(ctx, entity) + + var r0 *T + if rf, ok := ret.Get(0).(func(context.Context, T) *T); ok { + r0 = rf(ctx, entity) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*T) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, T) error); ok { + r1 = rf(ctx, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +type mockConstructorTestingTNewRepository interface { + mock.TestingT + Cleanup(func()) +} + +// NewRepository creates a new instance of Repository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewRepository[T interface{}](t mockConstructorTestingTNewRepository) *Repository[T] { + mock := &Repository[T]{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/services/Gitlab.go b/mocks/services/Gitlab.go index c96dd1c..efdb824 100644 --- a/mocks/services/Gitlab.go +++ b/mocks/services/Gitlab.go @@ -40,13 +40,13 @@ func (_m *Gitlab) Save(rulesheet *dtos.Rulesheet, commitMessage string) error { return r0 } -type NewGitlabT interface { +type mockConstructorTestingTNewGitlab interface { mock.TestingT Cleanup(func()) } // NewGitlab creates a new instance of Gitlab. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewGitlab(t NewGitlabT) *Gitlab { +func NewGitlab(t mockConstructorTestingTNewGitlab) *Gitlab { mock := &Gitlab{} mock.Mock.Test(t) diff --git a/mocks/services/Rulesheets.go b/mocks/services/Rulesheets.go index c7673f0..2387028 100644 --- a/mocks/services/Rulesheets.go +++ b/mocks/services/Rulesheets.go @@ -7,6 +7,8 @@ import ( dtos "github.com/bancodobrasil/featws-api/dtos" mock "github.com/stretchr/testify/mock" + + services "github.com/bancodobrasil/featws-api/services" ) // Rulesheets is an autogenerated mock type for the Rulesheets type @@ -70,13 +72,13 @@ func (_m *Rulesheets) Delete(ctx context.Context, id string) (bool, error) { return r0, r1 } -// Find provides a mock function with given fields: ctx, filter -func (_m *Rulesheets) Find(ctx context.Context, filter interface{}) ([]*dtos.Rulesheet, error) { - ret := _m.Called(ctx, filter) +// Find provides a mock function with given fields: ctx, filter, options +func (_m *Rulesheets) Find(ctx context.Context, filter interface{}, options *services.FindOptions) ([]*dtos.Rulesheet, error) { + ret := _m.Called(ctx, filter, options) var r0 []*dtos.Rulesheet - if rf, ok := ret.Get(0).(func(context.Context, interface{}) []*dtos.Rulesheet); ok { - r0 = rf(ctx, filter) + if rf, ok := ret.Get(0).(func(context.Context, interface{}, *services.FindOptions) []*dtos.Rulesheet); ok { + r0 = rf(ctx, filter, options) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*dtos.Rulesheet) @@ -84,8 +86,8 @@ func (_m *Rulesheets) Find(ctx context.Context, filter interface{}) ([]*dtos.Rul } var r1 error - if rf, ok := ret.Get(1).(func(context.Context, interface{}) error); ok { - r1 = rf(ctx, filter) + if rf, ok := ret.Get(1).(func(context.Context, interface{}, *services.FindOptions) error); ok { + r1 = rf(ctx, filter, options) } else { r1 = ret.Error(1) } @@ -139,13 +141,13 @@ func (_m *Rulesheets) Update(ctx context.Context, entity dtos.Rulesheet) (*dtos. return r0, r1 } -type NewRulesheetsT interface { +type mockConstructorTestingTNewRulesheets interface { mock.TestingT Cleanup(func()) } // NewRulesheets creates a new instance of Rulesheets. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewRulesheets(t NewRulesheetsT) *Rulesheets { +func NewRulesheets(t mockConstructorTestingTNewRulesheets) *Rulesheets { mock := &Rulesheets{} mock.Mock.Test(t) diff --git a/services/gitlab_test.go b/services/gitlab_test.go index 5a71011..5dff904 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -1,4 +1,4 @@ -package services +package services_test // import ( // "fmt" diff --git a/services/rulesheets_test.go b/services/rulesheets_test.go index 7daae3a..dcf1730 100644 --- a/services/rulesheets_test.go +++ b/services/rulesheets_test.go @@ -9,10 +9,10 @@ import ( mocks_repository "github.com/bancodobrasil/featws-api/mocks/repository" mocks_services "github.com/bancodobrasil/featws-api/mocks/services" "github.com/bancodobrasil/featws-api/models" + // "github.com/bancodobrasil/featws-api/repository" ) func TestGetWithErrorOnFill(t *testing.T) { - ctx := context.Background() dto := &dtos.Rulesheet{ @@ -30,12 +30,242 @@ func TestGetWithErrorOnFill(t *testing.T) { gitlabService := new(mocks_services.Gitlab) gitlabService.On("Fill", dto).Return(errors.New("error on fill")) - service := NewRulesheets(repository, gitlabService) - - _, err = service.Get(ctx, "1") + services := NewRulesheets(repository, gitlabService) + _, err = services.Get(ctx, "1") if err == nil || err.Error() != "error on fill" { t.Error("expected error on fill") } - } + +// func TestGetSucess(t *testing.T) { + +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// } +// entity, err := models.NewRulesheetV1(*dto) +// if err != nil { +// t.Error("unexpected error on model creation") +// } +// repository := new(mocks_repository.Rulesheets) +// repository.On("Get", ctx, "1").Return(&entity, nil) +// gitlabService := new(mocks_services.Gitlab) +// gitlabService.On("Fill", dto).Return(nil) +// service := NewRulesheets(repository, gitlabService) +// _, err = service.Get(ctx, "1") +// if err != nil { +// t.Error("unexpected error on get") +// } +// } + +// func TestGetWithErrorOnCreateModel(t *testing.T) { + +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// } + +// entity, err := models.NewRulesheetV1(*dto) +// if err != nil { +// t.Error("unexpected error on model creation") +// } +// repository := new(mocks_repository.Rulesheets) +// repository.On("Get", ctx, "1").Return(&entity, errors.New("error on model creation")) +// gitlabService := new(mocks_services.Gitlab) +// gitlabService.On("Fill", dto).Return(nil) +// service := NewRulesheets(repository, gitlabService) +// _, err = service.Get(ctx, "1") +// if err == nil || err.Error() != "error on model creation" { +// t.Error("unexpected error on get") +// } +// } + +// func TestCreateWithErrorOnFill(t *testing.T) { + +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// } +// entity, err := models.NewRulesheetV1(*dto) +// if err != nil { +// t.Error("unexpected error on model creation") +// } +// repository := new(mocks_repository.Rulesheets) +// repository.On("Create", ctx, &entity).Return(nil) +// gitlabService := new(mocks_services.Gitlab) +// gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) +// gitlabService.On("Fill", dto).Return(errors.New("error on fill")) +// service := NewRulesheets(repository, gitlabService) +// err = service.Create(ctx, dto) +// if err == nil || err.Error() != "error on fill" { +// t.Error("expected error on fill") +// } +// } + +// func TestCreateSuccess(t *testing.T) { +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// } +// entity, err := models.NewRulesheetV1(*dto) +// if err != nil { +// t.Error("unexpected error on model creation") +// } +// repository := new(mocks_repository.Rulesheets) +// repository.On("Create", ctx, &entity).Return(nil) +// gitlabService := new(mocks_services.Gitlab) +// gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) +// gitlabService.On("Fill", dto).Return(nil) +// service := NewRulesheets(repository, gitlabService) +// err = service.Create(ctx, dto) +// if err != nil { +// t.Error("unexpected error on create") +// } + +// } + +// // func TestCreateWithErrorOnModelCreation(t *testing.T) { +// // ctx := context.Background() +// // dto := &dtos.Rulesheet{ +// // ID: 1, +// // } + +// // entity, err1 := models.NewRulesheetV1(*dto) +// // err1 = errors.New("error on model creation") +// // repository := new(mocks_repository.Rulesheets) +// // repository.On("Create", ctx, &entity).Return(nil) +// // gitlabService := new(mocks_services.Gitlab) +// // gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) +// // gitlabService.On("Fill", dto).Return(nil) +// // service := NewRulesheets(repository, gitlabService) +// // _ = service.Create(ctx, dto) +// // if err1.Error() != "error on model creation" { +// // t.Error("expected error on model creation") +// // } +// // } + +// func TestCreateWithError(t *testing.T) { +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// } + +// entity, err := models.NewRulesheetV1(*dto) +// if err != nil { +// t.Error("unexpected error on model creation") +// } +// repository := new(mocks_repository.Rulesheets) +// repository.On("Create", ctx, &entity).Return(errors.New("error on create")) +// gitlabService := new(mocks_services.Gitlab) +// gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) +// gitlabService.On("Fill", dto).Return(nil) +// service := NewRulesheets(repository, gitlabService) +// err = service.Create(ctx, dto) +// if err == nil || err.Error() != "error on create" { +// t.Error("expected error on create") +// } +// } + +// func TestCreateWithErroOnSave(t *testing.T) { +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// } + +// entity, err := models.NewRulesheetV1(*dto) +// if err != nil { +// t.Error("unexpected error on model creation") +// } +// repository := new(mocks_repository.Rulesheets) +// repository.On("Create", ctx, &entity).Return(nil) +// gitlabService := new(mocks_services.Gitlab) +// gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(errors.New("error on save")) +// gitlabService.On("Fill", dto).Return(nil) +// service := NewRulesheets(repository, gitlabService) +// err = service.Create(ctx, dto) +// if err == nil || err.Error() != "error on save" { +// t.Error("expected error on save") +// } +// } + +// func TestUpdateWithErrorOnSave(t *testing.T) { + +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// } +// entity, err := models.NewRulesheetV1(*dto) +// if err != nil { +// t.Error("unexpected error on model creation") +// } +// repository := new(mocks_repository.Rulesheets) +// repository.On("Update", ctx, entity).Return(nil, nil) +// gitlabService := new(mocks_services.Gitlab) +// gitlabService.On("Save", dto, "[FEATWS BOT] Update Repo").Return(errors.New("error on save")) +// // gitlabService.On("Fill", dto).Return(errors.New("error on fill")) +// service := NewRulesheets(repository, gitlabService) +// _, err = service.Update(ctx, *dto) +// if err == nil || err.Error() != "error on save" { +// t.Error("expected error on save") +// } +// } + +// func TestFindSucess(t *testing.T) { +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// } +// entity, err := models.NewRulesheetV1(*dto) +// if err != nil { +// t.Error("unexpected error on model creation") +// } +// repositoryMocado := new(mocks_repository.Rulesheets) +// repositoryMocado.On("Find", ctx, dto.ID, &repository.FindOptions{}).Return(entity, nil) +// service := NewRulesheets(repositoryMocado, nil) +// _, err = service.Find(ctx, dto.ID, &FindOptions{0, 0}) +// if err != nil { +// t.Error("unexpected error on find") +// } +// } + +// func TestUpdateSuccess(t *testing.T) { +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// } +// entity, err := models.NewRulesheetV1(*dto) +// if err != nil { +// t.Error("unexpected error on model creation") +// } +// repository := new(mocks_repository.Rulesheets) +// repository.On("Update", ctx, entity).Return(nil, nil) +// gitlabService := new(mocks_services.Gitlab) +// gitlabService.On("Save", dto, "[FEATWS BOT] Update Repo").Return(nil) +// gitlabService.On("Fill", dto).Return(nil) +// service := NewRulesheets(repository, gitlabService) +// _, err = service.Update(ctx, *dto) +// if err != nil { +// t.Error("unexpected error on update") +// } +// } + +// func TestDeleteSuccess(t *testing.T) { +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// } +// _, err := models.NewRulesheetV1(*dto) +// if err != nil { +// t.Error("unexpected error on model creation") +// } +// repository := new(mocks_repository.Rulesheets) +// repository.On("Delete", ctx, "1").Return(true, nil) +// gitlabService := new(mocks_services.Gitlab) +// gitlabService.On("Delete", dto).Return(true, nil) +// service := NewRulesheets(repository, gitlabService) +// _, err = service.Delete(ctx, "1") +// if err != nil { +// t.Error("unexpected error on delete") +// } +// } From ffddc03da1a3fcbbc05d5ad24f4abc7483f5c592 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Fri, 26 Aug 2022 13:08:56 -0300 Subject: [PATCH 03/55] feat: implementing tests --- services/rulesheets_test.go | 473 ++++++++++++++++++++++-------------- 1 file changed, 296 insertions(+), 177 deletions(-) diff --git a/services/rulesheets_test.go b/services/rulesheets_test.go index dcf1730..1c7e978 100644 --- a/services/rulesheets_test.go +++ b/services/rulesheets_test.go @@ -1,4 +1,4 @@ -package services +package services_test import ( "context" @@ -9,7 +9,8 @@ import ( mocks_repository "github.com/bancodobrasil/featws-api/mocks/repository" mocks_services "github.com/bancodobrasil/featws-api/mocks/services" "github.com/bancodobrasil/featws-api/models" - // "github.com/bancodobrasil/featws-api/repository" + "github.com/bancodobrasil/featws-api/repository" + "github.com/bancodobrasil/featws-api/services" ) func TestGetWithErrorOnFill(t *testing.T) { @@ -30,7 +31,8 @@ func TestGetWithErrorOnFill(t *testing.T) { gitlabService := new(mocks_services.Gitlab) gitlabService.On("Fill", dto).Return(errors.New("error on fill")) - services := NewRulesheets(repository, gitlabService) + // Provavel referencia ciclica pois esta testando o servico chanmando o proprio servico ao inves do mock + services := services.NewRulesheets(repository, gitlabService) _, err = services.Get(ctx, "1") if err == nil || err.Error() != "error on fill" { @@ -38,178 +40,197 @@ func TestGetWithErrorOnFill(t *testing.T) { } } -// func TestGetSucess(t *testing.T) { +func TestGetSucess(t *testing.T) { -// ctx := context.Background() -// dto := &dtos.Rulesheet{ -// ID: 1, -// } -// entity, err := models.NewRulesheetV1(*dto) -// if err != nil { -// t.Error("unexpected error on model creation") -// } -// repository := new(mocks_repository.Rulesheets) -// repository.On("Get", ctx, "1").Return(&entity, nil) -// gitlabService := new(mocks_services.Gitlab) -// gitlabService.On("Fill", dto).Return(nil) -// service := NewRulesheets(repository, gitlabService) -// _, err = service.Get(ctx, "1") -// if err != nil { -// t.Error("unexpected error on get") -// } -// } + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Get", ctx, "1").Return(&entity, nil) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Fill", dto).Return(nil) + service := services.NewRulesheets(repository, gitlabService) + _, err = service.Get(ctx, "1") + if err != nil { + t.Error("unexpected error on get") + } +} -// func TestGetWithErrorOnCreateModel(t *testing.T) { +func TestGetWithErrorOnCreateModel(t *testing.T) { -// ctx := context.Background() -// dto := &dtos.Rulesheet{ -// ID: 1, -// } + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } -// entity, err := models.NewRulesheetV1(*dto) -// if err != nil { -// t.Error("unexpected error on model creation") -// } -// repository := new(mocks_repository.Rulesheets) -// repository.On("Get", ctx, "1").Return(&entity, errors.New("error on model creation")) -// gitlabService := new(mocks_services.Gitlab) -// gitlabService.On("Fill", dto).Return(nil) -// service := NewRulesheets(repository, gitlabService) -// _, err = service.Get(ctx, "1") -// if err == nil || err.Error() != "error on model creation" { -// t.Error("unexpected error on get") -// } -// } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Get", ctx, "1").Return(&entity, errors.New("error on model creation")) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Fill", dto).Return(nil) + service := services.NewRulesheets(repository, gitlabService) + _, err = service.Get(ctx, "1") + if err == nil || err.Error() != "error on model creation" { + t.Error("unexpected error on get") + } +} -// func TestCreateWithErrorOnFill(t *testing.T) { +func TestCreateWithErrorOnFill(t *testing.T) { -// ctx := context.Background() -// dto := &dtos.Rulesheet{ -// ID: 1, -// } -// entity, err := models.NewRulesheetV1(*dto) -// if err != nil { -// t.Error("unexpected error on model creation") -// } -// repository := new(mocks_repository.Rulesheets) -// repository.On("Create", ctx, &entity).Return(nil) -// gitlabService := new(mocks_services.Gitlab) -// gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) -// gitlabService.On("Fill", dto).Return(errors.New("error on fill")) -// service := NewRulesheets(repository, gitlabService) -// err = service.Create(ctx, dto) -// if err == nil || err.Error() != "error on fill" { -// t.Error("expected error on fill") -// } -// } + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Create", ctx, &entity).Return(nil) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) + gitlabService.On("Fill", dto).Return(errors.New("error on fill")) + service := services.NewRulesheets(repository, gitlabService) + err = service.Create(ctx, dto) + if err == nil || err.Error() != "error on fill" { + t.Error("expected error on fill") + } +} -// func TestCreateSuccess(t *testing.T) { -// ctx := context.Background() -// dto := &dtos.Rulesheet{ -// ID: 1, -// } -// entity, err := models.NewRulesheetV1(*dto) -// if err != nil { -// t.Error("unexpected error on model creation") -// } -// repository := new(mocks_repository.Rulesheets) -// repository.On("Create", ctx, &entity).Return(nil) -// gitlabService := new(mocks_services.Gitlab) -// gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) -// gitlabService.On("Fill", dto).Return(nil) -// service := NewRulesheets(repository, gitlabService) -// err = service.Create(ctx, dto) -// if err != nil { -// t.Error("unexpected error on create") -// } +func TestCreateSuccess(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Create", ctx, &entity).Return(nil) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) + gitlabService.On("Fill", dto).Return(nil) + service := services.NewRulesheets(repository, gitlabService) + err = service.Create(ctx, dto) + if err != nil { + t.Error("unexpected error on create") + } -// } +} -// // func TestCreateWithErrorOnModelCreation(t *testing.T) { -// // ctx := context.Background() -// // dto := &dtos.Rulesheet{ -// // ID: 1, -// // } - -// // entity, err1 := models.NewRulesheetV1(*dto) -// // err1 = errors.New("error on model creation") -// // repository := new(mocks_repository.Rulesheets) -// // repository.On("Create", ctx, &entity).Return(nil) -// // gitlabService := new(mocks_services.Gitlab) -// // gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) -// // gitlabService.On("Fill", dto).Return(nil) -// // service := NewRulesheets(repository, gitlabService) -// // _ = service.Create(ctx, dto) -// // if err1.Error() != "error on model creation" { -// // t.Error("expected error on model creation") -// // } -// // } - -// func TestCreateWithError(t *testing.T) { +// func TestCreateWithErrorOnModelCreation(t *testing.T) { // ctx := context.Background() // dto := &dtos.Rulesheet{ // ID: 1, // } -// entity, err := models.NewRulesheetV1(*dto) -// if err != nil { -// t.Error("unexpected error on model creation") -// } +// entity, err1 := models.NewRulesheetV1(*dto) +// err1 = errors.New("error on model creation") // repository := new(mocks_repository.Rulesheets) -// repository.On("Create", ctx, &entity).Return(errors.New("error on create")) +// repository.On("Create", ctx, &entity).Return(nil) // gitlabService := new(mocks_services.Gitlab) // gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) // gitlabService.On("Fill", dto).Return(nil) // service := NewRulesheets(repository, gitlabService) -// err = service.Create(ctx, dto) -// if err == nil || err.Error() != "error on create" { -// t.Error("expected error on create") +// _ = service.Create(ctx, dto) +// if err1.Error() != "error on model creation" { +// t.Error("expected error on model creation") // } // } -// func TestCreateWithErroOnSave(t *testing.T) { -// ctx := context.Background() -// dto := &dtos.Rulesheet{ -// ID: 1, -// } +func TestCreateWithError(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } -// entity, err := models.NewRulesheetV1(*dto) -// if err != nil { -// t.Error("unexpected error on model creation") -// } -// repository := new(mocks_repository.Rulesheets) -// repository.On("Create", ctx, &entity).Return(nil) -// gitlabService := new(mocks_services.Gitlab) -// gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(errors.New("error on save")) -// gitlabService.On("Fill", dto).Return(nil) -// service := NewRulesheets(repository, gitlabService) -// err = service.Create(ctx, dto) -// if err == nil || err.Error() != "error on save" { -// t.Error("expected error on save") -// } -// } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Create", ctx, &entity).Return(errors.New("error on create")) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) + gitlabService.On("Fill", dto).Return(nil) + service := services.NewRulesheets(repository, gitlabService) + err = service.Create(ctx, dto) + if err == nil || err.Error() != "error on create" { + t.Error("expected error on create") + } +} -// func TestUpdateWithErrorOnSave(t *testing.T) { +func TestCreateWithErroOnSave(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } -// ctx := context.Background() -// dto := &dtos.Rulesheet{ -// ID: 1, -// } -// entity, err := models.NewRulesheetV1(*dto) -// if err != nil { -// t.Error("unexpected error on model creation") -// } -// repository := new(mocks_repository.Rulesheets) -// repository.On("Update", ctx, entity).Return(nil, nil) -// gitlabService := new(mocks_services.Gitlab) -// gitlabService.On("Save", dto, "[FEATWS BOT] Update Repo").Return(errors.New("error on save")) -// // gitlabService.On("Fill", dto).Return(errors.New("error on fill")) -// service := NewRulesheets(repository, gitlabService) -// _, err = service.Update(ctx, *dto) -// if err == nil || err.Error() != "error on save" { -// t.Error("expected error on save") -// } -// } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Create", ctx, &entity).Return(nil) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(errors.New("error on save")) + gitlabService.On("Fill", dto).Return(nil) + service := services.NewRulesheets(repository, gitlabService) + err = service.Create(ctx, dto) + if err == nil || err.Error() != "error on save" { + t.Error("expected error on save") + } +} + +func TestUpdateWithErrorOnSave(t *testing.T) { + + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Update", ctx, entity).Return(nil, nil) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Save", dto, "[FEATWS BOT] Update Repo").Return(errors.New("error on save")) + // gitlabService.On("Fill", dto).Return(errors.New("error on fill")) + service := services.NewRulesheets(repository, gitlabService) + _, err = service.Update(ctx, *dto) + if err == nil || err.Error() != "error on save" { + t.Error("expected error on save") + } +} + +//tipos de retorno sao diferentes do mock e da chamada real +func TestFindSuccess(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repo := new(mocks_repository.Rulesheets) + repo.On("Find", ctx, dto.ID, *repository.FindOptions{0, 0}).Return(entity, nil) + service := services.NewRulesheets(repo, nil) + _, err = service.Find(ctx, dto.ID, nil) + if err != nil { + t.Error("unexpected error on find") + } +} // func TestFindSucess(t *testing.T) { // ctx := context.Background() @@ -222,50 +243,148 @@ func TestGetWithErrorOnFill(t *testing.T) { // } // repositoryMocado := new(mocks_repository.Rulesheets) // repositoryMocado.On("Find", ctx, dto.ID, &repository.FindOptions{}).Return(entity, nil) -// service := NewRulesheets(repositoryMocado, nil) +// service := services.NewRulesheets(repositoryMocado, nil) // _, err = service.Find(ctx, dto.ID, &FindOptions{0, 0}) // if err != nil { // t.Error("unexpected error on find") // } // } -// func TestUpdateSuccess(t *testing.T) { +func TestCountSuccess(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + _, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Count", ctx, nil).Return(int64(1), nil) + service := services.NewRulesheets(repository, nil) + _, err = service.Count(ctx, nil) + if err != nil { + t.Error("unexpected error on count") + } +} + +func TestCountWithError(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + _, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Count", ctx, nil).Return(int64(0), errors.New("error on count")) + service := services.NewRulesheets(repository, nil) + _, err = service.Count(ctx, nil) + if err == nil || err.Error() != "error on count" { + t.Error("expected error on count") + } +} + +func TestUpdateSuccess(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Update", ctx, entity).Return(nil, nil) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Save", dto, "[FEATWS BOT] Update Repo").Return(nil) + gitlabService.On("Fill", dto).Return(nil) + service := services.NewRulesheets(repository, gitlabService) + _, err = service.Update(ctx, *dto) + if err != nil { + t.Error("unexpected error on update") + } +} + +func TestUpdateWithError(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Update", ctx, entity).Return(nil, errors.New("error on update")) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Save", dto, "[FEATWS BOT] Update Repo").Return(nil) + gitlabService.On("Fill", dto).Return(nil) + service := services.NewRulesheets(repository, gitlabService) + _, err = service.Update(ctx, *dto) + if err == nil || err.Error() != "error on update" { + t.Error("expected error on update") + } +} + +// func TestUpdateWithErrorOnGenerateModel(t *testing.T) { // ctx := context.Background() // dto := &dtos.Rulesheet{ -// ID: 1, + // } -// entity, err := models.NewRulesheetV1(*dto) +// entity, err := models.NewRulesheetV1() // if err != nil { // t.Error("unexpected error on model creation") // } // repository := new(mocks_repository.Rulesheets) -// repository.On("Update", ctx, entity).Return(nil, nil) +// repository.On("Update", ctx, entity).Return(nil, errors.New("error on update")) // gitlabService := new(mocks_services.Gitlab) // gitlabService.On("Save", dto, "[FEATWS BOT] Update Repo").Return(nil) // gitlabService.On("Fill", dto).Return(nil) -// service := NewRulesheets(repository, gitlabService) +// service := services.NewRulesheets(repository, gitlabService) // _, err = service.Update(ctx, *dto) -// if err != nil { -// t.Error("unexpected error on update") +// if err == nil || err.Error() != "error on update" { +// t.Error("expected error on update") // } // } -// func TestDeleteSuccess(t *testing.T) { -// ctx := context.Background() -// dto := &dtos.Rulesheet{ -// ID: 1, -// } -// _, err := models.NewRulesheetV1(*dto) -// if err != nil { -// t.Error("unexpected error on model creation") -// } -// repository := new(mocks_repository.Rulesheets) -// repository.On("Delete", ctx, "1").Return(true, nil) -// gitlabService := new(mocks_services.Gitlab) -// gitlabService.On("Delete", dto).Return(true, nil) -// service := NewRulesheets(repository, gitlabService) -// _, err = service.Delete(ctx, "1") -// if err != nil { -// t.Error("unexpected error on delete") -// } -// } +func TestDeleteSuccess(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + _, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Delete", ctx, "1").Return(true, nil) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Delete", dto).Return(true, nil) + service := services.NewRulesheets(repository, gitlabService) + _, err = service.Delete(ctx, "1") + if err != nil { + t.Error("unexpected error on delete") + } +} + +func TestDeleteWithError(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + _, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repository := new(mocks_repository.Rulesheets) + repository.On("Delete", ctx, "1").Return(true, errors.New("error on delete")) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Delete", dto).Return(true, nil) + service := services.NewRulesheets(repository, gitlabService) + _, err = service.Delete(ctx, "1") + if err == nil || err.Error() != "error on delete" { + t.Error("unexpected error on delete") + } +} From ceb0d0a00096d4c81c102ab72ee3873d1016348c Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Mon, 29 Aug 2022 13:20:28 -0300 Subject: [PATCH 04/55] feat: implement unit tests for rulesheet on service --- services/rulesheets_test.go | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/services/rulesheets_test.go b/services/rulesheets_test.go index 1c7e978..5d1c248 100644 --- a/services/rulesheets_test.go +++ b/services/rulesheets_test.go @@ -224,14 +224,39 @@ func TestFindSuccess(t *testing.T) { t.Error("unexpected error on model creation") } repo := new(mocks_repository.Rulesheets) - repo.On("Find", ctx, dto.ID, *repository.FindOptions{0, 0}).Return(entity, nil) + repoFindOptions := repository.FindOptions{} + entities := []*models.Rulesheet{&entity} + repo.On("Find", ctx, dto.ID, &repoFindOptions).Return(entities, nil) service := services.NewRulesheets(repo, nil) - _, err = service.Find(ctx, dto.ID, nil) + serviceFindOptions := services.FindOptions{0, 0} + _, err = service.Find(ctx, dto.ID, &serviceFindOptions) if err != nil { t.Error("unexpected error on find") } } +func TestFindWithError(t *testing.T) { + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + } + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + repo := new(mocks_repository.Rulesheets) + repoFindOptions := repository.FindOptions{} + entities := []*models.Rulesheet{&entity} + repo.On("Find", ctx, dto.ID, &repoFindOptions).Return(entities, errors.New("error on find")) + service := services.NewRulesheets(repo, nil) + serviceFindOptions := services.FindOptions{0, 0} + _, err = service.Find(ctx, dto.ID, &serviceFindOptions) + if err != nil && err.Error() != "error on find" { + t.Error("unexpected error on find") + } + +} + // func TestFindSucess(t *testing.T) { // ctx := context.Background() // dto := &dtos.Rulesheet{ From d791f3e8024146900a5487fa038564f87fbf755d Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Mon, 29 Aug 2022 20:35:58 -0300 Subject: [PATCH 05/55] implement tests WIP --- controllers/health_test.go | 37 +++++ controllers/home.go | 4 +- controllers/home_test.go | 45 ++++++ controllers/v1/rulesheets_test.go | 86 ++++++++++++ go.mod | 6 +- go.sum | 6 + mocks/repository/Rulesheets.go | 4 +- mocks/services/Gitlab.go | 25 ++++ routes/routes.go | 17 +++ services/gitlab.go | 9 +- services/gitlab_test.go | 219 ++++-------------------------- services/rulesheets.go | 25 +--- 12 files changed, 259 insertions(+), 224 deletions(-) create mode 100644 controllers/health_test.go create mode 100644 controllers/home_test.go create mode 100644 controllers/v1/rulesheets_test.go diff --git a/controllers/health_test.go b/controllers/health_test.go new file mode 100644 index 0000000..63748ed --- /dev/null +++ b/controllers/health_test.go @@ -0,0 +1,37 @@ +package controllers_test + +import ( + "io/ioutil" + "net/http" + "net/http/httptest" + "testing" + + "github.com/bancodobrasil/featws-api/controllers" + "github.com/gin-gonic/gin" + "github.com/stretchr/testify/assert" +) + +func TestHealthLive(t *testing.T) { + gin.SetMode(gin.TestMode) + + r := gin.Default() + r.GET("/health/live", controllers.NewHealthController().HealthLiveHandler()) + + req, err := http.NewRequest("GET", "/health/live", nil) + if err != nil { + t.Fatalf("Couldn't create request: %v\n", err) + } + + w := httptest.NewRecorder() + r.ServeHTTP(w, req) + defer w.Result().Body.Close() + + mockUserResp := `{"goroutine-threshold": "OK"}` + //Using testify + + assert.Nil(t, err) + assert.Equal(t, http.StatusOK, w.Code) + responseData, _ := ioutil.ReadAll(w.Body) + assert.Equal(t, mockUserResp, string(responseData)) + +} diff --git a/controllers/home.go b/controllers/home.go index 2a82796..578658c 100644 --- a/controllers/home.go +++ b/controllers/home.go @@ -15,5 +15,7 @@ import ( // HomeHandler ... func HomeHandler(c *gin.Context) { - c.String(http.StatusOK, "FeatWS API Works!!!") + c.JSON(http.StatusOK, gin.H{ + "message": "FeatWS API Works!!!", + }) } diff --git a/controllers/home_test.go b/controllers/home_test.go new file mode 100644 index 0000000..0d913a4 --- /dev/null +++ b/controllers/home_test.go @@ -0,0 +1,45 @@ +package controllers_test + +import ( + "io/ioutil" + "net/http" + "net/http/httptest" + "testing" + + "github.com/bancodobrasil/featws-api/controllers" + "github.com/gin-gonic/gin" + "github.com/stretchr/testify/assert" +) + +func TestHomeHandler(t *testing.T) { + gin.SetMode(gin.TestMode) + + r := gin.Default() + r.GET("/", controllers.HomeHandler) + + req, err := http.NewRequest("GET", "/", nil) + if err != nil { + t.Fatalf("Couldn't create request: %v\n", err) + } + + w := httptest.NewRecorder() + r.ServeHTTP(w, req) + defer w.Result().Body.Close() + + mockUserResp := `{"message":"FeatWS API Works!!!"}` + //Using testify + + assert.Nil(t, err) + assert.Equal(t, http.StatusOK, w.Code) + responseData, _ := ioutil.ReadAll(w.Body) + assert.Equal(t, mockUserResp, string(responseData)) + +} + +r.GET("/recipes", ListRecipesHandler) + +   req, _ := http.NewRequest("GET", "/recipes", nil) + +   w := httptest.NewRecorder() + +   r.ServeHTTP(w, req) diff --git a/controllers/v1/rulesheets_test.go b/controllers/v1/rulesheets_test.go new file mode 100644 index 0000000..313873e --- /dev/null +++ b/controllers/v1/rulesheets_test.go @@ -0,0 +1,86 @@ +package v1_test + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/http/httptest" + "testing" + + v1 "github.com/bancodobrasil/featws-api/controllers/v1" + "github.com/bancodobrasil/featws-api/routes" + "github.com/gin-gonic/gin" + "github.com/stretchr/testify/assert" +) + +type Rulesheet struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` +} + +func TestListRulesheets(t *testing.T) { + + gin.SetMode(gin.TestMode) + // service, _ := services.Rulesheets.Find() + + r := gin.Default() + r.GET("/v1/rulesheets", v1.Rulesheets.GetRulesheets()) + + req, err := http.NewRequest("GET", "/api/v1/rulesheets", nil) + if err != nil { + t.Fatalf("Couldn't create request: %v\n", err) + } + + w := httptest.NewRecorder() + r.ServeHTTP(w, req) + defer w.Result().Body.Close() + + var rulesheets []Rulesheet + json.Unmarshal([]byte(w.Body.String()), &rulesheets) + //Using testify + assert.Equal(t, http.StatusOK, w.Code) + assert.Equal(t, 10, len(rulesheets)) + +} + +func TestFindRulesheet(t *testing.T) { + + // iniciolizacao de um servidor Gin + ts := httptest.NewServer(routes.SetupRoutesWithReturn()) + defer ts.Close() + + // criacao da folha de regras esperada + expectedRulesheet := Rulesheet{ + ID: "1", + Name: "Rulesheet 1", + Description: "Rulesheet 1 description", + } + + // chamada do servico de busca da folha de regras especifica + resp, err := http.Get(fmt.Sprintf("%s/v1/rulesheets/1", ts.URL)) + if err != nil { + t.Fatalf("Couldn't make request: %v\n", err) + } + defer resp.Body.Close() + //Usando o testify + + //Testa se os erros sao nulos + assert.Nil(t, err) + + // Testa se o codigo de resposta e 200 + assert.Equal(t, http.StatusOK, resp.StatusCode) + + // Faz a leitura do corpo da resposta + data, _ := ioutil.ReadAll(resp.Body) + + // instancia um objeto do tipo Rulesheet, esta errado nao sei qual utlizar + var actualRulesheet Rulesheet + + // faz o parse do corpo da resposta para o objeto actualRulesheet + json.Unmarshal(data, &actualRulesheet) + + //Using testify + assert.Equal(t, expectedRulesheet.Name, actualRulesheet.Name) +} diff --git a/go.mod b/go.mod index 8e95e5b..ffc13a5 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/prometheus/client_golang v1.12.1 github.com/sirupsen/logrus v1.9.0 github.com/spf13/viper v1.11.0 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 github.com/swaggo/gin-swagger v1.4.2 github.com/swaggo/swag v1.7.9 github.com/toorop/gin-logrus v0.0.0-20210225092905-2c785434f26f @@ -70,7 +70,7 @@ require ( github.com/spf13/cast v1.4.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/objx v0.1.1 // indirect + github.com/stretchr/objx v0.4.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/ugorji/go/codec v1.2.7 // indirect github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.15 // indirect @@ -89,5 +89,5 @@ require ( google.golang.org/protobuf v1.28.0 // indirect gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 9ae1ab9..244cf86 100644 --- a/go.sum +++ b/go.sum @@ -473,6 +473,8 @@ github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUs github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -481,6 +483,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= @@ -1000,6 +1004,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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/mysql v1.3.3 h1:jXG9ANrwBc4+bMvBcSl8zCfPBaVoPyBEBshA8dA93X8= gorm.io/driver/mysql v1.3.3/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= diff --git a/mocks/repository/Rulesheets.go b/mocks/repository/Rulesheets.go index 834c65b..82a7364 100644 --- a/mocks/repository/Rulesheets.go +++ b/mocks/repository/Rulesheets.go @@ -141,13 +141,13 @@ func (_m *Rulesheets) Update(ctx context.Context, entity models.Rulesheet) (*mod return r0, r1 } -type NewRulesheetsT interface { +type mockConstructorTestingTNewRulesheets interface { mock.TestingT Cleanup(func()) } // NewRulesheets creates a new instance of Rulesheets. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewRulesheets(t NewRulesheetsT) *Rulesheets { +func NewRulesheets(t mockConstructorTestingTNewRulesheets) *Rulesheets { mock := &Rulesheets{} mock.Mock.Test(t) diff --git a/mocks/services/Gitlab.go b/mocks/services/Gitlab.go index efdb824..756df12 100644 --- a/mocks/services/Gitlab.go +++ b/mocks/services/Gitlab.go @@ -4,6 +4,8 @@ package mocks import ( dtos "github.com/bancodobrasil/featws-api/dtos" + gitlab "github.com/xanzy/go-gitlab" + mock "github.com/stretchr/testify/mock" ) @@ -12,6 +14,29 @@ type Gitlab struct { mock.Mock } +// Connect provides a mock function with given fields: +func (_m *Gitlab) Connect() (*gitlab.Client, error) { + ret := _m.Called() + + var r0 *gitlab.Client + if rf, ok := ret.Get(0).(func() *gitlab.Client); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gitlab.Client) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Fill provides a mock function with given fields: rulesheet func (_m *Gitlab) Fill(rulesheet *dtos.Rulesheet) error { ret := _m.Called(rulesheet) diff --git a/routes/routes.go b/routes/routes.go index 59b56a2..cf9edc9 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -24,6 +24,23 @@ func SetupRoutes(router *gin.Engine) { router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) } +// SetupRoutes define all routes +func SetupRoutesWithReturn() *gin.Engine { + + router := gin.Default() + + cfg := config.GetConfig() + + docs.SwaggerInfo.Host = cfg.ExternalHost + + homeRouter(router.Group("/")) + health.Router(router.Group("/health")) + // setup swagger docs + router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) + + return router +} + // APIRoutes define all api routes func APIRoutes(router *gin.Engine) { // inject middleware diff --git a/services/gitlab.go b/services/gitlab.go index 7aeee38..d66d73a 100644 --- a/services/gitlab.go +++ b/services/gitlab.go @@ -22,6 +22,7 @@ import ( type Gitlab interface { Save(rulesheet *dtos.Rulesheet, commitMessage string) error Fill(rulesheet *dtos.Rulesheet) error + Connect() (*gitlab.Client, error) } type gitlabService struct { @@ -43,7 +44,7 @@ func (gs *gitlabService) Save(rulesheet *dtos.Rulesheet, commitMessage string) e return nil } - git, err := connectGitlab(gs.cfg) + git, err := gs.Connect() if err != nil { log.Errorf("Error on connect the gitlab client: %v", err) return err @@ -286,7 +287,7 @@ func (gs *gitlabService) Fill(rulesheet *dtos.Rulesheet) (err error) { return nil } - git, err := connectGitlab(gs.cfg) + git, err := gs.Connect() if err != nil { log.Errorf("Error on connect the gitlab client: %v", err) return @@ -346,8 +347,8 @@ func (gs *gitlabService) Fill(rulesheet *dtos.Rulesheet) (err error) { return } -func connectGitlab(cfg *config.Config) (*gitlab.Client, error) { - git, err := gitlab.NewClient(cfg.GitlabToken, gitlab.WithBaseURL(cfg.GitlabURL)) +func (gs *gitlabService) Connect() (*gitlab.Client, error) { + git, err := gitlab.NewClient(gs.cfg.GitlabToken, gitlab.WithBaseURL(gs.cfg.GitlabURL)) if err != nil { log.Errorf("Failed to create client: %v", err) diff --git a/services/gitlab_test.go b/services/gitlab_test.go index 5dff904..e3117eb 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -1,193 +1,30 @@ package services_test -// import ( -// "fmt" -// "net/http" -// "net/http/httptest" -// "testing" - -// "github.com/bancodobrasil/featws-api/config" -// log "github.com/sirupsen/logrus" -// "github.com/stretchr/testify/require" -// gl "github.com/xanzy/go-gitlab" -// ) - -// // func setup(t *testing.T) (*gin.Engine, *httptest.Server, *gl.Client) { -// // gin := gin.Default() - -// // server := httptest.NewServer(gin) - -// // client, err := gl.NewClient("", gl.WithBaseURL(server.URL)) -// // if err != nil { -// // server.Close() -// // t.Fatalf("Failed to create client: %v", err) -// // } -// // return gin, server, client -// // } - -// func setup(t *testing.T) (*http.ServeMux, *httptest.Server, *gl.Client) { -// // mux is the HTTP request multiplexer used with the test server. -// mux := http.NewServeMux() - -// // server is a test HTTP server used to provide mock API responses. -// server := httptest.NewServer(mux) - -// // client is the Gitlab client being tested. -// client, err := gl.NewClient("", gl.WithBaseURL(server.URL)) -// if err != nil { -// server.Close() -// t.Fatalf("Failed to create client: %v", err) -// } - -// return mux, server, client -// } - -// func teardown(server *httptest.Server) { -// server.Close() -// } - -// func testMethod(t *testing.T, r *http.Request, want string) { -// if got := r.Method; got != want { -// t.Errorf("Request method: %s, want %s", got, want) -// } -// } - -// // func GetCommit(c *gin.Context) { -// // testMethod(t, r, http.MethodGet) -// // fmt.Fprintf(c.Writer, ` -// // { -// // "file_name": "key.rb", -// // "file_path": "app/models/key.rb", -// // "size": 1476, -// // "encoding": "base64", -// // "content": "IyA9PSBTY2hlbWEgSW5mb3...", -// // "content_sha256": "4c294617b60715c1d218e61164a3abd4808a4284cbc30e6728a01ad9aada4481", -// // "ref": "master", -// // "blob_id": "79f7bbd25901e8334750839545a9bd021f0e4c83", -// // "commit_id": "d5a3ff139356ce33e37e73add446f16869741b50", -// // "last_commit_id": "570e7b2abdd848b95f2f578043fc23bd6f6fd24d" -// // } -// // `) -// // } - -// func TestSaveInGitlab(t *testing.T) { -// mux, server, client := setup(t) -// defer teardown(server) - -// mux.HandleFunc("/api/v4/projects/13083/repository/files/app%2Fmodels%2Fkey%2Erb?ref=master", func(w http.ResponseWriter, r *http.Request) { -// testMethod(t, r, http.MethodGet) -// fmt.Fprintf(w, ` -// { -// "file_name": "key.rb", -// "file_path": "app/models/key.rb", -// "size": 1476, -// "encoding": "base64", -// "content": "IyA9PSBTY2hlbWEgSW5mb3...", -// "content_sha256": "4c294617b60715c1d218e61164a3abd4808a4284cbc30e6728a01ad9aada4481", -// "ref": "master", -// "blob_id": "79f7bbd25901e8334750839545a9bd021f0e4c83", -// "commit_id": "d5a3ff139356ce33e37e73add446f16869741b50", -// "last_commit_id": "570e7b2abdd848b95f2f578043fc23bd6f6fd24d" -// } -// `) -// }) - -// want := &gl.File{ -// FileName: "key.rb", -// FilePath: "app/models/key.rb", -// Size: 1476, -// Encoding: "base64", -// Content: "IyA9PSBTY2hlbWEgSW5mb3...", -// Ref: "master", -// BlobID: "79f7bbd25901e8334750839545a9bd021f0e4c83", -// CommitID: "d5a3ff139356ce33e37e73add446f16869741b50", -// SHA256: "4c294617b60715c1d218e61164a3abd4808a4284cbc30e6728a01ad9aada4481", -// LastCommitID: "570e7b2abdd848b95f2f578043fc23bd6f6fd24d", -// } - -// f, resp, err := client.RepositoryFiles.GetFile(13083, "app%2Fmodels%2Fkey%2Erb?ref=master", nil) -// require.NoError(t, err) -// require.NotNil(t, resp) -// require.Equal(t, want, f) - -// f, resp, err = client.RepositoryFiles.GetFile(13083.01, "app%2Fmodels%2Fkey%2Erb?ref=master", nil) -// require.EqualError(t, err, "invalid ID type 13083.01, the ID must be an int or a string") -// require.Nil(t, resp) -// require.Nil(t, f) - -// f, resp, err = client.RepositoryFiles.GetFile(13084, "app%2Fmodels%2Fkey%2Erb?ref=master", nil) -// require.Error(t, err) -// require.Nil(t, f) -// require.Equal(t, http.StatusNotFound, resp.StatusCode) -// } - -// func TestCreateOrUpdateGitlabFileCommitAction(t *testing.T) { - -// } - -// func TestDefineCreateOrUpdateGitlabFileAction(t *testing.T) { - -// } - -// func TestFillWithGitlab(t *testing.T) { - -// } - -// func TestConnectGitlab(t *testing.T) { -// err := config.LoadConfig() -// if err != nil { -// log.Fatalf("Não foi possível carregar as configurações: %s\n", err) -// } - -// cfg := config.Config{} - -// c, err := ConnectGitlab(&cfg) -// if err != nil { -// t.Fatalf("Failed to create client: %v", err) - -// } - -// expectedBaseURL := "/api/v4/" - -// if c.BaseURL().String() != expectedBaseURL { -// t.Errorf("NewClient BaseUrl is %s, want %s", c.BaseURL().String(), expectedBaseURL) -// } - -// } - -// type Config struct { -// Test string `mapstructure:"TEST"` -// } - -// var config1 = &Config{} - -// func GetMockConfig() *Config { -// return config1 -// } -// func TestConnectGitlabFail(t *testing.T) { - -// mockCfg := config1 - -// c, err := ConnectGitlab(mockCfg) -// got := err -// expected := "" - -// if got.Error() != expected { - -// } - -// expectedBaseURL := "/api/v4/" - -// if c.BaseURL().String() != expectedBaseURL { -// t.Errorf("NewClient BaseUrl is %s, want %s", c.BaseURL().String(), expectedBaseURL) -// } - -// } - -// func TestGitlabLoadJSON(t *testing.T) { - -// } - -// func TestGitlabLoadString(t *testing.T) { - -// } +import ( + "net/http" + "net/http/httptest" + "testing" + + "github.com/bancodobrasil/featws-api/dtos" + mocks_services "github.com/bancodobrasil/featws-api/mocks/services" + "github.com/bancodobrasil/featws-api/services" +) + +func TestSaveSucess(t *testing.T) { + dto := &dtos.Rulesheet{ + ID: 1, + Name: "Teste", + Description: "Teste", + } + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Save", &dto, "test").Return(nil) + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + err := services.Gitlab.Save(nil, dto, "test") + if err != nil { + t.Error("unexpected error:", err) + } + + })) + defer s.Close() +} diff --git a/services/rulesheets.go b/services/rulesheets.go index 9d40b1d..b099719 100644 --- a/services/rulesheets.go +++ b/services/rulesheets.go @@ -44,13 +44,9 @@ func NewRulesheets(repository repository.Rulesheets, gitlabService Gitlab) Rules func (rs rulesheets) Create(ctx context.Context, rulesheetDTO *dtos.Rulesheet) (err error) { //TODO verifica unicidade do nome - rulesheet, err := models.NewRulesheetV1(*rulesheetDTO) + rulesheet, _ := models.NewRulesheetV1(*rulesheetDTO) rulesheet.Slug = slug.Make(rulesheet.Slug) fmt.Print(rulesheet.Slug) - if err != nil { - log.Errorf("Error on create rulesheet on create model: %v", err) - return - } err = rs.repository.Create(ctx, &rulesheet) if err != nil { @@ -97,13 +93,6 @@ func (rs rulesheets) Find(ctx context.Context, filter interface{}, options *Find result = append(result, newRulesheetDTO(entity)) } - // for _, rulesheet := range result { - // err = fillWithGitlab(rulesheet) - // if err != nil { - // return - // } - // } - return } @@ -144,11 +133,7 @@ func (rs rulesheets) Get(ctx context.Context, id string) (result *dtos.Rulesheet // UpdateRulesheet ... func (rs rulesheets) Update(ctx context.Context, rulesheetDTO dtos.Rulesheet) (result *dtos.Rulesheet, err error) { - entity, err := models.NewRulesheetV1(rulesheetDTO) - if err != nil { - log.Errorf("Error on create rulesheet on create model: %v", err) - return - } + entity, _ := models.NewRulesheetV1(rulesheetDTO) _, err = rs.repository.Update(ctx, entity) if err != nil { @@ -162,12 +147,6 @@ func (rs rulesheets) Update(ctx context.Context, rulesheetDTO dtos.Rulesheet) (r return } - // err = rs.gitlabService.Fill(&rulesheetDTO) - // if err != nil { - // log.Errorf("Error on fill rulesheet with gitlab information: %v", err) - // return - // } - result = &rulesheetDTO return From 9a6cbf2cbd0b3b3b2558f76e203c1a799dece062 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Thu, 1 Sep 2022 19:29:02 -0300 Subject: [PATCH 06/55] feat: implement tests WIP --- services/gitlab_test.go | 168 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 160 insertions(+), 8 deletions(-) diff --git a/services/gitlab_test.go b/services/gitlab_test.go index e3117eb..c06dd93 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -1,30 +1,182 @@ package services_test import ( + "encoding/json" + "fmt" + "io" "net/http" "net/http/httptest" "testing" + "github.com/bancodobrasil/featws-api/config" "github.com/bancodobrasil/featws-api/dtos" mocks_services "github.com/bancodobrasil/featws-api/mocks/services" "github.com/bancodobrasil/featws-api/services" + "github.com/stretchr/testify/assert" ) -func TestSaveSucess(t *testing.T) { +func SetupRulesheet() *dtos.Rulesheet { + rulesheet := dtos.Rulesheet{ + ID: 1, + Name: "Test", + Description: "Test", + } + return &rulesheet +} + +func TestSaveAndCreateProject(t *testing.T) { + dto := SetupRulesheet() + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") + } + +} + +// func TestSaveCheckIfActionsAreAddedToCommit(t *testing.T) { +// dto := SetupRulesheet() + +// } + +// func TestSaveSucess(t *testing.T) { +// dto := &dtos.Rulesheet{ +// ID: 1, +// Name: "Teste", +// Description: "Teste", +// } + +// s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { +// fmt.Printf("%s %s %s\n", r.Method, r.URL, r.Proto) +// })) + +// cfg := config.Config{ +// GitlabURL: s.URL, +// } + +// gitlabService := new(mocks_services.Gitlab) +// gitlabService.On("Save", &dto, "test").Return(nil) + +// ngl := services.NewGitlab(&cfg) +// err := ngl.Save(dto, "test") +// if !assert.Nil(t, err) { +// t.Fail() +// } +// } +// func TestSaveGetNamespaceError(t *testing.T) { +// dto := &dtos.Rulesheet{ +// ID: 1, +// Name: "Teste", +// Description: "Teste", +// } + +// s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { +// fmt.Printf("%s %s %s\n", r.Method, r.URL, r.Proto) +// })) +// defer s.Close() + +// cfg := config.Config{ +// GitlabURL: s.URL, +// GitlabNamespace: "", +// GitlabToken: "glpat-kxhJPq3iYRr15dpaqAPr", +// } + +// ngl := services.NewGitlab(&cfg) +// ngl.Connect() +// err := ngl.Save(dto, "test") + +// if err == nil { +// t.Error("unexpected error") +// } +// } + +// func TestSaveGetProject(t *testing.T) { +// dto := &dtos.Rulesheet{ +// ID: 1, +// Name: "Teste", +// Description: "Teste", +// } + +// s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { +// fmt.Printf("%s %s %s\n", r.Method, r.URL, r.Proto) + +// })) +// defer s.Close() + +// cfg := config.Config{ +// GitlabURL: s.URL, +// GitlabNamespace: "", +// GitlabToken: "glpat-kxhJPq3iYRr15dpaqAPr", +// GitlabPrefix: "", +// } + +// ngl := services.NewGitlab(&cfg) +// ngl.Connect() +// err := ngl.Save(dto, "test") + +// if err == nil { +// t.Error("unexpected error") +// } +// } + +func TestFill(t *testing.T) { dto := &dtos.Rulesheet{ ID: 1, Name: "Teste", Description: "Teste", } - gitlabService := new(mocks_services.Gitlab) - gitlabService.On("Save", &dto, "test").Return(nil) s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - err := services.Gitlab.Save(nil, dto, "test") - if err != nil { - t.Error("unexpected error:", err) - } - + fmt.Printf("%s %s %s\n", r.Method, r.URL, r.Proto) })) defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + } + + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Fill", &dto, "test").Return(nil) + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Fill(dto) + if !assert.Nil(t, err) { + t.Fail() + } } From b612f951aba87448593f3e52948d89ba6f2d5bc1 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Thu, 8 Sep 2022 15:46:00 -0300 Subject: [PATCH 07/55] feat:implement-tests WIP --- controllers/health_test.go | 47 +- controllers/home_test.go | 8 +- controllers/v1/rulesheets_test.go | 121 +++-- dtos/rulesheets.go | 4 +- payloads/v1/rulesheet.go | 18 +- responses/v1/rulesheet.go | 16 +- services/gitlab.go | 47 +- services/gitlab_test.go | 714 +++++++++++++++++++++++++++--- 8 files changed, 787 insertions(+), 188 deletions(-) diff --git a/controllers/health_test.go b/controllers/health_test.go index 63748ed..bd481aa 100644 --- a/controllers/health_test.go +++ b/controllers/health_test.go @@ -1,37 +1,26 @@ package controllers_test -import ( - "io/ioutil" - "net/http" - "net/http/httptest" - "testing" +// func TestHealthLive(t *testing.T) { +// gin.SetMode(gin.TestMode) - "github.com/bancodobrasil/featws-api/controllers" - "github.com/gin-gonic/gin" - "github.com/stretchr/testify/assert" -) +// r := gin.Default() +// r.GET("/health/live", controllers.NewHealthController().HealthLiveHandler()) -func TestHealthLive(t *testing.T) { - gin.SetMode(gin.TestMode) +// req, err := http.NewRequest("GET", "/health/live", nil) +// if err != nil { +// t.Fatalf("Couldn't create request: %v\n", err) +// } - r := gin.Default() - r.GET("/health/live", controllers.NewHealthController().HealthLiveHandler()) +// w := httptest.NewRecorder() +// r.ServeHTTP(w, req) +// defer w.Result().Body.Close() - req, err := http.NewRequest("GET", "/health/live", nil) - if err != nil { - t.Fatalf("Couldn't create request: %v\n", err) - } +// mockUserResp := `{"goroutine-threshold": "OK"}` +// //Using testify - w := httptest.NewRecorder() - r.ServeHTTP(w, req) - defer w.Result().Body.Close() +// assert.Nil(t, err) +// assert.Equal(t, http.StatusOK, w.Code) +// responseData, _ := ioutil.ReadAll(w.Body) +// assert.Equal(t, mockUserResp, string(responseData)) - mockUserResp := `{"goroutine-threshold": "OK"}` - //Using testify - - assert.Nil(t, err) - assert.Equal(t, http.StatusOK, w.Code) - responseData, _ := ioutil.ReadAll(w.Body) - assert.Equal(t, mockUserResp, string(responseData)) - -} +// } diff --git a/controllers/home_test.go b/controllers/home_test.go index 0d913a4..7a22e9d 100644 --- a/controllers/home_test.go +++ b/controllers/home_test.go @@ -36,10 +36,10 @@ func TestHomeHandler(t *testing.T) { } -r.GET("/recipes", ListRecipesHandler) +// r.GET("/recipes", ListRecipesHandler) -   req, _ := http.NewRequest("GET", "/recipes", nil) +//    req, _ := http.NewRequest("GET", "/recipes", nil) -   w := httptest.NewRecorder() +//    w := httptest.NewRecorder() -   r.ServeHTTP(w, req) +//    r.ServeHTTP(w, req) diff --git a/controllers/v1/rulesheets_test.go b/controllers/v1/rulesheets_test.go index 313873e..f4f3b0a 100644 --- a/controllers/v1/rulesheets_test.go +++ b/controllers/v1/rulesheets_test.go @@ -1,23 +1,63 @@ package v1_test import ( + "context" "encoding/json" - "fmt" - "io/ioutil" + "errors" "net/http" "net/http/httptest" "testing" v1 "github.com/bancodobrasil/featws-api/controllers/v1" - "github.com/bancodobrasil/featws-api/routes" + "github.com/bancodobrasil/featws-api/dtos" + mocks_repository "github.com/bancodobrasil/featws-api/mocks/repository" + mocks_services "github.com/bancodobrasil/featws-api/mocks/services" + "github.com/bancodobrasil/featws-api/models" + "github.com/bancodobrasil/featws-api/services" "github.com/gin-gonic/gin" - "github.com/stretchr/testify/assert" + "github.com/go-playground/assert/v2" ) -type Rulesheet struct { - ID string `json:"id"` - Name string `json:"name"` - Description string `json:"description"` +// type Rulesheet struct { +// ID string `json:"id"` +// Name string `json:"name"` +// Description string `json:"description"` +// } + +func Setup() *gin.Engine { + gin.SetMode(gin.TestMode) + r := gin.Default() + return r +} + +type rulesheets struct { + service *mocks_services.Rulesheets +} + +func SetupRulesheet(t *testing.T) v1.Rulesheets { + ctx := context.Background() + + dto := &dtos.Rulesheet{ + ID: 1, + } + + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + + repository := new(mocks_repository.Rulesheets) + repository.On("Get", ctx, "1").Return(&entity, nil) + + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Fill", dto).Return(errors.New("error on fill")) + + // Provavel referencia ciclica pois esta testando o servico chanmando o proprio servico ao inves do mock + services := services.NewRulesheets(repository, gitlabService) + + return &rulesheets{ + service: services, + } } func TestListRulesheets(t *testing.T) { @@ -26,7 +66,10 @@ func TestListRulesheets(t *testing.T) { // service, _ := services.Rulesheets.Find() r := gin.Default() - r.GET("/v1/rulesheets", v1.Rulesheets.GetRulesheets()) + + rulesheet := SetupRulesheet(t) + + r.GET("/api/v1/rulesheets/", v1.Rulesheets.GetRulesheets()) req, err := http.NewRequest("GET", "/api/v1/rulesheets", nil) if err != nil { @@ -45,42 +88,42 @@ func TestListRulesheets(t *testing.T) { } -func TestFindRulesheet(t *testing.T) { +// func TestFindRulesheet(t *testing.T) { - // iniciolizacao de um servidor Gin - ts := httptest.NewServer(routes.SetupRoutesWithReturn()) - defer ts.Close() +// // iniciolizacao de um servidor Gin +// ts := httptest.NewServer(routes.SetupRoutesWithReturn()) +// defer ts.Close() - // criacao da folha de regras esperada - expectedRulesheet := Rulesheet{ - ID: "1", - Name: "Rulesheet 1", - Description: "Rulesheet 1 description", - } +// // criacao da folha de regras esperada +// expectedRulesheet := Rulesheet{ +// ID: "1", +// Name: "Rulesheet 1", +// Description: "Rulesheet 1 description", +// } - // chamada do servico de busca da folha de regras especifica - resp, err := http.Get(fmt.Sprintf("%s/v1/rulesheets/1", ts.URL)) - if err != nil { - t.Fatalf("Couldn't make request: %v\n", err) - } - defer resp.Body.Close() - //Usando o testify +// // chamada do servico de busca da folha de regras especifica +// resp, err := http.Get(fmt.Sprintf("%s/v1/rulesheets/1", ts.URL)) +// if err != nil { +// t.Fatalf("Couldn't make request: %v\n", err) +// } +// defer resp.Body.Close() +// //Usando o testify - //Testa se os erros sao nulos - assert.Nil(t, err) +// //Testa se os erros sao nulos +// assert.Nil(t, err) - // Testa se o codigo de resposta e 200 - assert.Equal(t, http.StatusOK, resp.StatusCode) +// // Testa se o codigo de resposta e 200 +// assert.Equal(t, http.StatusOK, resp.StatusCode) - // Faz a leitura do corpo da resposta - data, _ := ioutil.ReadAll(resp.Body) +// // Faz a leitura do corpo da resposta +// data, _ := ioutil.ReadAll(resp.Body) - // instancia um objeto do tipo Rulesheet, esta errado nao sei qual utlizar - var actualRulesheet Rulesheet +// // instancia um objeto do tipo Rulesheet, esta errado nao sei qual utlizar +// var actualRulesheet Rulesheet - // faz o parse do corpo da resposta para o objeto actualRulesheet - json.Unmarshal(data, &actualRulesheet) +// // faz o parse do corpo da resposta para o objeto actualRulesheet +// json.Unmarshal(data, &actualRulesheet) - //Using testify - assert.Equal(t, expectedRulesheet.Name, actualRulesheet.Name) -} +// //Using testify +// assert.Equal(t, expectedRulesheet.Name, actualRulesheet.Name) +// } diff --git a/dtos/rulesheets.go b/dtos/rulesheets.go index cff80f9..0b6c4fd 100644 --- a/dtos/rulesheets.go +++ b/dtos/rulesheets.go @@ -29,8 +29,8 @@ type Rulesheet struct { Slug string HasStringRule bool Version string - Features *[]interface{} - Parameters *[]interface{} + Features *[]map[string]interface{} + Parameters *[]map[string]interface{} Rules *map[string]interface{} } diff --git a/payloads/v1/rulesheet.go b/payloads/v1/rulesheet.go index fc3fdcd..a59c2d0 100644 --- a/payloads/v1/rulesheet.go +++ b/payloads/v1/rulesheet.go @@ -6,13 +6,13 @@ package v1 // Load []string `json:"load"` // } type Rulesheet struct { - ID uint `json:"id,omitempty"` - Name string `json:"name,omitempty" validate:"required"` - Description string `json:"description,omitempty"` - Slug string `json:"slug,omitempty"` - Version string `json:"version,omitempty"` - HasStringRule bool `json:"hasStringRule,omitempty"` - Features *[]interface{} `json:"features,omitempty"` - Parameters *[]interface{} `json:"parameters,omitempty"` - Rules *map[string]interface{} `json:"rules,omitempty"` + ID uint `json:"id,omitempty"` + Name string `json:"name,omitempty" validate:"required"` + Description string `json:"description,omitempty"` + Slug string `json:"slug,omitempty"` + Version string `json:"version,omitempty"` + HasStringRule bool `json:"hasStringRule,omitempty"` + Features *[]map[string]interface{} `json:"features,omitempty"` + Parameters *[]map[string]interface{} `json:"parameters,omitempty"` + Rules *map[string]interface{} `json:"rules,omitempty"` } diff --git a/responses/v1/rulesheet.go b/responses/v1/rulesheet.go index 0f58b04..46aba51 100644 --- a/responses/v1/rulesheet.go +++ b/responses/v1/rulesheet.go @@ -5,14 +5,14 @@ import "github.com/bancodobrasil/featws-api/dtos" // Rulesheet ... type Rulesheet struct { FindResult - ID uint `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Slug string `json:"slug,omitempty"` - Version string `json:"version,omitempty"` - Features *[]interface{} `json:"features,omitempty"` - Parameters *[]interface{} `json:"parameters,omitempty"` - Rules *map[string]interface{} `json:"rules,omitempty"` + ID uint `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + Slug string `json:"slug,omitempty"` + Version string `json:"version,omitempty"` + Features *[]map[string]interface{} `json:"features,omitempty"` + Parameters *[]map[string]interface{} `json:"parameters,omitempty"` + Rules *map[string]interface{} `json:"rules,omitempty"` } // NewRulesheet ... diff --git a/services/gitlab.go b/services/gitlab.go index d66d73a..01b6eeb 100644 --- a/services/gitlab.go +++ b/services/gitlab.go @@ -124,21 +124,17 @@ func (gs *gitlabService) Save(rulesheet *dtos.Rulesheet, commitMessage string) e // FEATURES if rulesheet.Features == nil { - empty := make([]interface{}, 0) + empty := make([]map[string]interface{}, 0) rulesheet.Features = &empty } sort.Slice(*rulesheet.Features, func(i, j int) bool { - a := reflect.ValueOf((*rulesheet.Features)[i]) - b := reflect.ValueOf((*rulesheet.Features)[j]) - aKind := a.Kind() - bKind := b.Kind() - if aKind == reflect.Map && bKind == reflect.Map { - aValue := a.MapIndex(reflect.ValueOf("name")).Interface().(string) - bValue := b.MapIndex(reflect.ValueOf("name")).Interface().(string) - return aValue < bValue - } - return false + a := (*rulesheet.Features)[i] + b := (*rulesheet.Features)[j] + aValue := a["name"].(string) + bValue := b["name"].(string) + return aValue < bValue + }) content, err = json.MarshalIndent(rulesheet.Features, "", " ") @@ -155,21 +151,16 @@ func (gs *gitlabService) Save(rulesheet *dtos.Rulesheet, commitMessage string) e // PARAMETERS if rulesheet.Parameters == nil { - empty := make([]interface{}, 0) + empty := make([]map[string]interface{}, 0) rulesheet.Parameters = &empty } sort.Slice(*rulesheet.Parameters, func(i, j int) bool { - a := reflect.ValueOf((*rulesheet.Parameters)[i]) - b := reflect.ValueOf((*rulesheet.Parameters)[j]) - aKind := a.Kind() - bKind := b.Kind() - if aKind == reflect.Map && bKind == reflect.Map { - aValue := a.MapIndex(reflect.ValueOf("name")).Interface().(string) - bValue := b.MapIndex(reflect.ValueOf("name")).Interface().(string) - return aValue < bValue - } - return false + a := (*rulesheet.Parameters)[i] + b := (*rulesheet.Parameters)[j] + aValue := a["name"].(string) + bValue := b["name"].(string) + return aValue < bValue }) content, err = json.MarshalIndent(rulesheet.Parameters, "", " ") @@ -313,13 +304,13 @@ func (gs *gitlabService) Fill(rulesheet *dtos.Rulesheet) (err error) { rulesheet.Version = strings.Replace(string(bVersion), "\n", "", -1) - rulesheet.Features, err = gitlabLoadJSON(git, proj, gs.cfg.GitlabDefaultBranch, "features.json") + err = gitlabLoadJSON(git, proj, gs.cfg.GitlabDefaultBranch, "features.json", rulesheet.Features) if err != nil { log.Errorf("Failed to fetch features: %v", err) return } - rulesheet.Parameters, err = gitlabLoadJSON(git, proj, gs.cfg.GitlabDefaultBranch, "parameters.json") + err = gitlabLoadJSON(git, proj, gs.cfg.GitlabDefaultBranch, "parameters.json", rulesheet.Parameters) if err != nil { log.Errorf("Failed to fetch parameters: %v", err) return @@ -357,20 +348,18 @@ func (gs *gitlabService) Connect() (*gitlab.Client, error) { return git, nil } -func gitlabLoadJSON(git *gitlab.Client, proj *gitlab.Project, ref string, fileName string) (*[]interface{}, error) { +func gitlabLoadJSON(git *gitlab.Client, proj *gitlab.Project, ref string, fileName string, result interface{}) error { rawDecodedText, err := gitlabLoadString(git, proj, ref, fileName) if err != nil { log.Errorf("Error on load the JSON structure: %v", err) - return nil, err + return err } - result := &[]interface{}{} - if len(rawDecodedText) > 0 { json.Unmarshal(rawDecodedText, result) } - return result, nil + return nil } func gitlabLoadString(git *gitlab.Client, proj *gitlab.Project, ref string, fileName string) ([]byte, error) { diff --git a/services/gitlab_test.go b/services/gitlab_test.go index c06dd93..aae36b5 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -1,6 +1,7 @@ package services_test import ( + "encoding/base64" "encoding/json" "fmt" "io" @@ -13,6 +14,7 @@ import ( mocks_services "github.com/bancodobrasil/featws-api/mocks/services" "github.com/bancodobrasil/featws-api/services" "github.com/stretchr/testify/assert" + "github.com/xanzy/go-gitlab" ) func SetupRulesheet() *dtos.Rulesheet { @@ -69,90 +71,401 @@ func TestSaveAndCreateProject(t *testing.T) { } -// func TestSaveCheckIfActionsAreAddedToCommit(t *testing.T) { -// dto := SetupRulesheet() +func TestSaveAndUpdateProject(t *testing.T) { + dto := SetupRulesheet() -// } + namespace := "test" -// func TestSaveSucess(t *testing.T) { -// dto := &dtos.Rulesheet{ -// ID: 1, -// Name: "Teste", -// Description: "Teste", -// } + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// fmt.Printf("%s %s %s\n", r.Method, r.URL, r.Proto) -// })) + //Retrieving namespace + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste", "path":"test"}`)) + return + } -// cfg := config.Config{ -// GitlabURL: s.URL, -// } + // Get project + if r.URL.Path == "/api/v4/projects/test%2Fprefix-Test" { + w.Write([]byte(`{"id":1,"description:null","name":"test"}`)) + return + } -// gitlabService := new(mocks_services.Gitlab) -// gitlabService.On("Save", &dto, "test").Return(nil) + // Create project + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { -// ngl := services.NewGitlab(&cfg) -// err := ngl.Save(dto, "test") -// if !assert.Nil(t, err) { -// t.Fail() -// } -// } -// func TestSaveGetNamespaceError(t *testing.T) { -// dto := &dtos.Rulesheet{ -// ID: 1, -// Name: "Teste", -// Description: "Teste", -// } + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } -// s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// fmt.Printf("%s %s %s\n", r.Method, r.URL, r.Proto) -// })) -// defer s.Close() + //Create commits + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() -// cfg := config.Config{ -// GitlabURL: s.URL, -// GitlabNamespace: "", -// GitlabToken: "glpat-kxhJPq3iYRr15dpaqAPr", -// } + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } -// ngl := services.NewGitlab(&cfg) -// ngl.Connect() -// err := ngl.Save(dto, "test") + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") + } + +} + +func TestSaveTestFilesCreation(t *testing.T) { + dto := SetupRulesheet() + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + + version := c["actions"].([]interface{})[0].(map[string]interface{})["content"].(string) + assert.Equal(t, "1\n", version) + gitlab_ci := c["actions"].([]interface{})[1].(map[string]interface{})["content"].(string) + assert.Equal(t, "test ci-script", gitlab_ci) + features := c["actions"].([]interface{})[2].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", features) + parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", parameters) + rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) + assert.Equal(t, "", rulesFeatws) + + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") + } +} + +func TestSaveTestFilesCreationWithFeatures(t *testing.T) { + dto := SetupRulesheet() + + features := make([]map[string]interface{}, 0) + + features = append(features, map[string]interface{}{ + "name": "test1", + }) + + features = append(features, map[string]interface{}{ + "name": "test2", + }) + + features = append(features, map[string]interface{}{ + "name": "test3", + }) + + dto.Features = &features + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + + version := c["actions"].([]interface{})[0].(map[string]interface{})["content"].(string) + assert.Equal(t, "1\n", version) + gitlab_ci := c["actions"].([]interface{})[1].(map[string]interface{})["content"].(string) + assert.Equal(t, "test ci-script", gitlab_ci) + features := c["actions"].([]interface{})[2].(map[string]interface{})["content"].(string) + assert.Equal(t, "[\n {\n \"name\": \"test1\"\n },\n {\n \"name\": \"test2\"\n },\n {\n \"name\": \"test3\"\n }\n]", features) + parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", parameters) + rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) + assert.Equal(t, "", rulesFeatws) + + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") + } +} + +func TestSaveTestFilesCreationWithParameters(t *testing.T) { + dto := SetupRulesheet() + + parameters := make([]map[string]interface{}, 0) + + parameters = append(parameters, map[string]interface{}{ + "name": "test1", + }) + + parameters = append(parameters, map[string]interface{}{ + "name": "test2", + }) + + parameters = append(parameters, map[string]interface{}{ + "name": "test3", + }) + + dto.Parameters = ¶meters + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + + version := c["actions"].([]interface{})[0].(map[string]interface{})["content"].(string) + assert.Equal(t, "1\n", version) + gitlab_ci := c["actions"].([]interface{})[1].(map[string]interface{})["content"].(string) + assert.Equal(t, "test ci-script", gitlab_ci) + features := c["actions"].([]interface{})[2].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", features) + parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) + assert.Equal(t, "[\n {\n \"name\": \"test1\"\n },\n {\n \"name\": \"test2\"\n },\n {\n \"name\": \"test3\"\n }\n]", parameters) + rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) + assert.Equal(t, "", rulesFeatws) + + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") + } +} + +func TestSaveTestFilesCreationWithRules(t *testing.T) { + dto := SetupRulesheet() + + parameters := make([]map[string]interface{}, 0) + + parameters = append(parameters, map[string]interface{}{ + "name": "test1", + }) + + parameters = append(parameters, map[string]interface{}{ + "name": "test2", + }) + + parameters = append(parameters, map[string]interface{}{ + "name": "test3", + }) + + dto.Parameters = ¶meters + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + + version := c["actions"].([]interface{})[0].(map[string]interface{})["content"].(string) + assert.Equal(t, "1\n", version) + gitlab_ci := c["actions"].([]interface{})[1].(map[string]interface{})["content"].(string) + assert.Equal(t, "test ci-script", gitlab_ci) + features := c["actions"].([]interface{})[2].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", features) + parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) + assert.Equal(t, "[\n {\n \"name\": \"test1\"\n },\n {\n \"name\": \"test2\"\n },\n {\n \"name\": \"test3\"\n }\n]", parameters) + rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) + assert.Equal(t, "", rulesFeatws) + + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") + } +} + +func TestSaveTestFilesUpdate(t *testing.T) { + dto := SetupRulesheet() + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste", "path":"testpath"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { -// if err == nil { -// t.Error("unexpected error") -// } -// } + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } -// func TestSaveGetProject(t *testing.T) { -// dto := &dtos.Rulesheet{ -// ID: 1, -// Name: "Teste", -// Description: "Teste", -// } + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/0/repository/files/VERSION" { + content := base64.StdEncoding.EncodeToString([]byte("1\n")) -// s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// fmt.Printf("%s %s %s\n", r.Method, r.URL, r.Proto) + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) -// })) -// defer s.Close() + version := c["actions"].([]interface{})[0].(map[string]interface{})["content"].(string) + assert.Equal(t, "2\n", version) + gitlab_ci := c["actions"].([]interface{})[1].(map[string]interface{})["content"].(string) + assert.Equal(t, "test ci-script", gitlab_ci) + features := c["actions"].([]interface{})[2].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", features) + parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", parameters) + rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) + assert.Equal(t, "", rulesFeatws) -// cfg := config.Config{ -// GitlabURL: s.URL, -// GitlabNamespace: "", -// GitlabToken: "glpat-kxhJPq3iYRr15dpaqAPr", -// GitlabPrefix: "", -// } + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() -// ngl := services.NewGitlab(&cfg) -// ngl.Connect() -// err := ngl.Save(dto, "test") + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } -// if err == nil { -// t.Error("unexpected error") -// } -// } + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") + } +} func TestFill(t *testing.T) { dto := &dtos.Rulesheet{ @@ -180,3 +493,268 @@ func TestFill(t *testing.T) { t.Fail() } } + +// Testing Errors +func TestSaveGitlabTokenNil(t *testing.T) { + dto := SetupRulesheet() + + cfg := config.Config{ + GitlabURL: "test", + GitlabNamespace: "test", + } + + ngl := services.NewGitlab(&cfg) + err := ngl.Save(dto, "test") + if err != nil { + t.Error("expected nil return if gitlab token is nil") + } + +} + +func TestSaveErrorOnFetchNameSpace(t *testing.T) { + dto := SetupRulesheet() + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.WriteHeader(http.StatusNotFound) + return + } + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + if err == nil { + t.Error("expected error on fetch namespace") + } + +} + +func TestSaveErrorOnFetchProject(t *testing.T) { + dto := SetupRulesheet() + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + w.WriteHeader(http.StatusNotFound) + return + } + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + if err == nil { + t.Error("expected error on fetch project") + } + +} + +func TestSaveErrorOnCreateProject(t *testing.T) { + dto := SetupRulesheet() + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + + // _, _ := io.ReadAll(r.Body) + w.Write(nil) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err == nil { + t.Error("expected error on create project") + } + +} + +func TestSaveErrorOnResolveVersion(t *testing.T) { + dto := SetupRulesheet() + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/0/repository/files/VERSION" { + w.WriteHeader(http.StatusBadRequest) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err == nil { + t.Error("expected error on resolve version") + } + +} + +func TestSaveErrorOnParseVersion(t *testing.T) { + dto := SetupRulesheet() + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") + } +} + +// TODO: test save error on fetch version, +// func TestSaveErrorOnFetchVersion(t *testing.T) { +// dto := SetupRulesheet() + +// namespace := "test" + +// s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { +// if r.URL.Path == "/api/v4/namespaces/"+namespace { +// w.Write([]byte(`{"id":1,"name":"teste"}`)) +// return +// } +// if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { +// data, _ := io.ReadAll(r.Body) +// w.Write(data) +// return +// } + +// if r.Method == "GET" && r.URL.Path == "/api/v4/projects/0/repository/files/VERSION" { + +// } + +// if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { +// data, _ := io.ReadAll(r.Body) +// c := make(map[string]interface{}) +// json.Unmarshal(data, &c) +// w.Write(data) +// return +// } +// w.WriteHeader(http.StatusNotFound) +// })) +// defer s.Close() + +// cfg := config.Config{ +// GitlabURL: s.URL, +// GitlabNamespace: namespace, +// GitlabToken: "test", +// GitlabPrefix: "prefix-", +// GitlabCIScript: "test ci-script", +// } + +// ngl := services.NewGitlab(&cfg) +// ngl.Connect() +// err := ngl.Save(dto, "test") + +// if err != nil { +// t.Error("expected error on resolve version") +// } + +// } From 5437cf6e1174523d4da1288743f6b6273c9578a7 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Mon, 12 Sep 2022 11:39:29 -0300 Subject: [PATCH 08/55] feat: implementing tests WIP --- go.mod | 2 + go.sum | 5 +- services/gitlab_test.go | 133 +++++++++++++++++++++++++++++++++++----- 3 files changed, 123 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index ffc13a5..2ba97dc 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/bancodobrasil/healthcheck v0.0.2-rc1 github.com/gin-contrib/cors v1.3.1 github.com/gin-gonic/gin v1.7.7 + github.com/go-playground/assert/v2 v2.0.1 github.com/go-playground/validator/v10 v10.10.1 github.com/gosimple/slug v1.12.0 github.com/gsdenys/healthcheck v0.0.0-20220412001953-64e5089fa0bc @@ -31,6 +32,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fatih/structs v1.1.0 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-logr/logr v1.2.3 // indirect diff --git a/go.sum b/go.sum index 244cf86..511d09a 100644 --- a/go.sum +++ b/go.sum @@ -126,6 +126,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -471,7 +473,6 @@ github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8q github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -481,7 +482,6 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -1002,7 +1002,6 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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= diff --git a/services/gitlab_test.go b/services/gitlab_test.go index aae36b5..b53f923 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -328,24 +328,129 @@ func TestSaveTestFilesCreationWithParameters(t *testing.T) { } } -func TestSaveTestFilesCreationWithRules(t *testing.T) { +func TestSaveTestFilesCreationWithRuleInterface(t *testing.T) { dto := SetupRulesheet() + // func SetupRulesheet() *dtos.Rulesheet { + // rulesheet := dtos.Rulesheet{ + // ID: 1, + // Name: "Test", + // Description: "Test", + // } + // return &rulesheet + // } + + // type Server struct { + // Name string + // ID int32 + // Enabled bool + // } + + // s := &Server{ + // Name: "gopher", + // ID: 123456, + // Enabled: true, + // } + + // dtos.Rule{ + // Condition: "test", + // Value: dtos.RuleValue{ + // NomeAplicativo: "testAplicativo", + // TextoURLPadrao: "testURLpadrao", + // TextoURLDesvio: "testURLdesvio", + // }, + // Type: "testType", + // } + + // values := dtos.RuleValue{ + // NomeAplicativo: "testAplicativo", + // TextoURLPadrao: "testURLpadrao", + // TextoURLDesvio: "testURLdesvio", + // } + + rules := []interface{}{ + &dtos.Rule{ + + Condition: "test", + Value: dtos.RuleValue{ + NomeAplicativo: "testAplicativo", + TextoURLPadrao: "testURLpadrao", + TextoURLDesvio: "testURLdesvio", + }, + Type: "testType", + }, + } - parameters := make([]map[string]interface{}, 0) + mappedRules := map[string]interface{}{ + "tags": rules, + } + // data, _ := json.Marshal(mappedRules) + // json.Unmarshal(data, &mappedRules) - parameters = append(parameters, map[string]interface{}{ - "name": "test1", - }) + dto.Rules = &mappedRules - parameters = append(parameters, map[string]interface{}{ - "name": "test2", - }) + namespace := "test" - parameters = append(parameters, map[string]interface{}{ - "name": "test3", - }) + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { - dto.Parameters = ¶meters + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + + version := c["actions"].([]interface{})[0].(map[string]interface{})["content"].(string) + assert.Equal(t, "1\n", version) + gitlab_ci := c["actions"].([]interface{})[1].(map[string]interface{})["content"].(string) + assert.Equal(t, "test ci-script", gitlab_ci) + features := c["actions"].([]interface{})[2].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", features) + parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", parameters) + rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) + assert.Equal(t, "[[tags]]\ncondition = test\nvalue = {\"nomeAplicativo\":\"testAplicativo\",\"textoUrlPadrao\":\"testURLpadrao\",\"textoUrlDesvio\":\"testURLdesvio\"}\ntype = object\n\n", rulesFeatws) + + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := config.Config{ + GitlabURL: s.URL, + GitlabNamespace: namespace, + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } + + ngl := services.NewGitlab(&cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") + } +} + +func TestSaveTestFilesCreationWithStringRule(t *testing.T) { + dto := SetupRulesheet() + + rules := make(map[string]interface{}) + + rules["test1"] = "test1" + rules["test2"] = "test2" + rules["test3"] = "test3" + + dto.Rules = &rules namespace := "test" @@ -372,9 +477,9 @@ func TestSaveTestFilesCreationWithRules(t *testing.T) { features := c["actions"].([]interface{})[2].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", features) parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) - assert.Equal(t, "[\n {\n \"name\": \"test1\"\n },\n {\n \"name\": \"test2\"\n },\n {\n \"name\": \"test3\"\n }\n]", parameters) + assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "", rulesFeatws) + assert.Equal(t, "test1 = test1\ntest2 = test2\ntest3 = test3\n", rulesFeatws) w.Write(data) return From 73f31cdf96c9702b4a84c28ae9c85dd28f2bb812 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Tue, 13 Sep 2022 14:02:06 -0300 Subject: [PATCH 09/55] feat: implementing tests on gitlab --- go.mod | 1 - go.sum | 2 - services/gitlab_test.go | 347 ++++++++++++++++++++++++---------------- 3 files changed, 207 insertions(+), 143 deletions(-) diff --git a/go.mod b/go.mod index 2ba97dc..48bb95d 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/fatih/structs v1.1.0 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-logr/logr v1.2.3 // indirect diff --git a/go.sum b/go.sum index 511d09a..8626ba0 100644 --- a/go.sum +++ b/go.sum @@ -126,8 +126,6 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= diff --git a/services/gitlab_test.go b/services/gitlab_test.go index b53f923..3045466 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -3,7 +3,6 @@ package services_test import ( "encoding/base64" "encoding/json" - "fmt" "io" "net/http" "net/http/httptest" @@ -11,12 +10,22 @@ import ( "github.com/bancodobrasil/featws-api/config" "github.com/bancodobrasil/featws-api/dtos" - mocks_services "github.com/bancodobrasil/featws-api/mocks/services" "github.com/bancodobrasil/featws-api/services" "github.com/stretchr/testify/assert" "github.com/xanzy/go-gitlab" ) +func SetupConfig(url *httptest.Server) *config.Config { + cfg := config.Config{ + GitlabURL: url.URL, + GitlabNamespace: "test", + GitlabToken: "test", + GitlabPrefix: "prefix-", + GitlabCIScript: "test ci-script", + } + return &cfg +} + func SetupRulesheet() *dtos.Rulesheet { rulesheet := dtos.Rulesheet{ ID: 1, @@ -26,6 +35,7 @@ func SetupRulesheet() *dtos.Rulesheet { return &rulesheet } +// Functions for test Save function func TestSaveAndCreateProject(t *testing.T) { dto := SetupRulesheet() @@ -53,15 +63,9 @@ func TestSaveAndCreateProject(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", - } + cfg := SetupConfig(s) - ngl := services.NewGitlab(&cfg) + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -110,15 +114,9 @@ func TestSaveAndUpdateProject(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", - } + cfg := SetupConfig(s) - ngl := services.NewGitlab(&cfg) + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -167,15 +165,9 @@ func TestSaveTestFilesCreation(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", - } + cfg := SetupConfig(s) - ngl := services.NewGitlab(&cfg) + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -239,15 +231,9 @@ func TestSaveTestFilesCreationWithFeatures(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", - } + cfg := SetupConfig(s) - ngl := services.NewGitlab(&cfg) + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -311,15 +297,9 @@ func TestSaveTestFilesCreationWithParameters(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", - } + cfg := SetupConfig(s) - ngl := services.NewGitlab(&cfg) + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -330,42 +310,6 @@ func TestSaveTestFilesCreationWithParameters(t *testing.T) { func TestSaveTestFilesCreationWithRuleInterface(t *testing.T) { dto := SetupRulesheet() - // func SetupRulesheet() *dtos.Rulesheet { - // rulesheet := dtos.Rulesheet{ - // ID: 1, - // Name: "Test", - // Description: "Test", - // } - // return &rulesheet - // } - - // type Server struct { - // Name string - // ID int32 - // Enabled bool - // } - - // s := &Server{ - // Name: "gopher", - // ID: 123456, - // Enabled: true, - // } - - // dtos.Rule{ - // Condition: "test", - // Value: dtos.RuleValue{ - // NomeAplicativo: "testAplicativo", - // TextoURLPadrao: "testURLpadrao", - // TextoURLDesvio: "testURLdesvio", - // }, - // Type: "testType", - // } - - // values := dtos.RuleValue{ - // NomeAplicativo: "testAplicativo", - // TextoURLPadrao: "testURLpadrao", - // TextoURLDesvio: "testURLdesvio", - // } rules := []interface{}{ &dtos.Rule{ @@ -424,15 +368,71 @@ func TestSaveTestFilesCreationWithRuleInterface(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", + cfg := SetupConfig(s) + + ngl := services.NewGitlab(cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") } +} - ngl := services.NewGitlab(&cfg) +func TestSaveTestFilesCreationWithRuleInterfaceWithDefault(t *testing.T) { + dto := SetupRulesheet() + + rules := []interface{}{ + "test", + } + + mappedRules := map[string]interface{}{ + "tags": rules, + } + // data, _ := json.Marshal(mappedRules) + // json.Unmarshal(data, &mappedRules) + + dto.Rules = &mappedRules + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + + version := c["actions"].([]interface{})[0].(map[string]interface{})["content"].(string) + assert.Equal(t, "1\n", version) + gitlab_ci := c["actions"].([]interface{})[1].(map[string]interface{})["content"].(string) + assert.Equal(t, "test ci-script", gitlab_ci) + features := c["actions"].([]interface{})[2].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", features) + parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", parameters) + rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) + assert.Equal(t, "DEFAULT ENTRY tags = []interface {}\n", rulesFeatws) + + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := SetupConfig(s) + + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -488,15 +488,79 @@ func TestSaveTestFilesCreationWithStringRule(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", + cfg := SetupConfig(s) + + ngl := services.NewGitlab(cfg) + ngl.Connect() + err := ngl.Save(dto, "test") + + if err != nil { + t.Error("unexpected error") } +} - ngl := services.NewGitlab(&cfg) +func TestSaveTestFilesCreationWithDefaultRule(t *testing.T) { + dto := SetupRulesheet() + + rules := + &dtos.Rule{ + + Condition: "test", + Value: dtos.RuleValue{ + NomeAplicativo: "testAplicativo", + TextoURLPadrao: "testURLpadrao", + TextoURLDesvio: "testURLdesvio", + }, + Type: "testType", + } + + mappedRules := map[string]interface{}{ + "tags": rules, + } + // data, _ := json.Marshal(mappedRules) + // json.Unmarshal(data, &mappedRules) + + dto.Rules = &mappedRules + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste"}`)) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { + + data, _ := io.ReadAll(r.Body) + w.Write(data) + return + } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { + data, _ := io.ReadAll(r.Body) + c := make(map[string]interface{}) + json.Unmarshal(data, &c) + + version := c["actions"].([]interface{})[0].(map[string]interface{})["content"].(string) + assert.Equal(t, "1\n", version) + gitlab_ci := c["actions"].([]interface{})[1].(map[string]interface{})["content"].(string) + assert.Equal(t, "test ci-script", gitlab_ci) + features := c["actions"].([]interface{})[2].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", features) + parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) + assert.Equal(t, "[]", parameters) + rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) + assert.Equal(t, "DEFAULT tags = *dtos.Rule\n", rulesFeatws) + + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := SetupConfig(s) + + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -532,6 +596,7 @@ func TestSaveTestFilesUpdate(t *testing.T) { w.Write(data) return } + if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { data, _ := io.ReadAll(r.Body) c := make(map[string]interface{}) @@ -555,15 +620,9 @@ func TestSaveTestFilesUpdate(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", - } + cfg := SetupConfig(s) - ngl := services.NewGitlab(&cfg) + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -572,30 +631,56 @@ func TestSaveTestFilesUpdate(t *testing.T) { } } +// Functions to test fill function func TestFill(t *testing.T) { - dto := &dtos.Rulesheet{ - ID: 1, - Name: "Teste", - Description: "Teste", - } + dto := SetupRulesheet() + + namespace := "test" s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Printf("%s %s %s\n", r.Method, r.URL, r.Proto) + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste", "path":"testpath"}`)) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/testpath/prefix-Test" { + w.Write([]byte(`{"id":1,"description":"testeDesc","name":"teste"}`)) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/rules.featws" { + content := base64.StdEncoding.EncodeToString([]byte("regra = $test")) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/parameters.json" { + content := base64.StdEncoding.EncodeToString([]byte("[]")) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + + w.WriteHeader(http.StatusNotFound) })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - } - - gitlabService := new(mocks_services.Gitlab) - gitlabService.On("Fill", &dto, "test").Return(nil) + cfg := SetupConfig(s) - ngl := services.NewGitlab(&cfg) + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Fill(dto) - if !assert.Nil(t, err) { - t.Fail() + if err != nil { + t.Error("unexpected error") } } @@ -703,15 +788,9 @@ func TestSaveErrorOnCreateProject(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", - } + cfg := SetupConfig(s) - ngl := services.NewGitlab(&cfg) + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -752,15 +831,9 @@ func TestSaveErrorOnResolveVersion(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", - } + cfg := SetupConfig(s) - ngl := services.NewGitlab(&cfg) + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -797,15 +870,9 @@ func TestSaveErrorOnParseVersion(t *testing.T) { })) defer s.Close() - cfg := config.Config{ - GitlabURL: s.URL, - GitlabNamespace: namespace, - GitlabToken: "test", - GitlabPrefix: "prefix-", - GitlabCIScript: "test ci-script", - } + cfg := SetupConfig(s) - ngl := services.NewGitlab(&cfg) + ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Save(dto, "test") @@ -854,7 +921,7 @@ func TestSaveErrorOnParseVersion(t *testing.T) { // GitlabCIScript: "test ci-script", // } -// ngl := services.NewGitlab(&cfg) +// ngl := services.NewGitlab(cfg) // ngl.Connect() // err := ngl.Save(dto, "test") From 37aeaab8fdf78f446ac90f3a08f3541232caf650 Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Thu, 15 Sep 2022 14:06:17 -0300 Subject: [PATCH 10/55] feat: OpenAMURL config --- config/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.go b/config/config.go index 038765a..7c49809 100644 --- a/config/config.go +++ b/config/config.go @@ -19,6 +19,7 @@ type Config struct { GitlabDefaultBranch string `mapstructure:"FEATWS_API_GITLAB_DEFAULT_BRANCH"` GitlabCIScript string `mapstructure:"FEATWS_API_GITLAB_CI_SCRIPT"` ExternalHost string `mapstructure:"EXTERNAL_HOST"` + OpenAMURL string `mapstructure:"OPEN_AM_URL"` } var config = &Config{} @@ -41,6 +42,7 @@ func LoadConfig() (err error) { viper.SetDefault("FEATWS_API_GITLAB_DEFAULT_BRANCH", "main") viper.SetDefault("FEATWS_API_GITLAB_CI_SCRIPT", "") viper.SetDefault("EXTERNAL_HOST", "localhost:9007") + viper.SetDefault("OPEN_AM_URL", "") err = viper.ReadInConfig() if err != nil { From b60362f4a1297a4d4adae5170a6c04be081f3379 Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Thu, 15 Sep 2022 14:07:26 -0300 Subject: [PATCH 11/55] feat: adding jwx dependency --- go.mod | 16 ++++++++++++---- go.sum | 30 +++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 8e95e5b..98b7ddb 100644 --- a/go.mod +++ b/go.mod @@ -11,10 +11,11 @@ require ( github.com/go-playground/validator/v10 v10.10.1 github.com/gosimple/slug v1.12.0 github.com/gsdenys/healthcheck v0.0.0-20220412001953-64e5089fa0bc + github.com/lestrrat-go/jwx/v2 v2.0.6 github.com/prometheus/client_golang v1.12.1 github.com/sirupsen/logrus v1.9.0 github.com/spf13/viper v1.11.0 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 github.com/swaggo/gin-swagger v1.4.2 github.com/swaggo/swag v1.7.9 github.com/toorop/gin-logrus v0.0.0-20210225092905-2c785434f26f @@ -31,6 +32,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-logr/logr v1.2.3 // indirect @@ -42,6 +44,7 @@ require ( github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/goccy/go-json v0.9.11 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/gosimple/unidecode v1.0.1 // indirect @@ -53,6 +56,11 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/leodido/go-urn v1.2.1 // indirect + github.com/lestrrat-go/blackmagic v1.0.1 // indirect + github.com/lestrrat-go/httpcc v1.0.1 // indirect + github.com/lestrrat-go/httprc v1.0.4 // indirect + github.com/lestrrat-go/iter v1.0.2 // indirect + github.com/lestrrat-go/option v1.0.0 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mailru/easyjson v0.7.6 // indirect github.com/mattn/go-isatty v0.0.14 // indirect @@ -70,7 +78,7 @@ require ( github.com/spf13/cast v1.4.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/objx v0.1.1 // indirect + github.com/stretchr/objx v0.4.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/ugorji/go/codec v1.2.7 // indirect github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.15 // indirect @@ -78,7 +86,7 @@ require ( go.opentelemetry.io/otel v1.8.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect go.opentelemetry.io/otel/sdk v1.8.0 // indirect - golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect + golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect @@ -89,5 +97,5 @@ require ( google.golang.org/protobuf v1.28.0 // indirect gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 9ae1ab9..4f83c2f 100644 --- a/go.sum +++ b/go.sum @@ -111,6 +111,9 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -182,6 +185,8 @@ github.com/go-playground/validator/v10 v10.10.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4 github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -347,6 +352,18 @@ github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdA github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80= +github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= +github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= +github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= +github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8= +github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= +github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= +github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= +github.com/lestrrat-go/jwx/v2 v2.0.6 h1:RlyYNLV892Ed7+FTfj1ROoF6x7WxL965PGTHso/60G0= +github.com/lestrrat-go/jwx/v2 v2.0.6/go.mod h1:aVrGuwEr3cp2Prw6TtQvr8sQxe+84gruID5C9TxT64Q= +github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= +github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= @@ -471,16 +488,18 @@ github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8q github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= @@ -550,8 +569,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= +golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -998,8 +1017,9 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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/mysql v1.3.3 h1:jXG9ANrwBc4+bMvBcSl8zCfPBaVoPyBEBshA8dA93X8= gorm.io/driver/mysql v1.3.3/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= From 76798efb5614ec313ceb49432e86fe7d990fee4e Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Thu, 15 Sep 2022 14:08:10 -0300 Subject: [PATCH 12/55] feat: implementing VerifyAuthTokenMiddleware --- middlewares/verify_auth_token.go | 80 ++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 middlewares/verify_auth_token.go diff --git a/middlewares/verify_auth_token.go b/middlewares/verify_auth_token.go new file mode 100644 index 0000000..34b3d59 --- /dev/null +++ b/middlewares/verify_auth_token.go @@ -0,0 +1,80 @@ +package middlewares + +import ( + "bytes" + "context" + "fmt" + "strings" + "time" + + "github.com/bancodobrasil/featws-api/config" + "github.com/gin-gonic/gin" + "github.com/lestrrat-go/jwx/v2/jwa" + "github.com/lestrrat-go/jwx/v2/jwk" + "github.com/lestrrat-go/jwx/v2/jws" +) + +var cfg = config.GetConfig() +var ctx = context.Background() +var signatureKeyCache = jwk.NewCache(ctx) + +func InitializeSignatureKeyCache() { + signatureKeyCache.Register(cfg.OpenAMURL, jwk.WithMinRefreshInterval(15*time.Minute)) + _, err := signatureKeyCache.Refresh(ctx, cfg.OpenAMURL) + if err != nil { + fmt.Printf("Failed to refresh OpenAM JWKS: %s\n", err) + } +} + +func respondWithError(c *gin.Context, code int, message interface{}) { + c.AbortWithStatusJSON(code, gin.H{"error": message}) +} + +func extractTokenFromHeader(c *gin.Context) string { + authorizationHeader := c.Request.Header.Get("Authorization") + if authorizationHeader == "" { + respondWithError(c, 401, "Missing Authorization Header") + } + splitHeader := strings.Split(authorizationHeader, "Auth JWT") + if len(splitHeader) != 2 { + respondWithError(c, 401, "Invalid Authorization Header") + } + return strings.TrimSpace(splitHeader[1]) +} +func getSignatureKey(c *gin.Context) jwk.Key { + keyset, err := signatureKeyCache.Get(ctx, cfg.OpenAMURL) + errorMsg := "Failed to fetch OpenAM JWKS" + if err != nil { + fmt.Printf("%s: %s\n", errorMsg, err) + respondWithError(c, 502, errorMsg) + } + key, exists := keyset.Key(0) + if !exists { + fmt.Printf("%s: %s\n", errorMsg, err) + respondWithError(c, 502, errorMsg) + } + return key +} +func VerifyAuthTokenMiddleware() gin.HandlerFunc { + return func(c *gin.Context) { + token := extractTokenFromHeader(c) + + msg, err := jws.Parse([]byte(token)) + errorMsg := "Invalid Auth JWT" + if err != nil { + respondWithError(c, 401, errorMsg) + } + + key := getSignatureKey(c) + verified, err := jws.Verify([]byte(token), jws.WithKey(jwa.RS256, key)) + if err != nil { + respondWithError(c, 401, errorMsg) + } + + if !bytes.Equal(verified, msg.Payload()) { + respondWithError(c, 401, errorMsg) + } + + c.Next() + } +} From 0857f7e545c12a602805e8d8c06ddcbc8cc11e99 Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Thu, 15 Sep 2022 14:26:18 -0300 Subject: [PATCH 13/55] feat: InitializeMiddlewares --- main.go | 3 +++ middlewares/middlewares.go | 5 +++++ middlewares/verify_auth_token.go | 8 ++++---- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 middlewares/middlewares.go diff --git a/main.go b/main.go index 75035bc..8263d82 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "github.com/bancodobrasil/featws-api/config" "github.com/bancodobrasil/featws-api/database" _ "github.com/bancodobrasil/featws-api/docs" + "github.com/bancodobrasil/featws-api/middlewares" "github.com/bancodobrasil/featws-api/routes" ginMonitor "github.com/bancodobrasil/gin-monitor" "github.com/gin-contrib/cors" @@ -73,6 +74,8 @@ func main() { router := gin.New() + middlewares.InitializeMiddlewares() + router.Use(ginlogrus.Logger(log.StandardLogger()), gin.Recovery()) router.Use(monitor.Prometheus()) router.GET("metrics", gin.WrapH(promhttp.Handler())) diff --git a/middlewares/middlewares.go b/middlewares/middlewares.go new file mode 100644 index 0000000..38ef4b7 --- /dev/null +++ b/middlewares/middlewares.go @@ -0,0 +1,5 @@ +package middlewares + +func InitializeMiddlewares() { + InitializeSignatureKeyCache() +} diff --git a/middlewares/verify_auth_token.go b/middlewares/verify_auth_token.go index 34b3d59..da73964 100644 --- a/middlewares/verify_auth_token.go +++ b/middlewares/verify_auth_token.go @@ -3,7 +3,7 @@ package middlewares import ( "bytes" "context" - "fmt" + "log" "strings" "time" @@ -22,7 +22,7 @@ func InitializeSignatureKeyCache() { signatureKeyCache.Register(cfg.OpenAMURL, jwk.WithMinRefreshInterval(15*time.Minute)) _, err := signatureKeyCache.Refresh(ctx, cfg.OpenAMURL) if err != nil { - fmt.Printf("Failed to refresh OpenAM JWKS: %s\n", err) + log.Panicf("Failed to refresh OpenAM JWKS: %s\n", err) } } @@ -45,12 +45,12 @@ func getSignatureKey(c *gin.Context) jwk.Key { keyset, err := signatureKeyCache.Get(ctx, cfg.OpenAMURL) errorMsg := "Failed to fetch OpenAM JWKS" if err != nil { - fmt.Printf("%s: %s\n", errorMsg, err) + log.Printf("%s: %s\n", errorMsg, err) respondWithError(c, 502, errorMsg) } key, exists := keyset.Key(0) if !exists { - fmt.Printf("%s: %s\n", errorMsg, err) + log.Printf("%s: %s\n", errorMsg, err) respondWithError(c, 502, errorMsg) } return key From 3bafa438001ba4d34ca5171109a5820dbbe8b5e7 Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Thu, 15 Sep 2022 14:29:39 -0300 Subject: [PATCH 14/55] feat: using VerifyAuthTokenMiddleware on /v1 routes --- routes/api/v1/v1.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routes/api/v1/v1.go b/routes/api/v1/v1.go index f94dd0d..ed5af4b 100644 --- a/routes/api/v1/v1.go +++ b/routes/api/v1/v1.go @@ -1,11 +1,13 @@ package v1 import ( + "github.com/bancodobrasil/featws-api/middlewares" "github.com/gin-gonic/gin" ) // Router define routes the API V1 func Router(router *gin.RouterGroup) { + router.Use(middlewares.VerifyAuthTokenMiddleware()) rulesheetsRouter(router.Group("/rulesheets")) //rpcRouter(router.Group("/")) } From 7e6cb92dcf16c38afce453d555c7cbe285c06ccb Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Thu, 15 Sep 2022 17:43:09 -0300 Subject: [PATCH 15/55] feat: implementing tests WIP --- controllers/v1/rulesheets.go | 4 +- controllers/v1/rulesheets_test.go | 332 ++++++++++++++++++++---------- go.mod | 1 - 3 files changed, 224 insertions(+), 113 deletions(-) diff --git a/controllers/v1/rulesheets.go b/controllers/v1/rulesheets.go index cad170d..5acc37b 100644 --- a/controllers/v1/rulesheets.go +++ b/controllers/v1/rulesheets.go @@ -120,7 +120,7 @@ func (rc *rulesheets) GetRulesheets() gin.HandlerFunc { return func(c *gin.Context) { - ctx, cancel := context.WithTimeout(c.Request.Context(), 10*time.Second) + ctx, cancel := context.WithTimeout(c.Request.Context(), 100000*time.Second) defer cancel() query := c.Request.URL.Query() @@ -223,7 +223,7 @@ func (rc *rulesheets) GetRulesheet() gin.HandlerFunc { return func(c *gin.Context) { - ctx, cancel := context.WithTimeout(c.Request.Context(), 100*time.Second) + ctx, cancel := context.WithTimeout(c.Request.Context(), 10*time.Second) defer cancel() id, exists := c.Params.Get("id") diff --git a/controllers/v1/rulesheets_test.go b/controllers/v1/rulesheets_test.go index f4f3b0a..39604d1 100644 --- a/controllers/v1/rulesheets_test.go +++ b/controllers/v1/rulesheets_test.go @@ -1,129 +1,241 @@ package v1_test import ( - "context" - "encoding/json" "errors" "net/http" "net/http/httptest" + "net/url" "testing" v1 "github.com/bancodobrasil/featws-api/controllers/v1" "github.com/bancodobrasil/featws-api/dtos" - mocks_repository "github.com/bancodobrasil/featws-api/mocks/repository" - mocks_services "github.com/bancodobrasil/featws-api/mocks/services" - "github.com/bancodobrasil/featws-api/models" + mock_services "github.com/bancodobrasil/featws-api/mocks/services" "github.com/bancodobrasil/featws-api/services" "github.com/gin-gonic/gin" - "github.com/go-playground/assert/v2" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" ) -// type Rulesheet struct { -// ID string `json:"id"` -// Name string `json:"name"` -// Description string `json:"description"` -// } +func TestRulesheet_GetRulesheetByID(t *testing.T) { + t.Run("Not Found Rulesheet Flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + ctx, _ := gin.CreateTestContext(w) + ctx.Request = &http.Request{ + Header: make(http.Header), + } + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + srv := new(mock_services.Rulesheets) + srv.On("Get", mock.Anything, "1").Return(nil, nil) + v1.NewRulesheets(srv).GetRulesheet()(c) + assert.Equal(t, http.StatusNotFound, w.Code) + }) + + t.Run("Test Without ID Flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = &http.Request{ + Header: make(http.Header), + } + + srv := new(mock_services.Rulesheets) + v1.NewRulesheets(srv).GetRulesheet()(c) + assert.Equal(t, http.StatusBadRequest, w.Code) + }) + + t.Run("Wrong ID Flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = &http.Request{ + Header: make(http.Header), + } + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + srv := new(mock_services.Rulesheets) + srv.On("Get", mock.Anything, "1").Return(nil, errors.New("error")) + v1.NewRulesheets(srv).GetRulesheet()(c) + assert.Equal(t, http.StatusInternalServerError, w.Code) + }) + + t.Run("Entity Different Nil Flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = &http.Request{ + Header: make(http.Header), + } + + reponseEntity := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + srv := new(mock_services.Rulesheets) + srv.On("Get", mock.Anything, "1").Return(reponseEntity, nil) + v1.NewRulesheets(srv).GetRulesheet()(c) + assert.Equal(t, http.StatusOK, w.Code) + + }) -func Setup() *gin.Engine { - gin.SetMode(gin.TestMode) - r := gin.Default() - return r } -type rulesheets struct { - service *mocks_services.Rulesheets -} - -func SetupRulesheet(t *testing.T) v1.Rulesheets { - ctx := context.Background() - - dto := &dtos.Rulesheet{ - ID: 1, - } - - entity, err := models.NewRulesheetV1(*dto) - if err != nil { - t.Error("unexpected error on model creation") - } - - repository := new(mocks_repository.Rulesheets) - repository.On("Get", ctx, "1").Return(&entity, nil) - - gitlabService := new(mocks_services.Gitlab) - gitlabService.On("Fill", dto).Return(errors.New("error on fill")) - - // Provavel referencia ciclica pois esta testando o servico chanmando o proprio servico ao inves do mock - services := services.NewRulesheets(repository, gitlabService) +func TestRulesheet_GetAllRulesheets(t *testing.T) { + t.Run("Error on parse limit Query Flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = &http.Request{ + Header: make(http.Header), + } + c.Request.URL, _ = url.Parse("?limit=?^&page=1") + + srv := new(mock_services.Rulesheets) + v1.NewRulesheets(srv).GetRulesheets()(c) + assert.Equal(t, http.StatusInternalServerError, w.Code) + + }) + + t.Run("Error on parse page Query Flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = &http.Request{ + Header: make(http.Header), + } + c.Request.URL, _ = url.Parse("?limit=1&page=?^") + + srv := new(mock_services.Rulesheets) + v1.NewRulesheets(srv).GetRulesheets()(c) + assert.Equal(t, http.StatusInternalServerError, w.Code) + + }) + + t.Run("Normal flow with count query", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = &http.Request{ + Header: make(http.Header), + } + c.Request.URL, _ = url.Parse("?limit=1&page=1") + + srv := new(mock_services.Rulesheets) + findOpts := &services.FindOptions{ + Limit: 1, + Page: 1, + } + filter := make(map[string]interface{}) + srv.On("Find", mock.Anything, filter, findOpts).Return(nil, nil) + v1.NewRulesheets(srv).GetRulesheets()(c) + assert.Equal(t, http.StatusOK, w.Code) + }) + + t.Run("Normal flow without count query and array of rulesheets", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = &http.Request{ + Header: make(http.Header), + } + c.Request.URL, _ = url.Parse("?limit=1&page=1") + + srv := new(mock_services.Rulesheets) + findOpts := &services.FindOptions{ + Limit: 1, + Page: 1, + } + filter := make(map[string]interface{}) + reponseEntities := []*dtos.Rulesheet{ + { + ID: uint(1), + Name: "Test", + }, + { + ID: uint(2), + Name: "Test2", + }, + } + + srv.On("Find", mock.Anything, filter, findOpts).Return(reponseEntities, nil) + v1.NewRulesheets(srv).GetRulesheets()(c) + assert.Equal(t, http.StatusOK, w.Code) + }) + + t.Run("Error flow without count query", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = &http.Request{ + Header: make(http.Header), + } + c.Request.URL, _ = url.Parse("?limit=1&page=1") + + srv := new(mock_services.Rulesheets) + findOpts := &services.FindOptions{ + Limit: 1, + Page: 1, + } + filter := make(map[string]interface{}) + srv.On("Find", mock.Anything, filter, findOpts).Return(nil, errors.New("error")) + v1.NewRulesheets(srv).GetRulesheets()(c) + assert.Equal(t, http.StatusInternalServerError, w.Code) + }) + + t.Run("Normal flow with count query", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = &http.Request{ + Header: make(http.Header), + } + c.Request.URL, _ = url.Parse("?limit=1&page=1&count=true") + + srv := new(mock_services.Rulesheets) + findOpts := &services.FindOptions{} + filter := make(map[string]interface{}) + srv.On("Find", mock.Anything, filter, findOpts).Return(nil, nil) + srv.On("Count", mock.Anything, filter).Return(int64(0), nil) + v1.NewRulesheets(srv).GetRulesheets()(c) + assert.Equal(t, http.StatusOK, w.Code) + }) + + t.Run("Error flow with count query", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + c.Request = &http.Request{ + Header: make(http.Header), + } + c.Request.URL, _ = url.Parse("?limit=1&page=1&count=true") + + srv := new(mock_services.Rulesheets) + findOpts := &services.FindOptions{} + filter := make(map[string]interface{}) + srv.On("Find", mock.Anything, filter, findOpts).Return(nil, nil) + srv.On("Count", mock.Anything, filter).Return(int64(0), errors.New("error")) + v1.NewRulesheets(srv).GetRulesheets()(c) + assert.Equal(t, http.StatusInternalServerError, w.Code) + }) - return &rulesheets{ - service: services, - } } - -func TestListRulesheets(t *testing.T) { - - gin.SetMode(gin.TestMode) - // service, _ := services.Rulesheets.Find() - - r := gin.Default() - - rulesheet := SetupRulesheet(t) - - r.GET("/api/v1/rulesheets/", v1.Rulesheets.GetRulesheets()) - - req, err := http.NewRequest("GET", "/api/v1/rulesheets", nil) - if err != nil { - t.Fatalf("Couldn't create request: %v\n", err) - } - - w := httptest.NewRecorder() - r.ServeHTTP(w, req) - defer w.Result().Body.Close() - - var rulesheets []Rulesheet - json.Unmarshal([]byte(w.Body.String()), &rulesheets) - //Using testify - assert.Equal(t, http.StatusOK, w.Code) - assert.Equal(t, 10, len(rulesheets)) - -} - -// func TestFindRulesheet(t *testing.T) { - -// // iniciolizacao de um servidor Gin -// ts := httptest.NewServer(routes.SetupRoutesWithReturn()) -// defer ts.Close() - -// // criacao da folha de regras esperada -// expectedRulesheet := Rulesheet{ -// ID: "1", -// Name: "Rulesheet 1", -// Description: "Rulesheet 1 description", -// } - -// // chamada do servico de busca da folha de regras especifica -// resp, err := http.Get(fmt.Sprintf("%s/v1/rulesheets/1", ts.URL)) -// if err != nil { -// t.Fatalf("Couldn't make request: %v\n", err) -// } -// defer resp.Body.Close() -// //Usando o testify - -// //Testa se os erros sao nulos -// assert.Nil(t, err) - -// // Testa se o codigo de resposta e 200 -// assert.Equal(t, http.StatusOK, resp.StatusCode) - -// // Faz a leitura do corpo da resposta -// data, _ := ioutil.ReadAll(resp.Body) - -// // instancia um objeto do tipo Rulesheet, esta errado nao sei qual utlizar -// var actualRulesheet Rulesheet - -// // faz o parse do corpo da resposta para o objeto actualRulesheet -// json.Unmarshal(data, &actualRulesheet) - -// //Using testify -// assert.Equal(t, expectedRulesheet.Name, actualRulesheet.Name) -// } diff --git a/go.mod b/go.mod index 48bb95d..ffc13a5 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/bancodobrasil/healthcheck v0.0.2-rc1 github.com/gin-contrib/cors v1.3.1 github.com/gin-gonic/gin v1.7.7 - github.com/go-playground/assert/v2 v2.0.1 github.com/go-playground/validator/v10 v10.10.1 github.com/gosimple/slug v1.12.0 github.com/gsdenys/healthcheck v0.0.0-20220412001953-64e5089fa0bc From 5a23b407804ef45bad0e951777ec38cd1821ebb6 Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Thu, 15 Sep 2022 19:55:25 -0300 Subject: [PATCH 16/55] refactor: Middleware interface --- middlewares/middlewares.go | 6 ++- middlewares/verify_auth_token.go | 78 ++++++++++++++++++++------------ routes/api/v1/v1.go | 2 +- 3 files changed, 54 insertions(+), 32 deletions(-) diff --git a/middlewares/middlewares.go b/middlewares/middlewares.go index 38ef4b7..e204619 100644 --- a/middlewares/middlewares.go +++ b/middlewares/middlewares.go @@ -1,5 +1,9 @@ package middlewares +type Middleware interface { + Run() +} + func InitializeMiddlewares() { - InitializeSignatureKeyCache() + NewVerifyAuthTokenMiddleware() } diff --git a/middlewares/verify_auth_token.go b/middlewares/verify_auth_token.go index da73964..30fd0fe 100644 --- a/middlewares/verify_auth_token.go +++ b/middlewares/verify_auth_token.go @@ -14,18 +14,59 @@ import ( "github.com/lestrrat-go/jwx/v2/jws" ) -var cfg = config.GetConfig() -var ctx = context.Background() -var signatureKeyCache = jwk.NewCache(ctx) +type VerifyAuthTokenMiddleware struct { + OpenAMURL string + ctx context.Context + signatureKeyCache *jwk.Cache +} + +var verifyAuthTokenMiddleware *VerifyAuthTokenMiddleware -func InitializeSignatureKeyCache() { - signatureKeyCache.Register(cfg.OpenAMURL, jwk.WithMinRefreshInterval(15*time.Minute)) - _, err := signatureKeyCache.Refresh(ctx, cfg.OpenAMURL) +func NewVerifyAuthTokenMiddleware() { + cfg := config.GetConfig() + ctx := context.Background() + + verifyAuthTokenMiddleware = &VerifyAuthTokenMiddleware{ + OpenAMURL: cfg.OpenAMURL, + ctx: ctx, + signatureKeyCache: jwk.NewCache(ctx, jwk.WithRefreshWindow(5*time.Minute)), + } + + verifyAuthTokenMiddleware.signatureKeyCache.Register(cfg.OpenAMURL, jwk.WithMinRefreshInterval(15*time.Minute)) + _, err := verifyAuthTokenMiddleware.signatureKeyCache.Refresh(ctx, cfg.OpenAMURL) if err != nil { log.Panicf("Failed to refresh OpenAM JWKS: %s\n", err) } } +func RunVerifyAuthTokenMiddleware() gin.HandlerFunc { + return verifyAuthTokenMiddleware.Run() +} + +func (m *VerifyAuthTokenMiddleware) Run() gin.HandlerFunc { + return func(c *gin.Context) { + token := extractTokenFromHeader(c) + + msg, err := jws.Parse([]byte(token)) + errorMsg := "Invalid Auth JWT" + if err != nil { + respondWithError(c, 401, errorMsg) + } + + key := getSignatureKey(c) + verified, err := jws.Verify([]byte(token), jws.WithKey(jwa.RS256, key)) + if err != nil { + respondWithError(c, 401, errorMsg) + } + + if !bytes.Equal(verified, msg.Payload()) { + respondWithError(c, 401, errorMsg) + } + + c.Next() + } +} + func respondWithError(c *gin.Context, code int, message interface{}) { c.AbortWithStatusJSON(code, gin.H{"error": message}) } @@ -42,7 +83,7 @@ func extractTokenFromHeader(c *gin.Context) string { return strings.TrimSpace(splitHeader[1]) } func getSignatureKey(c *gin.Context) jwk.Key { - keyset, err := signatureKeyCache.Get(ctx, cfg.OpenAMURL) + keyset, err := verifyAuthTokenMiddleware.signatureKeyCache.Get(verifyAuthTokenMiddleware.ctx, verifyAuthTokenMiddleware.OpenAMURL) errorMsg := "Failed to fetch OpenAM JWKS" if err != nil { log.Printf("%s: %s\n", errorMsg, err) @@ -55,26 +96,3 @@ func getSignatureKey(c *gin.Context) jwk.Key { } return key } -func VerifyAuthTokenMiddleware() gin.HandlerFunc { - return func(c *gin.Context) { - token := extractTokenFromHeader(c) - - msg, err := jws.Parse([]byte(token)) - errorMsg := "Invalid Auth JWT" - if err != nil { - respondWithError(c, 401, errorMsg) - } - - key := getSignatureKey(c) - verified, err := jws.Verify([]byte(token), jws.WithKey(jwa.RS256, key)) - if err != nil { - respondWithError(c, 401, errorMsg) - } - - if !bytes.Equal(verified, msg.Payload()) { - respondWithError(c, 401, errorMsg) - } - - c.Next() - } -} diff --git a/routes/api/v1/v1.go b/routes/api/v1/v1.go index ed5af4b..76f1055 100644 --- a/routes/api/v1/v1.go +++ b/routes/api/v1/v1.go @@ -7,7 +7,7 @@ import ( // Router define routes the API V1 func Router(router *gin.RouterGroup) { - router.Use(middlewares.VerifyAuthTokenMiddleware()) + router.Use(middlewares.RunVerifyAuthTokenMiddleware()) rulesheetsRouter(router.Group("/rulesheets")) //rpcRouter(router.Group("/")) } From 6487a086dc0de3c771fe7939c41fa6715ae5428c Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Thu, 15 Sep 2022 22:12:41 -0300 Subject: [PATCH 17/55] refactor: renaming functions better --- docker-compose.yml | 2 +- middlewares/middlewares.go | 7 +++++++ middlewares/verify_auth_token.go | 36 +++++++++++++++++--------------- routes/api/v1/v1.go | 2 +- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9151989..fd8b25a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: image: mysql:8-debian restart: always ports: - - 3306:3306 + - 3307:3306 volumes: - ./data/mysql:/var/lib/mysql environment: diff --git a/middlewares/middlewares.go b/middlewares/middlewares.go index e204619..473425f 100644 --- a/middlewares/middlewares.go +++ b/middlewares/middlewares.go @@ -1,5 +1,7 @@ package middlewares +import "github.com/gin-gonic/gin" + type Middleware interface { Run() } @@ -7,3 +9,8 @@ type Middleware interface { func InitializeMiddlewares() { NewVerifyAuthTokenMiddleware() } + +// Helper function to abort the request with an error status code and message +func respondWithError(c *gin.Context, code int, message interface{}) { + c.AbortWithStatusJSON(code, gin.H{"error": message}) +} diff --git a/middlewares/verify_auth_token.go b/middlewares/verify_auth_token.go index 30fd0fe..e051cdd 100644 --- a/middlewares/verify_auth_token.go +++ b/middlewares/verify_auth_token.go @@ -15,37 +15,43 @@ import ( ) type VerifyAuthTokenMiddleware struct { - OpenAMURL string + url string ctx context.Context signatureKeyCache *jwk.Cache } var verifyAuthTokenMiddleware *VerifyAuthTokenMiddleware +// Middleware function to verify the JWT token +func VerifyAuthToken() gin.HandlerFunc { + return verifyAuthTokenMiddleware.Run() +} + func NewVerifyAuthTokenMiddleware() { cfg := config.GetConfig() ctx := context.Background() verifyAuthTokenMiddleware = &VerifyAuthTokenMiddleware{ - OpenAMURL: cfg.OpenAMURL, + url: cfg.OpenAMURL, ctx: ctx, signatureKeyCache: jwk.NewCache(ctx, jwk.WithRefreshWindow(5*time.Minute)), } - verifyAuthTokenMiddleware.signatureKeyCache.Register(cfg.OpenAMURL, jwk.WithMinRefreshInterval(15*time.Minute)) - _, err := verifyAuthTokenMiddleware.signatureKeyCache.Refresh(ctx, cfg.OpenAMURL) + verifyAuthTokenMiddleware.setup() +} + +func (m *VerifyAuthTokenMiddleware) setup() { + log.Println("Initializing VerifyAuthTokenMiddleware") + m.signatureKeyCache.Register(m.url, jwk.WithMinRefreshInterval(15*time.Minute)) + _, err := verifyAuthTokenMiddleware.signatureKeyCache.Refresh(m.ctx, m.url) if err != nil { log.Panicf("Failed to refresh OpenAM JWKS: %s\n", err) } } -func RunVerifyAuthTokenMiddleware() gin.HandlerFunc { - return verifyAuthTokenMiddleware.Run() -} - func (m *VerifyAuthTokenMiddleware) Run() gin.HandlerFunc { return func(c *gin.Context) { - token := extractTokenFromHeader(c) + token := m.extractTokenFromHeader(c) msg, err := jws.Parse([]byte(token)) errorMsg := "Invalid Auth JWT" @@ -53,7 +59,7 @@ func (m *VerifyAuthTokenMiddleware) Run() gin.HandlerFunc { respondWithError(c, 401, errorMsg) } - key := getSignatureKey(c) + key := m.getSignatureKey(c) verified, err := jws.Verify([]byte(token), jws.WithKey(jwa.RS256, key)) if err != nil { respondWithError(c, 401, errorMsg) @@ -67,11 +73,7 @@ func (m *VerifyAuthTokenMiddleware) Run() gin.HandlerFunc { } } -func respondWithError(c *gin.Context, code int, message interface{}) { - c.AbortWithStatusJSON(code, gin.H{"error": message}) -} - -func extractTokenFromHeader(c *gin.Context) string { +func (m *VerifyAuthTokenMiddleware) extractTokenFromHeader(c *gin.Context) string { authorizationHeader := c.Request.Header.Get("Authorization") if authorizationHeader == "" { respondWithError(c, 401, "Missing Authorization Header") @@ -82,8 +84,8 @@ func extractTokenFromHeader(c *gin.Context) string { } return strings.TrimSpace(splitHeader[1]) } -func getSignatureKey(c *gin.Context) jwk.Key { - keyset, err := verifyAuthTokenMiddleware.signatureKeyCache.Get(verifyAuthTokenMiddleware.ctx, verifyAuthTokenMiddleware.OpenAMURL) +func (m *VerifyAuthTokenMiddleware) getSignatureKey(c *gin.Context) jwk.Key { + keyset, err := m.signatureKeyCache.Get(m.ctx, m.url) errorMsg := "Failed to fetch OpenAM JWKS" if err != nil { log.Printf("%s: %s\n", errorMsg, err) diff --git a/routes/api/v1/v1.go b/routes/api/v1/v1.go index 76f1055..029ff65 100644 --- a/routes/api/v1/v1.go +++ b/routes/api/v1/v1.go @@ -7,7 +7,7 @@ import ( // Router define routes the API V1 func Router(router *gin.RouterGroup) { - router.Use(middlewares.RunVerifyAuthTokenMiddleware()) + router.Use(middlewares.VerifyAuthToken()) rulesheetsRouter(router.Group("/rulesheets")) //rpcRouter(router.Group("/")) } From 48b3b3066be810ebdd00da8ade771ad917726368 Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Thu, 15 Sep 2022 22:37:55 -0300 Subject: [PATCH 18/55] feat: shorter cache refresh interval --- middlewares/verify_auth_token.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/middlewares/verify_auth_token.go b/middlewares/verify_auth_token.go index e051cdd..4d84451 100644 --- a/middlewares/verify_auth_token.go +++ b/middlewares/verify_auth_token.go @@ -34,7 +34,7 @@ func NewVerifyAuthTokenMiddleware() { verifyAuthTokenMiddleware = &VerifyAuthTokenMiddleware{ url: cfg.OpenAMURL, ctx: ctx, - signatureKeyCache: jwk.NewCache(ctx, jwk.WithRefreshWindow(5*time.Minute)), + signatureKeyCache: jwk.NewCache(ctx, jwk.WithRefreshWindow(1*time.Minute)), } verifyAuthTokenMiddleware.setup() @@ -42,8 +42,8 @@ func NewVerifyAuthTokenMiddleware() { func (m *VerifyAuthTokenMiddleware) setup() { log.Println("Initializing VerifyAuthTokenMiddleware") - m.signatureKeyCache.Register(m.url, jwk.WithMinRefreshInterval(15*time.Minute)) - _, err := verifyAuthTokenMiddleware.signatureKeyCache.Refresh(m.ctx, m.url) + m.signatureKeyCache.Register(m.url, jwk.WithMinRefreshInterval(5*time.Minute)) + _, err := m.signatureKeyCache.Refresh(m.ctx, m.url) if err != nil { log.Panicf("Failed to refresh OpenAM JWKS: %s\n", err) } From 26330045a89f9ddd26be0aa096b7b8c1e89ff7a5 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Fri, 16 Sep 2022 21:14:22 -0300 Subject: [PATCH 19/55] feat: implement test WIP --- controllers/v1/rulesheets.go | 4 +- controllers/v1/rulesheets_test.go | 534 +++++++++++++++++++++++++++++- 2 files changed, 531 insertions(+), 7 deletions(-) diff --git a/controllers/v1/rulesheets.go b/controllers/v1/rulesheets.go index 5acc37b..bdbeb4c 100644 --- a/controllers/v1/rulesheets.go +++ b/controllers/v1/rulesheets.go @@ -55,7 +55,7 @@ func (rc *rulesheets) CreateRulesheet() gin.HandlerFunc { return func(c *gin.Context) { // Pass the context of gin Request - ctx, cancel := context.WithTimeout(c.Request.Context(), 10*time.Second) + ctx, cancel := context.WithTimeout(c.Request.Context(), 1000*time.Second) var payload payloads.Rulesheet defer cancel() @@ -120,7 +120,7 @@ func (rc *rulesheets) GetRulesheets() gin.HandlerFunc { return func(c *gin.Context) { - ctx, cancel := context.WithTimeout(c.Request.Context(), 100000*time.Second) + ctx, cancel := context.WithTimeout(c.Request.Context(), 10*time.Second) defer cancel() query := c.Request.URL.Query() diff --git a/controllers/v1/rulesheets_test.go b/controllers/v1/rulesheets_test.go index 39604d1..e0982d1 100644 --- a/controllers/v1/rulesheets_test.go +++ b/controllers/v1/rulesheets_test.go @@ -1,7 +1,10 @@ package v1_test import ( + "bytes" + "encoding/json" "errors" + "io/ioutil" "net/http" "net/http/httptest" "net/url" @@ -10,6 +13,7 @@ import ( v1 "github.com/bancodobrasil/featws-api/controllers/v1" "github.com/bancodobrasil/featws-api/dtos" mock_services "github.com/bancodobrasil/featws-api/mocks/services" + payloads "github.com/bancodobrasil/featws-api/payloads/v1" "github.com/bancodobrasil/featws-api/services" "github.com/gin-gonic/gin" "github.com/stretchr/testify/assert" @@ -27,11 +31,6 @@ func TestRulesheet_GetRulesheetByID(t *testing.T) { Header: make(http.Header), } - ctx, _ := gin.CreateTestContext(w) - ctx.Request = &http.Request{ - Header: make(http.Header), - } - c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} srv := new(mock_services.Rulesheets) srv.On("Get", mock.Anything, "1").Return(nil, nil) @@ -239,3 +238,528 @@ func TestRulesheet_GetAllRulesheets(t *testing.T) { }) } + +func TestRulesheet_CreateRulesheet(t *testing.T) { + t.Run("Normal flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + payload := &payloads.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + srv := new(mock_services.Rulesheets) + + createdRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Create", mock.Anything, createdRulesheet).Return(nil) + v1.NewRulesheets(srv).CreateRulesheet()(c) + assert.Equal(t, http.StatusCreated, w.Code) + }) + + t.Run("Error on validate request body", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + srv := new(mock_services.Rulesheets) + + createdRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Create", mock.Anything, createdRulesheet).Return(nil) + v1.NewRulesheets(srv).CreateRulesheet()(c) + assert.Equal(t, http.StatusBadRequest, w.Code) + }) + + t.Run("Error on validate required fields", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + payload := &payloads.Rulesheet{} + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + srv := new(mock_services.Rulesheets) + + createdRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Create", mock.Anything, createdRulesheet).Return(nil) + v1.NewRulesheets(srv).CreateRulesheet()(c) + assert.Equal(t, http.StatusBadRequest, w.Code) + }) + + // t.Run("Error on define rulesheet entity", func(t *testing.T) { + // gin.SetMode(gin.TestMode) + + // w := httptest.NewRecorder() + // c, _ := gin.CreateTestContext(w) + + // c.Request = &http.Request{ + // Header: make(http.Header), + // } + + // payload := &payloads.Rulesheet{ + // ID: uint(1), + // Name: "test", + // } + + // bytedPayload, _ := json.Marshal(payload) + + // c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + // srv := new(mock_services.Rulesheets) + + // createdRulesheet := &dtos.Rulesheet{ + // ID: uint(1), + // Name: "Test", + // } + + // srv.On("Create", mock.Anything, createdRulesheet).Return(nil) + // v1.NewRulesheets(srv).CreateRulesheet()(c) + // assert.Equal(t, http.StatusBadRequest, w.Code) + // }) + + t.Run("Error on define rulesheet entity", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + payload := &payloads.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + srv := new(mock_services.Rulesheets) + + createdRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Create", mock.Anything, createdRulesheet).Return(errors.New("error")) + v1.NewRulesheets(srv).CreateRulesheet()(c) + assert.Equal(t, http.StatusInternalServerError, w.Code) + }) +} + +func TestRulesheet_UpdateRulesheet(t *testing.T) { + t.Run("Normal flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + payload := &payloads.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + srv := new(mock_services.Rulesheets) + + oldRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + newRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Get", mock.Anything, "1").Return(oldRulesheet, nil) + + srv.On("Update", mock.Anything, *oldRulesheet).Return(newRulesheet, nil) + v1.NewRulesheets(srv).UpdateRulesheet()(c) + assert.Equal(t, http.StatusOK, w.Code) + }) + + t.Run("Error on check if the rulesheet exists flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + payload := &payloads.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + srv := new(mock_services.Rulesheets) + + oldRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + newRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Get", mock.Anything, "1").Return(oldRulesheet, nil) + + srv.On("Update", mock.Anything, *oldRulesheet).Return(newRulesheet, nil) + v1.NewRulesheets(srv).UpdateRulesheet()(c) + assert.Equal(t, http.StatusBadRequest, w.Code) + }) + + t.Run("Error on check if the rulesheet exists flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + payload := &payloads.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + srv := new(mock_services.Rulesheets) + + oldRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + newRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Get", mock.Anything, "1").Return(oldRulesheet, errors.New("error")) + + srv.On("Update", mock.Anything, *oldRulesheet).Return(newRulesheet, nil) + v1.NewRulesheets(srv).UpdateRulesheet()(c) + assert.Equal(t, http.StatusNotFound, w.Code) + }) + + t.Run("Error on binding the payload flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + srv := new(mock_services.Rulesheets) + + oldRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + newRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Get", mock.Anything, "1").Return(oldRulesheet, nil) + + srv.On("Update", mock.Anything, *oldRulesheet).Return(newRulesheet, nil) + v1.NewRulesheets(srv).UpdateRulesheet()(c) + assert.Equal(t, http.StatusBadRequest, w.Code) + }) + + t.Run("Error on validate required fields flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + payload := &payloads.Rulesheet{} + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + srv := new(mock_services.Rulesheets) + + oldRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + newRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Get", mock.Anything, "1").Return(oldRulesheet, nil) + + srv.On("Update", mock.Anything, *oldRulesheet).Return(newRulesheet, nil) + v1.NewRulesheets(srv).UpdateRulesheet()(c) + assert.Equal(t, http.StatusBadRequest, w.Code) + }) + + t.Run("Error on slug already defined flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + payload := &payloads.Rulesheet{ + ID: uint(1), + Name: "Test", + Slug: "test-slug", + } + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + srv := new(mock_services.Rulesheets) + + oldRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + newRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Get", mock.Anything, "1").Return(oldRulesheet, nil) + + srv.On("Update", mock.Anything, *oldRulesheet).Return(newRulesheet, nil) + v1.NewRulesheets(srv).UpdateRulesheet()(c) + assert.Equal(t, http.StatusBadRequest, w.Code) + }) + + t.Run("Error on update entity flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + payload := &payloads.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + srv := new(mock_services.Rulesheets) + + oldRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + newRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Get", mock.Anything, "1").Return(oldRulesheet, nil) + + srv.On("Update", mock.Anything, *oldRulesheet).Return(newRulesheet, errors.New("error")) + v1.NewRulesheets(srv).UpdateRulesheet()(c) + assert.Equal(t, http.StatusInternalServerError, w.Code) + }) + + t.Run("Error status not found flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + payload := &payloads.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + srv := new(mock_services.Rulesheets) + + oldRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Get", mock.Anything, "1").Return(oldRulesheet, nil) + + srv.On("Update", mock.Anything, *oldRulesheet).Return(nil, nil) + v1.NewRulesheets(srv).UpdateRulesheet()(c) + assert.Equal(t, http.StatusNotFound, w.Code) + }) +} + +func TestRulesheet_DeleteRulesheet(t *testing.T) { + t.Run("Normal flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + srv := new(mock_services.Rulesheets) + + srv.On("Delete", mock.Anything, "1").Return(true, nil) + v1.NewRulesheets(srv).DeleteRulesheet()(c) + assert.Equal(t, http.StatusNoContent, w.Code) + }) + + t.Run("Error on delete rulesheet flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + srv := new(mock_services.Rulesheets) + + srv.On("Delete", mock.Anything, "1").Return(false, nil) + v1.NewRulesheets(srv).DeleteRulesheet()(c) + assert.Equal(t, http.StatusNotFound, w.Code) + }) + + t.Run("Error on id not passed flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + srv := new(mock_services.Rulesheets) + + srv.On("Delete", mock.Anything, "1").Return(false, nil) + v1.NewRulesheets(srv).DeleteRulesheet()(c) + assert.Equal(t, http.StatusBadRequest, w.Code) + }) + + t.Run("Error on delete rulesheet", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + srv := new(mock_services.Rulesheets) + + srv.On("Delete", mock.Anything, "1").Return(false, errors.New("error")) + v1.NewRulesheets(srv).DeleteRulesheet()(c) + assert.Equal(t, http.StatusInternalServerError, w.Code) + }) +} From 9c1f4d19d1f54690938aa9cd75ae72806c448079 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Mon, 19 Sep 2022 11:54:16 -0300 Subject: [PATCH 20/55] feat: implement tests --- Makefile | 2 +- controllers/home.go | 7 --- controllers/home_test.go | 49 +++++++++-------- controllers/v1/rulesheets_test.go | 91 +++++++++++++++++++++++-------- dtos/rulesheets.go | 1 + 5 files changed, 96 insertions(+), 54 deletions(-) diff --git a/Makefile b/Makefile index e479e07..da5a3fd 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ run:build ./api test: - @make run-on-our-code-directories ARGS="go test -v" + @make run-on-our-code-directories ARGS="go test -v -coverprofile=coverage.out" run-on-our-code-directories: @echo "${ARGS} " diff --git a/controllers/home.go b/controllers/home.go index 578658c..411c88d 100644 --- a/controllers/home.go +++ b/controllers/home.go @@ -6,13 +6,6 @@ import ( "github.com/gin-gonic/gin" ) -// func HomeHandler() gin.HandlerFunc { -// return func(c *gin.Context) { -// c.String(http.StatusOK, "FeatWS Resolver Works!!!") -// } - -// } - // HomeHandler ... func HomeHandler(c *gin.Context) { c.JSON(http.StatusOK, gin.H{ diff --git a/controllers/home_test.go b/controllers/home_test.go index 7a22e9d..19bd1d2 100644 --- a/controllers/home_test.go +++ b/controllers/home_test.go @@ -1,7 +1,6 @@ package controllers_test import ( - "io/ioutil" "net/http" "net/http/httptest" "testing" @@ -11,35 +10,37 @@ import ( "github.com/stretchr/testify/assert" ) -func TestHomeHandler(t *testing.T) { - gin.SetMode(gin.TestMode) +// func TestHomeHandler(t *testing.T) { +// gin.SetMode(gin.TestMode) - r := gin.Default() - r.GET("/", controllers.HomeHandler) +// r := gin.Default() +// r.GET("/", controllers.HomeHandler) - req, err := http.NewRequest("GET", "/", nil) - if err != nil { - t.Fatalf("Couldn't create request: %v\n", err) - } +// req, err := http.NewRequest("GET", "/", nil) +// if err != nil { +// t.Fatalf("Couldn't create request: %v\n", err) +// } - w := httptest.NewRecorder() - r.ServeHTTP(w, req) - defer w.Result().Body.Close() +// w := httptest.NewRecorder() +// r.ServeHTTP(w, req) +// defer w.Result().Body.Close() - mockUserResp := `{"message":"FeatWS API Works!!!"}` - //Using testify +// mockUserResp := `{"message":"FeatWS API Works!!!"}` +// //Using testify - assert.Nil(t, err) - assert.Equal(t, http.StatusOK, w.Code) - responseData, _ := ioutil.ReadAll(w.Body) - assert.Equal(t, mockUserResp, string(responseData)) - -} +// assert.Nil(t, err) +// assert.Equal(t, http.StatusOK, w.Code) +// responseData, _ := ioutil.ReadAll(w.Body) +// assert.Equal(t, mockUserResp, string(responseData)) -// r.GET("/recipes", ListRecipesHandler) +// } +func TestUnitHomeHandler(t *testing.T) { + gin.SetMode(gin.TestMode) -//    req, _ := http.NewRequest("GET", "/recipes", nil) + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) -//    w := httptest.NewRecorder() + controllers.HomeHandler(c) + assert.Equal(t, http.StatusOK, w.Code) -//    r.ServeHTTP(w, req) +} diff --git a/controllers/v1/rulesheets_test.go b/controllers/v1/rulesheets_test.go index e0982d1..e1b4efd 100644 --- a/controllers/v1/rulesheets_test.go +++ b/controllers/v1/rulesheets_test.go @@ -321,36 +321,39 @@ func TestRulesheet_CreateRulesheet(t *testing.T) { assert.Equal(t, http.StatusBadRequest, w.Code) }) - // t.Run("Error on define rulesheet entity", func(t *testing.T) { - // gin.SetMode(gin.TestMode) + t.Run("Error on define rulesheet entity", func(t *testing.T) { + gin.SetMode(gin.TestMode) - // w := httptest.NewRecorder() - // c, _ := gin.CreateTestContext(w) + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) - // c.Request = &http.Request{ - // Header: make(http.Header), - // } + c.Request = &http.Request{ + Header: make(http.Header), + } - // payload := &payloads.Rulesheet{ - // ID: uint(1), - // Name: "test", - // } + rules := make(map[string]interface{}) + rules["test"] = 12 + payload := &payloads.Rulesheet{ + ID: uint(1), + Name: "test", + Rules: &rules, + } - // bytedPayload, _ := json.Marshal(payload) + bytedPayload, _ := json.Marshal(payload) - // c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) - // srv := new(mock_services.Rulesheets) + srv := new(mock_services.Rulesheets) - // createdRulesheet := &dtos.Rulesheet{ - // ID: uint(1), - // Name: "Test", - // } + createdRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } - // srv.On("Create", mock.Anything, createdRulesheet).Return(nil) - // v1.NewRulesheets(srv).CreateRulesheet()(c) - // assert.Equal(t, http.StatusBadRequest, w.Code) - // }) + srv.On("Create", mock.Anything, createdRulesheet).Return(nil) + v1.NewRulesheets(srv).CreateRulesheet()(c) + assert.Equal(t, http.StatusInternalServerError, w.Code) + }) t.Run("Error on define rulesheet entity", func(t *testing.T) { gin.SetMode(gin.TestMode) @@ -686,6 +689,50 @@ func TestRulesheet_UpdateRulesheet(t *testing.T) { v1.NewRulesheets(srv).UpdateRulesheet()(c) assert.Equal(t, http.StatusNotFound, w.Code) }) + + t.Run("Error on define entity Flow", func(t *testing.T) { + gin.SetMode(gin.TestMode) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + + c.Request = &http.Request{ + Header: make(http.Header), + } + + c.Params = gin.Params{gin.Param{Key: "id", Value: "1"}} + + rules := make(map[string]interface{}) + rules["rules"] = 0 + + payload := &payloads.Rulesheet{ + ID: uint(1), + Name: "Test", + Rules: &rules, + } + + bytedPayload, _ := json.Marshal(payload) + + c.Request.Body = ioutil.NopCloser(bytes.NewReader(bytedPayload)) + + srv := new(mock_services.Rulesheets) + + oldRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + newRulesheet := &dtos.Rulesheet{ + ID: uint(1), + Name: "Test", + } + + srv.On("Get", mock.Anything, "1").Return(oldRulesheet, nil) + + srv.On("Update", mock.Anything, *oldRulesheet).Return(newRulesheet, nil) + v1.NewRulesheets(srv).UpdateRulesheet()(c) + assert.Equal(t, http.StatusOK, w.Code) + }) } func TestRulesheet_DeleteRulesheet(t *testing.T) { diff --git a/dtos/rulesheets.go b/dtos/rulesheets.go index 0b6c4fd..2d43b30 100644 --- a/dtos/rulesheets.go +++ b/dtos/rulesheets.go @@ -62,6 +62,7 @@ func NewRulesheetV1(payload v1.Rulesheet) (dto Rulesheet, err error) { dto.HasStringRule = !isRule + // FIXME - Remover restricao de exclusividade entre regras string e complexas if dto.HasStringRule { return } From 6e6d1d47bf5fa31cfc6808964c07f642395a5ed7 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Mon, 19 Sep 2022 12:11:44 -0300 Subject: [PATCH 21/55] feat: implement test --- Makefile | 4 ++ controllers/v1/rulesheets_test.go | 2 +- services/gitlab_test.go | 58 ----------------------------- services/rulesheets_test.go | 61 ------------------------------- 4 files changed, 5 insertions(+), 120 deletions(-) diff --git a/Makefile b/Makefile index da5a3fd..b12b766 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,10 @@ up:up-services run:build ./api +coverage: + go test ./... -coverprofile=coverage.out + go tool cover -html=coverage.out + test: @make run-on-our-code-directories ARGS="go test -v -coverprofile=coverage.out" diff --git a/controllers/v1/rulesheets_test.go b/controllers/v1/rulesheets_test.go index e1b4efd..885ad94 100644 --- a/controllers/v1/rulesheets_test.go +++ b/controllers/v1/rulesheets_test.go @@ -731,7 +731,7 @@ func TestRulesheet_UpdateRulesheet(t *testing.T) { srv.On("Update", mock.Anything, *oldRulesheet).Return(newRulesheet, nil) v1.NewRulesheets(srv).UpdateRulesheet()(c) - assert.Equal(t, http.StatusOK, w.Code) + assert.Equal(t, http.StatusInternalServerError, w.Code) }) } diff --git a/services/gitlab_test.go b/services/gitlab_test.go index 3045466..ed21e8a 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -327,8 +327,6 @@ func TestSaveTestFilesCreationWithRuleInterface(t *testing.T) { mappedRules := map[string]interface{}{ "tags": rules, } - // data, _ := json.Marshal(mappedRules) - // json.Unmarshal(data, &mappedRules) dto.Rules = &mappedRules @@ -389,9 +387,6 @@ func TestSaveTestFilesCreationWithRuleInterfaceWithDefault(t *testing.T) { mappedRules := map[string]interface{}{ "tags": rules, } - // data, _ := json.Marshal(mappedRules) - // json.Unmarshal(data, &mappedRules) - dto.Rules = &mappedRules namespace := "test" @@ -517,8 +512,6 @@ func TestSaveTestFilesCreationWithDefaultRule(t *testing.T) { mappedRules := map[string]interface{}{ "tags": rules, } - // data, _ := json.Marshal(mappedRules) - // json.Unmarshal(data, &mappedRules) dto.Rules = &mappedRules @@ -773,7 +766,6 @@ func TestSaveErrorOnCreateProject(t *testing.T) { } if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { - // _, _ := io.ReadAll(r.Body) w.Write(nil) return } @@ -880,53 +872,3 @@ func TestSaveErrorOnParseVersion(t *testing.T) { t.Error("unexpected error") } } - -// TODO: test save error on fetch version, -// func TestSaveErrorOnFetchVersion(t *testing.T) { -// dto := SetupRulesheet() - -// namespace := "test" - -// s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { -// if r.URL.Path == "/api/v4/namespaces/"+namespace { -// w.Write([]byte(`{"id":1,"name":"teste"}`)) -// return -// } -// if r.Method == "POST" && r.URL.Path == "/api/v4/projects" { -// data, _ := io.ReadAll(r.Body) -// w.Write(data) -// return -// } - -// if r.Method == "GET" && r.URL.Path == "/api/v4/projects/0/repository/files/VERSION" { - -// } - -// if r.Method == "POST" && r.URL.Path == "/api/v4/projects/0/repository/commits" { -// data, _ := io.ReadAll(r.Body) -// c := make(map[string]interface{}) -// json.Unmarshal(data, &c) -// w.Write(data) -// return -// } -// w.WriteHeader(http.StatusNotFound) -// })) -// defer s.Close() - -// cfg := config.Config{ -// GitlabURL: s.URL, -// GitlabNamespace: namespace, -// GitlabToken: "test", -// GitlabPrefix: "prefix-", -// GitlabCIScript: "test ci-script", -// } - -// ngl := services.NewGitlab(cfg) -// ngl.Connect() -// err := ngl.Save(dto, "test") - -// if err != nil { -// t.Error("expected error on resolve version") -// } - -// } diff --git a/services/rulesheets_test.go b/services/rulesheets_test.go index 5d1c248..00cf9eb 100644 --- a/services/rulesheets_test.go +++ b/services/rulesheets_test.go @@ -31,7 +31,6 @@ func TestGetWithErrorOnFill(t *testing.T) { gitlabService := new(mocks_services.Gitlab) gitlabService.On("Fill", dto).Return(errors.New("error on fill")) - // Provavel referencia ciclica pois esta testando o servico chanmando o proprio servico ao inves do mock services := services.NewRulesheets(repository, gitlabService) _, err = services.Get(ctx, "1") @@ -127,26 +126,6 @@ func TestCreateSuccess(t *testing.T) { } -// func TestCreateWithErrorOnModelCreation(t *testing.T) { -// ctx := context.Background() -// dto := &dtos.Rulesheet{ -// ID: 1, -// } - -// entity, err1 := models.NewRulesheetV1(*dto) -// err1 = errors.New("error on model creation") -// repository := new(mocks_repository.Rulesheets) -// repository.On("Create", ctx, &entity).Return(nil) -// gitlabService := new(mocks_services.Gitlab) -// gitlabService.On("Save", dto, "[FEATWS BOT] Create Repo").Return(nil) -// gitlabService.On("Fill", dto).Return(nil) -// service := NewRulesheets(repository, gitlabService) -// _ = service.Create(ctx, dto) -// if err1.Error() != "error on model creation" { -// t.Error("expected error on model creation") -// } -// } - func TestCreateWithError(t *testing.T) { ctx := context.Background() dto := &dtos.Rulesheet{ @@ -213,7 +192,6 @@ func TestUpdateWithErrorOnSave(t *testing.T) { } } -//tipos de retorno sao diferentes do mock e da chamada real func TestFindSuccess(t *testing.T) { ctx := context.Background() dto := &dtos.Rulesheet{ @@ -257,24 +235,6 @@ func TestFindWithError(t *testing.T) { } -// func TestFindSucess(t *testing.T) { -// ctx := context.Background() -// dto := &dtos.Rulesheet{ -// ID: 1, -// } -// entity, err := models.NewRulesheetV1(*dto) -// if err != nil { -// t.Error("unexpected error on model creation") -// } -// repositoryMocado := new(mocks_repository.Rulesheets) -// repositoryMocado.On("Find", ctx, dto.ID, &repository.FindOptions{}).Return(entity, nil) -// service := services.NewRulesheets(repositoryMocado, nil) -// _, err = service.Find(ctx, dto.ID, &FindOptions{0, 0}) -// if err != nil { -// t.Error("unexpected error on find") -// } -// } - func TestCountSuccess(t *testing.T) { ctx := context.Background() dto := &dtos.Rulesheet{ @@ -353,27 +313,6 @@ func TestUpdateWithError(t *testing.T) { } } -// func TestUpdateWithErrorOnGenerateModel(t *testing.T) { -// ctx := context.Background() -// dto := &dtos.Rulesheet{ - -// } -// entity, err := models.NewRulesheetV1() -// if err != nil { -// t.Error("unexpected error on model creation") -// } -// repository := new(mocks_repository.Rulesheets) -// repository.On("Update", ctx, entity).Return(nil, errors.New("error on update")) -// gitlabService := new(mocks_services.Gitlab) -// gitlabService.On("Save", dto, "[FEATWS BOT] Update Repo").Return(nil) -// gitlabService.On("Fill", dto).Return(nil) -// service := services.NewRulesheets(repository, gitlabService) -// _, err = service.Update(ctx, *dto) -// if err == nil || err.Error() != "error on update" { -// t.Error("expected error on update") -// } -// } - func TestDeleteSuccess(t *testing.T) { ctx := context.Background() dto := &dtos.Rulesheet{ From 1a108e9c9e4972c916511e03f0308adf997d0ab5 Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Mon, 3 Oct 2022 16:30:39 -0300 Subject: [PATCH 22/55] fix: bearer --- middlewares/verify_auth_token.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middlewares/verify_auth_token.go b/middlewares/verify_auth_token.go index 4d84451..cc478d9 100644 --- a/middlewares/verify_auth_token.go +++ b/middlewares/verify_auth_token.go @@ -78,7 +78,7 @@ func (m *VerifyAuthTokenMiddleware) extractTokenFromHeader(c *gin.Context) strin if authorizationHeader == "" { respondWithError(c, 401, "Missing Authorization Header") } - splitHeader := strings.Split(authorizationHeader, "Auth JWT") + splitHeader := strings.Split(authorizationHeader, "Bearer") if len(splitHeader) != 2 { respondWithError(c, 401, "Invalid Authorization Header") } From c6de04ee9d55ce6f50f5240f4214787a8ef823d5 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Wed, 5 Oct 2022 16:44:59 -0300 Subject: [PATCH 23/55] fix: remove rule struct --- dtos/rulesheets.go | 13 +++------ services/gitlab.go | 58 +++++++++++++++++++++++++++++++---------- services/gitlab_test.go | 47 ++++++++++++++++++--------------- 3 files changed, 73 insertions(+), 45 deletions(-) diff --git a/dtos/rulesheets.go b/dtos/rulesheets.go index 2d43b30..8b82b2e 100644 --- a/dtos/rulesheets.go +++ b/dtos/rulesheets.go @@ -9,16 +9,9 @@ import ( // Rule ... type Rule struct { - Condition string `json:"condition,omitempty"` - Value RuleValue `json:"value,omitempty"` - Type string `json:"type,omitempty"` -} - -// RuleValue ... -type RuleValue struct { - NomeAplicativo string `json:"nomeAplicativo,omitempty"` - TextoURLPadrao string `json:"textoUrlPadrao,omitempty"` - TextoURLDesvio string `json:"textoUrlDesvio,omitempty"` + Condition string `json:"condition,omitempty"` + Value interface{} `json:"value,omitempty"` + Type string `json:"type,omitempty"` } // Rulesheet ... diff --git a/services/gitlab.go b/services/gitlab.go index 01b6eeb..fa02b47 100644 --- a/services/gitlab.go +++ b/services/gitlab.go @@ -198,21 +198,17 @@ func (gs *gitlabService) Save(rulesheet *dtos.Rulesheet, commitMessage string) e fmt.Fprintf(rulesBuffer, "%s = %s\n", ruleName, rule) case []interface{}: for _, entry := range rule { - switch r := entry.(type) { - case *dtos.Rule: - r.Value.NomeAplicativo = strings.Trim(r.Value.NomeAplicativo, " ") - r.Value.TextoURLDesvio = strings.Trim(r.Value.TextoURLDesvio, " ") - r.Value.TextoURLPadrao = strings.Trim(r.Value.TextoURLPadrao, " ") - value, err := json.Marshal(r.Value) - if err != nil { - log.Errorf("Failed marshal rule value: %v", err) - return err - } - fmt.Fprintf(rulesBuffer, "[[%s]]\ncondition = %s\nvalue = %s\ntype = object\n\n", ruleName, r.Condition, string(value)) - default: - fmt.Fprintf(rulesBuffer, "DEFAULT ENTRY %s = %s\n", ruleName, reflect.TypeOf(rule)) + err := printRule(entry, rulesBuffer, ruleName, true) + if err != nil { + log.Errorf("Failed marshal rule: %v", err) + return err } - + } + case interface{}: + err := printRule(rule, rulesBuffer, ruleName, false) + if err != nil { + log.Errorf("Failed marshal rule: %v", err) + return err } default: fmt.Fprintf(rulesBuffer, "DEFAULT %s = %s\n", ruleName, reflect.TypeOf(rule)) @@ -244,6 +240,40 @@ func (gs *gitlabService) Save(rulesheet *dtos.Rulesheet, commitMessage string) e return err } +func printRule(rule interface{}, rulesBuffer *bytes.Buffer, ruleName string, isSliceItem bool) error { + ruleNameTag := "[%s]" + if isSliceItem { + ruleNameTag = "[" + ruleNameTag + "]" + } + + switch r := rule.(type) { + case *dtos.Rule: + value, err := json.Marshal(r.Value) + if err != nil { + log.Errorf("Failed marshal rule value: %v", err) + return err + } + fmt.Fprintf(rulesBuffer, ruleNameTag+"\ncondition = %s\nvalue = %s\ntype = object\n\n", ruleName, r.Condition, string(value)) + case map[string]interface{}: + fmt.Fprintf(rulesBuffer, ruleNameTag+"\n", ruleName) + keys := make([]string, 0) + + for k := range r { + // fmt.Printf("RULE k: %s\n", k) + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + v := r[k] + fmt.Fprintf(rulesBuffer, "%s = %s\n", k, v) + } + fmt.Fprintf(rulesBuffer, "\n") + default: + fmt.Fprintf(rulesBuffer, "DEFAULT ENTRY %s = %s\n", ruleName, reflect.TypeOf(rule)) + } + return nil +} + func createOrUpdateGitlabFileCommitAction(git *gitlab.Client, proj *gitlab.Project, ref string, filename string, content string) (*gitlab.CommitActionOptions, error) { action, err := defineCreateOrUpdateGitlabFileAction(git, proj, ref, filename) if err != nil { diff --git a/services/gitlab_test.go b/services/gitlab_test.go index ed21e8a..ee70499 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -313,12 +313,11 @@ func TestSaveTestFilesCreationWithRuleInterface(t *testing.T) { rules := []interface{}{ &dtos.Rule{ - Condition: "test", - Value: dtos.RuleValue{ - NomeAplicativo: "testAplicativo", - TextoURLPadrao: "testURLpadrao", - TextoURLDesvio: "testURLdesvio", + Value: map[string]string{ + "nomeAplicativo": "testAplicativo", + "textoUrlPadrao": "testURLpadrao", + "textoUrlDesvio": "testURLdesvio", }, Type: "testType", }, @@ -357,7 +356,7 @@ func TestSaveTestFilesCreationWithRuleInterface(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "[[tags]]\ncondition = test\nvalue = {\"nomeAplicativo\":\"testAplicativo\",\"textoUrlPadrao\":\"testURLpadrao\",\"textoUrlDesvio\":\"testURLdesvio\"}\ntype = object\n\n", rulesFeatws) + assert.Equal(t, "[[tags]]\ncondition = test\nvalue = {\"nomeAplicativo\":\"testAplicativo\",\"textoUrlDesvio\":\"testURLdesvio\",\"textoUrlPadrao\":\"testURLpadrao\"}\ntype = object\n\n", rulesFeatws) w.Write(data) return @@ -377,15 +376,12 @@ func TestSaveTestFilesCreationWithRuleInterface(t *testing.T) { } } -func TestSaveTestFilesCreationWithRuleInterfaceWithDefault(t *testing.T) { +func TestSaveTestFilesCreationWithRuleString(t *testing.T) { dto := SetupRulesheet() - rules := []interface{}{ - "test", - } - mappedRules := map[string]interface{}{ - "tags": rules, + "rule1": "true", + "rule2": "\"test\"", } dto.Rules = &mappedRules @@ -416,7 +412,7 @@ func TestSaveTestFilesCreationWithRuleInterfaceWithDefault(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "DEFAULT ENTRY tags = []interface {}\n", rulesFeatws) + assert.Equal(t, "rule1 = true\nrule2 = \"test\"\n", rulesFeatws) w.Write(data) return @@ -497,20 +493,29 @@ func TestSaveTestFilesCreationWithStringRule(t *testing.T) { func TestSaveTestFilesCreationWithDefaultRule(t *testing.T) { dto := SetupRulesheet() - rules := + rules := []interface{}{ &dtos.Rule{ - Condition: "test", - Value: dtos.RuleValue{ - NomeAplicativo: "testAplicativo", - TextoURLPadrao: "testURLpadrao", - TextoURLDesvio: "testURLdesvio", + Value: map[string]string{ + "NomeAplicativo": "testAplicativo", + "TextoURLPadrao": "testURLpadrao", + "TextoURLDesvio": "testURLdesvio", }, Type: "testType", - } + }, + } mappedRules := map[string]interface{}{ + // "mystring": "teste", "tags": rules, + // "mycomplexrule": &dtos.Rule{ + // Condition: "true", + // Value: map[string]string{ + // "field1": "value1", + // "field2": "value2", + // }, + // Type: "testType", + // }, } dto.Rules = &mappedRules @@ -542,7 +547,7 @@ func TestSaveTestFilesCreationWithDefaultRule(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "DEFAULT tags = *dtos.Rule\n", rulesFeatws) + assert.Equal(t, "[[tags]]\ncondition = test\nvalue = {\"NomeAplicativo\":\"testAplicativo\",\"TextoURLDesvio\":\"testURLdesvio\",\"TextoURLPadrao\":\"testURLpadrao\"}\ntype = object\n\n", rulesFeatws) w.Write(data) return From 382b81308d339d17425ba4bd9c51da3fb707f860 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Mon, 10 Oct 2022 21:20:02 -0300 Subject: [PATCH 24/55] fix: complex structs --- .gitignore | 4 +- go.mod | 1 + go.sum | 4 ++ services/gitlab.go | 43 ++++++++++++++++--- services/gitlab_test.go | 94 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 140 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 63348eb..6d87665 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,6 @@ _data/ .json .vscode -data/ \ No newline at end of file +data/ + +__debug_bin \ No newline at end of file diff --git a/go.mod b/go.mod index ffc13a5..d95a1e7 100644 --- a/go.mod +++ b/go.mod @@ -28,6 +28,7 @@ require ( github.com/KyleBanks/depth v1.2.1 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect + github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/go.sum b/go.sum index 8626ba0..0df33a3 100644 --- a/go.sum +++ b/go.sum @@ -75,6 +75,10 @@ github.com/bancodobrasil/gin-monitor v1.0.0-rc1 h1:l98a1muGLLMQJ6BAudvL1263vj+26 github.com/bancodobrasil/gin-monitor v1.0.0-rc1/go.mod h1:hfOEzz5YWVYU8cdyK6O5/zGy34O1lhp2/Wfo6eMCPNg= github.com/bancodobrasil/gin-telemetry v0.0.1-rc5 h1:0isKPZ3IHkINJLibI+bXEQ/ex6v/a0SAPmUCb/l2pLg= github.com/bancodobrasil/gin-telemetry v0.0.1-rc5/go.mod h1:amKV8U6OFB355twaZO92vy3GYesdTpT3esi2c13HNDI= +github.com/bancodobrasil/go-featws v0.0.0-20221010233623-acdac4e32d39 h1:9YxfUdmOA5VycHSzOeaEfiKTsfnEzbLsOC7BNWrxd94= +github.com/bancodobrasil/go-featws v0.0.0-20221010233623-acdac4e32d39/go.mod h1:hOjhXXhYmMrjninF6V6w6ZAaGvLZzWs5G+wIqH+PAX4= +github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4 h1:GOmDN95lCh0VJoulLMVvDRrj+uYLoKGhSx02sFVOlpQ= +github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4/go.mod h1:hOjhXXhYmMrjninF6V6w6ZAaGvLZzWs5G+wIqH+PAX4= github.com/bancodobrasil/healthcheck v0.0.2-rc1 h1:CcM4cZglmDokOtiaMSH9JokQqEQCsdtHQ2Ej0oqvTrg= github.com/bancodobrasil/healthcheck v0.0.2-rc1/go.mod h1:C/YL9OERFDjg0Xa60zP2PrWBJI1N92bXlrxIqo5GagY= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= diff --git a/services/gitlab.go b/services/gitlab.go index fa02b47..f142b4a 100644 --- a/services/gitlab.go +++ b/services/gitlab.go @@ -15,6 +15,7 @@ import ( "github.com/bancodobrasil/featws-api/dtos" "github.com/xanzy/go-gitlab" + "github.com/bancodobrasil/go-featws" log "github.com/sirupsen/logrus" ) @@ -352,15 +353,47 @@ func (gs *gitlabService) Fill(rulesheet *dtos.Rulesheet) (err error) { return } - rulesArr := strings.Split(string(bRules), "\n") + rulesFile, err := featws.Load(bRules) + if err != nil { + log.Errorf("Failed to load featws file: %v", err) + return + } rules := make(map[string]interface{}) - for _, line := range rulesArr { - if line != "" { - parts := strings.SplitN(line, "=", 2) - rules[strings.Trim(parts[0], " ")] = strings.Trim(parts[1], " ") + s := rulesFile.Section("") + + for _, k := range s.Keys() { + rules[k.Name()] = k.Value() + } + + for _, sname := range rulesFile.SectionStrings() { + if sname == featws.DefaultSection { + continue + } + if sname[:1] == "[" { + continue + } + sec := make(map[string]interface{}) + for _, k := range rulesFile.Section(sname).Keys() { + sec[k.Name()] = k.Value() + } + rules[sname] = sec + } + + for _, aname := range rulesFile.ArrayStrings() { + a := rulesFile.Array(aname) + + arr := make([]map[string]interface{}, 0) + + for _, s := range a.Sections() { + sec := make(map[string]interface{}) + for _, k := range s.Keys() { + sec[k.Name()] = k.Value() + } + arr = append(arr, sec) } + rules[aname[1:len(aname)-1]] = arr } rulesheet.Rules = &rules diff --git a/services/gitlab_test.go b/services/gitlab_test.go index ee70499..458ae3f 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -677,8 +677,102 @@ func TestFill(t *testing.T) { ngl := services.NewGitlab(cfg) ngl.Connect() err := ngl.Fill(dto) + + if (*dto.Rules)["regra"].(string) != "$test" { + t.Error("error on unmarshalling rules") + } + + if err != nil { + t.Error("unexpected error") + } +} + +// Functions to test fill function +func TestFillRulesSlices(t *testing.T) { + dto := SetupRulesheet() + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste", "path":"testpath"}`)) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/testpath/prefix-Test" { + w.Write([]byte(`{"id":1,"description":"testeDesc","name":"teste"}`)) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/rules.featws" { + content := base64.StdEncoding.EncodeToString([]byte("[feat]\n condition = $test\n[[tags]]\n condition = $test")) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/parameters.json" { + content := base64.StdEncoding.EncodeToString([]byte("[]")) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := SetupConfig(s) + + ngl := services.NewGitlab(cfg) + ngl.Connect() + err := ngl.Fill(dto) + + feat, ok := (*dto.Rules)["feat"] + if !ok { + t.Error("error on unmarshalling rules: not found feat") + return + } + + featMap, ok := feat.(map[string]interface{}) + if !ok { + t.Error("error on unmarshalling rules: feat is no map") + return + } + + if featMap["condition"].(string) != "$test" { + t.Error("error on unmarshalling rules") + return + } + + tags, ok := (*dto.Rules)["tags"] + if !ok { + t.Error("error on unmarshalling rules: not found tags array") + return + } + + arr, ok := tags.([]map[string]interface{}) + if !ok { + t.Error("error on unmarshalling rules: tags is no array") + return + } + + if arr[0]["condition"].(string) != "$test" { + t.Error("error on unmarshalling rules") + return + } + if err != nil { t.Error("unexpected error") + return } } From 95b01b36181ec98aa11d0287635d688f23b8a3c7 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 14 Oct 2022 15:13:06 -0300 Subject: [PATCH 25/55] Update docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index fd8b25a..9151989 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: image: mysql:8-debian restart: always ports: - - 3307:3306 + - 3306:3306 volumes: - ./data/mysql:/var/lib/mysql environment: From 947aac1c9a91627c53ed39604b6d36f1196312ee Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 14 Oct 2022 15:14:01 -0300 Subject: [PATCH 26/55] Update config.go --- config/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 7c49809..258a260 100644 --- a/config/config.go +++ b/config/config.go @@ -19,7 +19,7 @@ type Config struct { GitlabDefaultBranch string `mapstructure:"FEATWS_API_GITLAB_DEFAULT_BRANCH"` GitlabCIScript string `mapstructure:"FEATWS_API_GITLAB_CI_SCRIPT"` ExternalHost string `mapstructure:"EXTERNAL_HOST"` - OpenAMURL string `mapstructure:"OPEN_AM_URL"` + OpenAMURL string `mapstructure:"OPENAM_URL"` } var config = &Config{} @@ -42,7 +42,7 @@ func LoadConfig() (err error) { viper.SetDefault("FEATWS_API_GITLAB_DEFAULT_BRANCH", "main") viper.SetDefault("FEATWS_API_GITLAB_CI_SCRIPT", "") viper.SetDefault("EXTERNAL_HOST", "localhost:9007") - viper.SetDefault("OPEN_AM_URL", "") + viper.SetDefault("OPENAM_URL", "") err = viper.ReadInConfig() if err != nil { From 591ecf1cf58e904a8771046d86ac8d893e5537f8 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 14 Oct 2022 16:00:53 -0300 Subject: [PATCH 27/55] fix: fill parameters and features --- services/gitlab.go | 4 ++-- services/gitlab_test.go | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/services/gitlab.go b/services/gitlab.go index f142b4a..9e19cdd 100644 --- a/services/gitlab.go +++ b/services/gitlab.go @@ -335,13 +335,13 @@ func (gs *gitlabService) Fill(rulesheet *dtos.Rulesheet) (err error) { rulesheet.Version = strings.Replace(string(bVersion), "\n", "", -1) - err = gitlabLoadJSON(git, proj, gs.cfg.GitlabDefaultBranch, "features.json", rulesheet.Features) + err = gitlabLoadJSON(git, proj, gs.cfg.GitlabDefaultBranch, "features.json", &rulesheet.Features) if err != nil { log.Errorf("Failed to fetch features: %v", err) return } - err = gitlabLoadJSON(git, proj, gs.cfg.GitlabDefaultBranch, "parameters.json", rulesheet.Parameters) + err = gitlabLoadJSON(git, proj, gs.cfg.GitlabDefaultBranch, "parameters.json", &rulesheet.Parameters) if err != nil { log.Errorf("Failed to fetch parameters: %v", err) return diff --git a/services/gitlab_test.go b/services/gitlab_test.go index 458ae3f..2f3a8d5 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -631,7 +631,6 @@ func TestSaveTestFilesUpdate(t *testing.T) { // Functions to test fill function func TestFill(t *testing.T) { - dto := SetupRulesheet() namespace := "test" @@ -658,7 +657,16 @@ func TestFill(t *testing.T) { } if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/parameters.json" { - content := base64.StdEncoding.EncodeToString([]byte("[]")) + content := base64.StdEncoding.EncodeToString([]byte(`[ + { + "name": "param1", + "type": "string" + }, + { + "name": "param2", + "type": "string" + } + ]`)) file := gitlab.File{ Content: content, @@ -676,15 +684,35 @@ func TestFill(t *testing.T) { ngl := services.NewGitlab(cfg) ngl.Connect() + dto := SetupRulesheet() err := ngl.Fill(dto) + if err != nil { + t.Errorf("unexpected error on fill: %s", err.Error()) + return + } if (*dto.Rules)["regra"].(string) != "$test" { t.Error("error on unmarshalling rules") + return } - if err != nil { - t.Error("unexpected error") + if (dto.Parameters) == nil || len(*dto.Parameters) != 2 { + t.Error("error on unmarshalling parameters") + return + } + + param1 := (*dto.Parameters)[0] + if param1["name"] != "param1" || param1["type"] != "string" { + t.Error("error on unmarshalling parameter 1") + return } + + param2 := (*dto.Parameters)[1] + if param2["name"] != "param2" || param1["type"] != "string" { + t.Error("error on unmarshalling parameter 2") + return + } + } // Functions to test fill function From c7badb3f2c479d807abbc001eea99e3c06ecb8b9 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 14 Oct 2022 16:08:24 -0300 Subject: [PATCH 28/55] feat: add feat test --- services/gitlab_test.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/services/gitlab_test.go b/services/gitlab_test.go index 2f3a8d5..9a9141a 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -676,6 +676,26 @@ func TestFill(t *testing.T) { return } + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/features.json" { + content := base64.StdEncoding.EncodeToString([]byte(`[ + { + "name": "feat1", + "type": "string" + }, + { + "name": "feat2", + "type": "string" + } + ]`)) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + w.WriteHeader(http.StatusNotFound) })) defer s.Close() @@ -713,6 +733,22 @@ func TestFill(t *testing.T) { return } + if (dto.Features) == nil || len(*dto.Features) != 2 { + t.Error("error on unmarshalling Features") + return + } + + feat1 := (*dto.Features)[0] + if feat1["name"] != "feat1" || feat1["type"] != "string" { + t.Error("error on unmarshalling Feature 1") + return + } + + feat2 := (*dto.Features)[1] + if feat2["name"] != "feat2" || param1["type"] != "string" { + t.Error("error on unmarshalling Feature 2") + return + } } // Functions to test fill function From 5cbf02e406316b1c842d3314bd1ed9a2359d261e Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 14 Oct 2022 16:08:33 -0300 Subject: [PATCH 29/55] feat: enable tests on CI --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index abef6c8..2d01efb 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -47,5 +47,5 @@ jobs: - name: Build run: go build -v ./... - #- name: Test - # run: go test -v ./... \ No newline at end of file + - name: Test + run: go test -v ./... \ No newline at end of file From c65ce7156d13848da2d5a09f53e9d4ad233489ba Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 14 Oct 2022 16:13:15 -0300 Subject: [PATCH 30/55] fix: lint and docs --- .github/workflows/go.yml | 3 ++- docs/docs.go | 10 ++++++++-- docs/swagger.json | 10 ++++++++-- docs/swagger.yaml | 8 ++++++-- middlewares/middlewares.go | 2 ++ middlewares/verify_auth_token.go | 5 ++++- routes/routes.go | 17 ----------------- 7 files changed, 30 insertions(+), 25 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2d01efb..a0a4893 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -33,7 +33,8 @@ jobs: - name: "Run golint" if: ${{ matrix.go_version == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'}} run: | - make lint + go install golang.org/x/lint/golint@latest + golint -set_exit_status $1 ./... exit $1 - name: "Run gofmt" diff --git a/docs/docs.go b/docs/docs.go index 6fb1e23..8c7203b 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -397,7 +397,10 @@ const docTemplate = `{ }, "features": { "type": "array", - "items": {} + "items": { + "type": "object", + "additionalProperties": true + } }, "hasStringRule": { "type": "boolean" @@ -410,7 +413,10 @@ const docTemplate = `{ }, "parameters": { "type": "array", - "items": {} + "items": { + "type": "object", + "additionalProperties": true + } }, "rules": { "type": "object", diff --git a/docs/swagger.json b/docs/swagger.json index 9a9999f..27c3da9 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -390,7 +390,10 @@ }, "features": { "type": "array", - "items": {} + "items": { + "type": "object", + "additionalProperties": true + } }, "hasStringRule": { "type": "boolean" @@ -403,7 +406,10 @@ }, "parameters": { "type": "array", - "items": {} + "items": { + "type": "object", + "additionalProperties": true + } }, "rules": { "type": "object", diff --git a/docs/swagger.yaml b/docs/swagger.yaml index e6afe45..f050002 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -13,7 +13,9 @@ definitions: description: type: string features: - items: {} + items: + additionalProperties: true + type: object type: array hasStringRule: type: boolean @@ -22,7 +24,9 @@ definitions: name: type: string parameters: - items: {} + items: + additionalProperties: true + type: object type: array rules: additionalProperties: true diff --git a/middlewares/middlewares.go b/middlewares/middlewares.go index 473425f..cd0e01e 100644 --- a/middlewares/middlewares.go +++ b/middlewares/middlewares.go @@ -2,10 +2,12 @@ package middlewares import "github.com/gin-gonic/gin" +// Middleware ... type Middleware interface { Run() } +// InitializeMiddlewares ... func InitializeMiddlewares() { NewVerifyAuthTokenMiddleware() } diff --git a/middlewares/verify_auth_token.go b/middlewares/verify_auth_token.go index cc478d9..c9e88dc 100644 --- a/middlewares/verify_auth_token.go +++ b/middlewares/verify_auth_token.go @@ -14,6 +14,7 @@ import ( "github.com/lestrrat-go/jwx/v2/jws" ) +// VerifyAuthTokenMiddleware ... type VerifyAuthTokenMiddleware struct { url string ctx context.Context @@ -22,11 +23,12 @@ type VerifyAuthTokenMiddleware struct { var verifyAuthTokenMiddleware *VerifyAuthTokenMiddleware -// Middleware function to verify the JWT token +// VerifyAuthToken Middleware function to verify the JWT token func VerifyAuthToken() gin.HandlerFunc { return verifyAuthTokenMiddleware.Run() } +// NewVerifyAuthTokenMiddleware ... func NewVerifyAuthTokenMiddleware() { cfg := config.GetConfig() ctx := context.Background() @@ -49,6 +51,7 @@ func (m *VerifyAuthTokenMiddleware) setup() { } } +// Run ... func (m *VerifyAuthTokenMiddleware) Run() gin.HandlerFunc { return func(c *gin.Context) { token := m.extractTokenFromHeader(c) diff --git a/routes/routes.go b/routes/routes.go index cf9edc9..59b56a2 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -24,23 +24,6 @@ func SetupRoutes(router *gin.Engine) { router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) } -// SetupRoutes define all routes -func SetupRoutesWithReturn() *gin.Engine { - - router := gin.Default() - - cfg := config.GetConfig() - - docs.SwaggerInfo.Host = cfg.ExternalHost - - homeRouter(router.Group("/")) - health.Router(router.Group("/health")) - // setup swagger docs - router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) - - return router -} - // APIRoutes define all api routes func APIRoutes(router *gin.Engine) { // inject middleware From a2a25046d616c0a0fbf0a94e507b4ca9d83afbfe Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 14 Oct 2022 16:27:03 -0300 Subject: [PATCH 31/55] docs: rename securityDefinitions --- controllers/v1/rulesheets.go | 10 +++++----- docs/docs.go | 12 ++++++------ docs/swagger.json | 12 ++++++------ docs/swagger.yaml | 12 ++++++------ main.go | 2 +- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/controllers/v1/rulesheets.go b/controllers/v1/rulesheets.go index bdbeb4c..bc30f6e 100644 --- a/controllers/v1/rulesheets.go +++ b/controllers/v1/rulesheets.go @@ -48,7 +48,7 @@ func NewRulesheets(service services.Rulesheets) Rulesheets { // @Failure 500 {object} responses.Error "Internal Server Error" // @Failure default {object} responses.Error // @Response 404 "Not Found" -// @Security ApiKeyAuth +// @Security Authentication // @Router /rulesheets [post] func (rc *rulesheets) CreateRulesheet() gin.HandlerFunc { @@ -114,7 +114,7 @@ func (rc *rulesheets) CreateRulesheet() gin.HandlerFunc { // @Failure 500 {object} responses.Error "Internal Server Error" // @Failure default {object} responses.Error // @Response 404 "Not Found" -// @Security ApiKeyAuth +// @Security Authentication // @Router /rulesheets/ [get] func (rc *rulesheets) GetRulesheets() gin.HandlerFunc { @@ -217,7 +217,7 @@ func (rc *rulesheets) GetRulesheets() gin.HandlerFunc { // @Failure 500 {object} responses.Error "Internal Server Error" // @Failure default {object} responses.Error // @Response 404 "Not Found" -// @Security ApiKeyAuth +// @Security Authentication // @Router /rulesheets/{id} [get] func (rc *rulesheets) GetRulesheet() gin.HandlerFunc { @@ -269,7 +269,7 @@ func (rc *rulesheets) GetRulesheet() gin.HandlerFunc { // @Failure 500 {object} responses.Error "Internal Server Error" // @Failure default {object} responses.Error // @Response 404 "Not Found" -// @Security ApiKeyAuth +// @Security Authentication // @Router /rulesheets/{id} [put] func (rc *rulesheets) UpdateRulesheet() gin.HandlerFunc { @@ -366,7 +366,7 @@ func (rc *rulesheets) UpdateRulesheet() gin.HandlerFunc { // @Failure 500 {object} responses.Error "Internal Server Error" // @Failure default {object} responses.Error // @Response 404 "Not Found" -// @Security ApiKeyAuth +// @Security Authentication // @Router /rulesheets/{id} [delete] func (rc *rulesheets) DeleteRulesheet() gin.HandlerFunc { diff --git a/docs/docs.go b/docs/docs.go index 8c7203b..32d8783 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -29,7 +29,7 @@ const docTemplate = `{ "post": { "security": [ { - "ApiKeyAuth": [] + "Authentication": [] } ], "description": "Create Rulesheet description", @@ -95,7 +95,7 @@ const docTemplate = `{ "get": { "security": [ { - "ApiKeyAuth": [] + "Authentication": [] } ], "description": "List Rulesheet description", @@ -173,7 +173,7 @@ const docTemplate = `{ "get": { "security": [ { - "ApiKeyAuth": [] + "Authentication": [] } ], "description": "Get Rulesheet by ID description", @@ -238,7 +238,7 @@ const docTemplate = `{ "put": { "security": [ { - "ApiKeyAuth": [] + "Authentication": [] } ], "description": "Update Rulesheet by ID description", @@ -312,7 +312,7 @@ const docTemplate = `{ "delete": { "security": [ { - "ApiKeyAuth": [] + "Authentication": [] } ], "description": "Delete Rulesheet by ID description", @@ -446,7 +446,7 @@ const docTemplate = `{ } }, "securityDefinitions": { - "ApiKeyAuth": { + "Authentication": { "type": "apiKey", "name": "Authorization", "in": "header" diff --git a/docs/swagger.json b/docs/swagger.json index 27c3da9..e4251a1 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -22,7 +22,7 @@ "post": { "security": [ { - "ApiKeyAuth": [] + "Authentication": [] } ], "description": "Create Rulesheet description", @@ -88,7 +88,7 @@ "get": { "security": [ { - "ApiKeyAuth": [] + "Authentication": [] } ], "description": "List Rulesheet description", @@ -166,7 +166,7 @@ "get": { "security": [ { - "ApiKeyAuth": [] + "Authentication": [] } ], "description": "Get Rulesheet by ID description", @@ -231,7 +231,7 @@ "put": { "security": [ { - "ApiKeyAuth": [] + "Authentication": [] } ], "description": "Update Rulesheet by ID description", @@ -305,7 +305,7 @@ "delete": { "security": [ { - "ApiKeyAuth": [] + "Authentication": [] } ], "description": "Delete Rulesheet by ID description", @@ -439,7 +439,7 @@ } }, "securityDefinitions": { - "ApiKeyAuth": { + "Authentication": { "type": "apiKey", "name": "Authorization", "in": "header" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index f050002..1a9a645 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -100,7 +100,7 @@ paths: schema: $ref: '#/definitions/v1.Error' security: - - ApiKeyAuth: [] + - Authentication: [] summary: Create Rulesheet tags: - Rulesheet @@ -150,7 +150,7 @@ paths: schema: $ref: '#/definitions/v1.Error' security: - - ApiKeyAuth: [] + - Authentication: [] summary: List Rulesheets tags: - Rulesheet @@ -191,7 +191,7 @@ paths: schema: $ref: '#/definitions/v1.Error' security: - - ApiKeyAuth: [] + - Authentication: [] summary: Delete Rulesheet by ID tags: - Rulesheet @@ -233,7 +233,7 @@ paths: schema: $ref: '#/definitions/v1.Error' security: - - ApiKeyAuth: [] + - Authentication: [] summary: Get Rulesheet by ID tags: - Rulesheet @@ -281,12 +281,12 @@ paths: schema: $ref: '#/definitions/v1.Error' security: - - ApiKeyAuth: [] + - Authentication: [] summary: Update Rulesheet by ID tags: - Rulesheet securityDefinitions: - ApiKeyAuth: + Authentication: in: header name: Authorization type: apiKey diff --git a/main.go b/main.go index 8263d82..398bc49 100644 --- a/main.go +++ b/main.go @@ -40,7 +40,7 @@ func setupLog() { // @host localhost:9007 // @BasePath /api/v1 -// @securityDefinitions.apikey ApiKeyAuth +// @securityDefinitions.apikey Authentication // @in header // @name Authorization From e42eae3e43b49574227d5fb08de5a6c83f40cc18 Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Fri, 21 Oct 2022 16:16:25 -0300 Subject: [PATCH 32/55] feat: Auth mode config and route setup --- config/config.go | 2 ++ routes/api/v1/v1.go | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 258a260..ee51989 100644 --- a/config/config.go +++ b/config/config.go @@ -20,6 +20,7 @@ type Config struct { GitlabCIScript string `mapstructure:"FEATWS_API_GITLAB_CI_SCRIPT"` ExternalHost string `mapstructure:"EXTERNAL_HOST"` OpenAMURL string `mapstructure:"OPENAM_URL"` + AuthMode string `mapstructure:"FEATWS_API_AUTH_MODE"` } var config = &Config{} @@ -43,6 +44,7 @@ func LoadConfig() (err error) { viper.SetDefault("FEATWS_API_GITLAB_CI_SCRIPT", "") viper.SetDefault("EXTERNAL_HOST", "localhost:9007") viper.SetDefault("OPENAM_URL", "") + viper.SetDefault("FEATWS_API_AUTH_MODE", "none") err = viper.ReadInConfig() if err != nil { diff --git a/routes/api/v1/v1.go b/routes/api/v1/v1.go index 029ff65..1880d89 100644 --- a/routes/api/v1/v1.go +++ b/routes/api/v1/v1.go @@ -1,13 +1,22 @@ package v1 import ( + "strings" + + "github.com/bancodobrasil/featws-api/config" "github.com/bancodobrasil/featws-api/middlewares" "github.com/gin-gonic/gin" ) // Router define routes the API V1 func Router(router *gin.RouterGroup) { - router.Use(middlewares.VerifyAuthToken()) + cfg := config.GetConfig() + + switch strings.ToLower(cfg.AuthMode) { + case "openam": + router.Use(middlewares.VerifyAuthToken()) + } + rulesheetsRouter(router.Group("/rulesheets")) //rpcRouter(router.Group("/")) } From 3eb30acf1e009f8ba3f218fa26d72e2bbef467cc Mon Sep 17 00:00:00 2001 From: EduardaCastro Date: Thu, 27 Oct 2022 15:44:40 -0300 Subject: [PATCH 33/55] feat: unique name rulesheet --- models/rulesheet.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/rulesheet.go b/models/rulesheet.go index 7f85432..8f00d68 100644 --- a/models/rulesheet.go +++ b/models/rulesheet.go @@ -10,7 +10,7 @@ import ( // Rulesheet ... type Rulesheet struct { gorm.Model - Name string + Name string `gorm:"type:varchar(255);uniqueIndex"` Description string Slug string //`gorm:"unique_index"` HasStringRule bool From dec49622c90df851383e9331849197b70609805f Mon Sep 17 00:00:00 2001 From: EduardaCastro Date: Thu, 27 Oct 2022 18:03:26 -0300 Subject: [PATCH 34/55] feat: Return Id to POST rulersheet --- controllers/v1/rulesheets.go | 2 ++ services/rulesheets.go | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/controllers/v1/rulesheets.go b/controllers/v1/rulesheets.go index bc30f6e..e1899da 100644 --- a/controllers/v1/rulesheets.go +++ b/controllers/v1/rulesheets.go @@ -95,8 +95,10 @@ func (rc *rulesheets) CreateRulesheet() gin.HandlerFunc { } var response = responses.NewRulesheet(&dto) + //id := c.Query("id") c.JSON(http.StatusCreated, response) } + } // GetRulesheets godoc diff --git a/services/rulesheets.go b/services/rulesheets.go index b099719..7c7e774 100644 --- a/services/rulesheets.go +++ b/services/rulesheets.go @@ -43,9 +43,11 @@ func NewRulesheets(repository repository.Rulesheets, gitlabService Gitlab) Rules // CreateRulesheet ... func (rs rulesheets) Create(ctx context.Context, rulesheetDTO *dtos.Rulesheet) (err error) { - //TODO verifica unicidade do nome rulesheet, _ := models.NewRulesheetV1(*rulesheetDTO) - rulesheet.Slug = slug.Make(rulesheet.Slug) + if rulesheet.Slug == "" { + rulesheet.Slug = slug.Make(rulesheet.Name) + } + fmt.Print(rulesheet.Slug) err = rs.repository.Create(ctx, &rulesheet) @@ -53,7 +55,8 @@ func (rs rulesheets) Create(ctx context.Context, rulesheetDTO *dtos.Rulesheet) ( log.Errorf("Error on create rulesheet into repository: %v", err) return } - + rulesheetDTO.ID = rulesheet.ID + rulesheetDTO.Slug = rulesheet.Slug err = rs.gitlabService.Save(rulesheetDTO, "[FEATWS BOT] Create Repo") if err != nil { log.Errorf("Error on save rulesheet into repository: %v", err) From e98bd680fb942cfee59cb5341e54b48e19a50569 Mon Sep 17 00:00:00 2001 From: EduardaCastro Date: Mon, 31 Oct 2022 14:46:45 -0300 Subject: [PATCH 35/55] feat: swagger authentication --- docs/docs.go | 7 ++++++- docs/swagger.json | 7 ++++++- docs/swagger.yaml | 6 +++++- main.go | 9 ++++++++- models/rulesheet.go | 2 +- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 32d8783..7ed13c9 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -446,7 +446,12 @@ const docTemplate = `{ } }, "securityDefinitions": { - "Authentication": { + "AuthenticationApiKey": { + "type": "apiKey", + "name": "X-Api-Authorization", + "in": "header" + }, + "AuthenticationAuthToken": { "type": "apiKey", "name": "Authorization", "in": "header" diff --git a/docs/swagger.json b/docs/swagger.json index e4251a1..3c090a6 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -439,7 +439,12 @@ } }, "securityDefinitions": { - "Authentication": { + "AuthenticationApiKey": { + "type": "apiKey", + "name": "X-Api-Authorization", + "in": "header" + }, + "AuthenticationAuthToken": { "type": "apiKey", "name": "Authorization", "in": "header" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 1a9a645..dd0a1f5 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -286,7 +286,11 @@ paths: tags: - Rulesheet securityDefinitions: - Authentication: + AuthenticationApiKey: + in: header + name: X-Api-Authorization + type: apiKey + AuthenticationAuthToken: in: header name: Authorization type: apiKey diff --git a/main.go b/main.go index 398bc49..945baf4 100644 --- a/main.go +++ b/main.go @@ -40,7 +40,14 @@ func setupLog() { // @host localhost:9007 // @BasePath /api/v1 -// @securityDefinitions.apikey Authentication +// @Security X-Api-Authorization +// @Security AuthenticationApiKey + +// @securityDefinitions.apikey AuthenticationApiKey +// @in header +// @name X-Api-Authorization + +// @securityDefinitions.apikey AuthenticationAuthToken // @in header // @name Authorization diff --git a/models/rulesheet.go b/models/rulesheet.go index 8f00d68..9423a39 100644 --- a/models/rulesheet.go +++ b/models/rulesheet.go @@ -12,7 +12,7 @@ type Rulesheet struct { gorm.Model Name string `gorm:"type:varchar(255);uniqueIndex"` Description string - Slug string //`gorm:"unique_index"` + Slug string `gorm:"unique_index"` HasStringRule bool CreatedAt *time.Time UpdatedAt *time.Time From b09fb81a7f0b8fb8026fc3879969db3e4e1abb8c Mon Sep 17 00:00:00 2001 From: EduardaCastro Date: Tue, 1 Nov 2022 17:49:02 -0300 Subject: [PATCH 36/55] feat:authentication-api-key-and-bearer-token --- controllers/v1/rulesheets.go | 15 ++++++++++----- docs/docs.go | 31 +++++++++++++++++++++++-------- docs/swagger.json | 31 +++++++++++++++++++++++-------- docs/swagger.yaml | 21 +++++++++++++-------- main.go | 9 +++------ 5 files changed, 72 insertions(+), 35 deletions(-) diff --git a/controllers/v1/rulesheets.go b/controllers/v1/rulesheets.go index e1899da..aee7627 100644 --- a/controllers/v1/rulesheets.go +++ b/controllers/v1/rulesheets.go @@ -48,7 +48,8 @@ func NewRulesheets(service services.Rulesheets) Rulesheets { // @Failure 500 {object} responses.Error "Internal Server Error" // @Failure default {object} responses.Error // @Response 404 "Not Found" -// @Security Authentication +// @Security Authentication Api Key +// @Security Authentication Bearer Token // @Router /rulesheets [post] func (rc *rulesheets) CreateRulesheet() gin.HandlerFunc { @@ -116,7 +117,8 @@ func (rc *rulesheets) CreateRulesheet() gin.HandlerFunc { // @Failure 500 {object} responses.Error "Internal Server Error" // @Failure default {object} responses.Error // @Response 404 "Not Found" -// @Security Authentication +// @Security Authentication Api Key +// @Security Authentication Bearer Token // @Router /rulesheets/ [get] func (rc *rulesheets) GetRulesheets() gin.HandlerFunc { @@ -219,7 +221,8 @@ func (rc *rulesheets) GetRulesheets() gin.HandlerFunc { // @Failure 500 {object} responses.Error "Internal Server Error" // @Failure default {object} responses.Error // @Response 404 "Not Found" -// @Security Authentication +// @Security Authentication Api Key +// @Security Authentication Bearer Token // @Router /rulesheets/{id} [get] func (rc *rulesheets) GetRulesheet() gin.HandlerFunc { @@ -271,7 +274,8 @@ func (rc *rulesheets) GetRulesheet() gin.HandlerFunc { // @Failure 500 {object} responses.Error "Internal Server Error" // @Failure default {object} responses.Error // @Response 404 "Not Found" -// @Security Authentication +// @Security Authentication Api Key +// @Security Authentication Bearer Token // @Router /rulesheets/{id} [put] func (rc *rulesheets) UpdateRulesheet() gin.HandlerFunc { @@ -368,7 +372,8 @@ func (rc *rulesheets) UpdateRulesheet() gin.HandlerFunc { // @Failure 500 {object} responses.Error "Internal Server Error" // @Failure default {object} responses.Error // @Response 404 "Not Found" -// @Security Authentication +// @Security Authentication Api Key +// @Security Authentication Bearer Token // @Router /rulesheets/{id} [delete] func (rc *rulesheets) DeleteRulesheet() gin.HandlerFunc { diff --git a/docs/docs.go b/docs/docs.go index 7ed13c9..7e5b347 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -29,7 +29,10 @@ const docTemplate = `{ "post": { "security": [ { - "Authentication": [] + "Authentication Api Key": [] + }, + { + "Authentication Bearer Token": [] } ], "description": "Create Rulesheet description", @@ -95,7 +98,10 @@ const docTemplate = `{ "get": { "security": [ { - "Authentication": [] + "Authentication Api Key": [] + }, + { + "Authentication Bearer Token": [] } ], "description": "List Rulesheet description", @@ -173,7 +179,10 @@ const docTemplate = `{ "get": { "security": [ { - "Authentication": [] + "Authentication Api Key": [] + }, + { + "Authentication Bearer Token": [] } ], "description": "Get Rulesheet by ID description", @@ -238,7 +247,10 @@ const docTemplate = `{ "put": { "security": [ { - "Authentication": [] + "Authentication Api Key": [] + }, + { + "Authentication Bearer Token": [] } ], "description": "Update Rulesheet by ID description", @@ -312,7 +324,10 @@ const docTemplate = `{ "delete": { "security": [ { - "Authentication": [] + "Authentication Api Key": [] + }, + { + "Authentication Bearer Token": [] } ], "description": "Delete Rulesheet by ID description", @@ -446,12 +461,12 @@ const docTemplate = `{ } }, "securityDefinitions": { - "AuthenticationApiKey": { + "Authentication Api Key": { "type": "apiKey", - "name": "X-Api-Authorization", + "name": "X-API-Key", "in": "header" }, - "AuthenticationAuthToken": { + "Authentication Bearer Token": { "type": "apiKey", "name": "Authorization", "in": "header" diff --git a/docs/swagger.json b/docs/swagger.json index 3c090a6..5e1bb00 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -22,7 +22,10 @@ "post": { "security": [ { - "Authentication": [] + "Authentication Api Key": [] + }, + { + "Authentication Bearer Token": [] } ], "description": "Create Rulesheet description", @@ -88,7 +91,10 @@ "get": { "security": [ { - "Authentication": [] + "Authentication Api Key": [] + }, + { + "Authentication Bearer Token": [] } ], "description": "List Rulesheet description", @@ -166,7 +172,10 @@ "get": { "security": [ { - "Authentication": [] + "Authentication Api Key": [] + }, + { + "Authentication Bearer Token": [] } ], "description": "Get Rulesheet by ID description", @@ -231,7 +240,10 @@ "put": { "security": [ { - "Authentication": [] + "Authentication Api Key": [] + }, + { + "Authentication Bearer Token": [] } ], "description": "Update Rulesheet by ID description", @@ -305,7 +317,10 @@ "delete": { "security": [ { - "Authentication": [] + "Authentication Api Key": [] + }, + { + "Authentication Bearer Token": [] } ], "description": "Delete Rulesheet by ID description", @@ -439,12 +454,12 @@ } }, "securityDefinitions": { - "AuthenticationApiKey": { + "Authentication Api Key": { "type": "apiKey", - "name": "X-Api-Authorization", + "name": "X-API-Key", "in": "header" }, - "AuthenticationAuthToken": { + "Authentication Bearer Token": { "type": "apiKey", "name": "Authorization", "in": "header" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index dd0a1f5..c34e2a0 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -100,7 +100,8 @@ paths: schema: $ref: '#/definitions/v1.Error' security: - - Authentication: [] + - Authentication Api Key: [] + - Authentication Bearer Token: [] summary: Create Rulesheet tags: - Rulesheet @@ -150,7 +151,8 @@ paths: schema: $ref: '#/definitions/v1.Error' security: - - Authentication: [] + - Authentication Api Key: [] + - Authentication Bearer Token: [] summary: List Rulesheets tags: - Rulesheet @@ -191,7 +193,8 @@ paths: schema: $ref: '#/definitions/v1.Error' security: - - Authentication: [] + - Authentication Api Key: [] + - Authentication Bearer Token: [] summary: Delete Rulesheet by ID tags: - Rulesheet @@ -233,7 +236,8 @@ paths: schema: $ref: '#/definitions/v1.Error' security: - - Authentication: [] + - Authentication Api Key: [] + - Authentication Bearer Token: [] summary: Get Rulesheet by ID tags: - Rulesheet @@ -281,16 +285,17 @@ paths: schema: $ref: '#/definitions/v1.Error' security: - - Authentication: [] + - Authentication Api Key: [] + - Authentication Bearer Token: [] summary: Update Rulesheet by ID tags: - Rulesheet securityDefinitions: - AuthenticationApiKey: + Authentication Api Key: in: header - name: X-Api-Authorization + name: X-API-Key type: apiKey - AuthenticationAuthToken: + Authentication Bearer Token: in: header name: Authorization type: apiKey diff --git a/main.go b/main.go index 945baf4..6463582 100644 --- a/main.go +++ b/main.go @@ -40,14 +40,11 @@ func setupLog() { // @host localhost:9007 // @BasePath /api/v1 -// @Security X-Api-Authorization -// @Security AuthenticationApiKey - -// @securityDefinitions.apikey AuthenticationApiKey +// @securityDefinitions.apikey Authentication Api Key // @in header -// @name X-Api-Authorization +// @name X-API-Key -// @securityDefinitions.apikey AuthenticationAuthToken +// @securityDefinitions.apikey Authentication Bearer Token // @in header // @name Authorization From b8d726a5d930a7944d834fb4ec5f48bbc74488d3 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Mon, 7 Nov 2022 11:02:53 -0300 Subject: [PATCH 37/55] feat: rules json support --- services/gitlab.go | 196 ++++++++++++++++++---------------------- services/gitlab_test.go | 20 ++-- 2 files changed, 97 insertions(+), 119 deletions(-) diff --git a/services/gitlab.go b/services/gitlab.go index 9e19cdd..7681820 100644 --- a/services/gitlab.go +++ b/services/gitlab.go @@ -1,12 +1,10 @@ package services import ( - "bytes" "encoding/base64" "encoding/json" "fmt" "net/http" - "reflect" "sort" "strconv" "strings" @@ -176,58 +174,24 @@ func (gs *gitlabService) Save(rulesheet *dtos.Rulesheet, commitMessage string) e } actions = append(actions, commitAction) - rulesBuffer := bytes.NewBufferString("") - // RULES + // Rules if rulesheet.Rules == nil { empty := make(map[string]interface{}, 0) rulesheet.Rules = &empty } - rules := make([]string, 0) - - for k := range *rulesheet.Rules { - // fmt.Printf("RULE k: %s\n", k) - rules = append(rules, k) - } - - sort.Strings(rules) - - for _, ruleName := range rules { - // fmt.Printf("RULE: %s\n", ruleName) - switch rule := ((*rulesheet.Rules)[ruleName]).(type) { - case string: - fmt.Fprintf(rulesBuffer, "%s = %s\n", ruleName, rule) - case []interface{}: - for _, entry := range rule { - err := printRule(entry, rulesBuffer, ruleName, true) - if err != nil { - log.Errorf("Failed marshal rule: %v", err) - return err - } - } - case interface{}: - err := printRule(rule, rulesBuffer, ruleName, false) - if err != nil { - log.Errorf("Failed marshal rule: %v", err) - return err - } - default: - fmt.Fprintf(rulesBuffer, "DEFAULT %s = %s\n", ruleName, reflect.TypeOf(rule)) - } + content, err = json.MarshalIndent(rulesheet.Rules, "", " ") + if err != nil { + log.Errorf("Failed to marshal parameters: %v", err) + return err } - - // fmt.Printf("RULES: %s\n", rulesBuffer.String()) - - commitAction, err = createOrUpdateGitlabFileCommitAction(git, proj, cfg.GitlabDefaultBranch, "rules.featws", rulesBuffer.String()) + commitAction, err = createOrUpdateGitlabFileCommitAction(git, proj, cfg.GitlabDefaultBranch, "rules.json", string(content)) if err != nil { - log.Errorf("Failed to commit rules: %v", err) + log.Errorf("Failed to commit parameters: %v", err) return err } actions = append(actions, commitAction) - // commitActionData, _ := json.Marshal(commitAction) - // fmt.Println(string(commitActionData)) - _, _, err = git.Commits.CreateCommit(proj.ID, &gitlab.CreateCommitOptions{ Branch: &cfg.GitlabDefaultBranch, CommitMessage: gitlab.String(commitMessage), @@ -241,39 +205,39 @@ func (gs *gitlabService) Save(rulesheet *dtos.Rulesheet, commitMessage string) e return err } -func printRule(rule interface{}, rulesBuffer *bytes.Buffer, ruleName string, isSliceItem bool) error { - ruleNameTag := "[%s]" - if isSliceItem { - ruleNameTag = "[" + ruleNameTag + "]" - } +// func printRule(rule interface{}, rulesBuffer *bytes.Buffer, ruleName string, isSliceItem bool) error { +// ruleNameTag := "[%s]" +// if isSliceItem { +// ruleNameTag = "[" + ruleNameTag + "]" +// } - switch r := rule.(type) { - case *dtos.Rule: - value, err := json.Marshal(r.Value) - if err != nil { - log.Errorf("Failed marshal rule value: %v", err) - return err - } - fmt.Fprintf(rulesBuffer, ruleNameTag+"\ncondition = %s\nvalue = %s\ntype = object\n\n", ruleName, r.Condition, string(value)) - case map[string]interface{}: - fmt.Fprintf(rulesBuffer, ruleNameTag+"\n", ruleName) - keys := make([]string, 0) - - for k := range r { - // fmt.Printf("RULE k: %s\n", k) - keys = append(keys, k) - } - sort.Strings(keys) - for _, k := range keys { - v := r[k] - fmt.Fprintf(rulesBuffer, "%s = %s\n", k, v) - } - fmt.Fprintf(rulesBuffer, "\n") - default: - fmt.Fprintf(rulesBuffer, "DEFAULT ENTRY %s = %s\n", ruleName, reflect.TypeOf(rule)) - } - return nil -} +// switch r := rule.(type) { +// case *dtos.Rule: +// value, err := json.Marshal(r.Value) +// if err != nil { +// log.Errorf("Failed marshal rule value: %v", err) +// return err +// } +// fmt.Fprintf(rulesBuffer, ruleNameTag+"\ncondition = %s\nvalue = %s\ntype = object\n\n", ruleName, r.Condition, string(value)) +// case map[string]interface{}: +// fmt.Fprintf(rulesBuffer, ruleNameTag+"\n", ruleName) +// keys := make([]string, 0) + +// for k := range r { +// // fmt.Printf("RULE k: %s\n", k) +// keys = append(keys, k) +// } +// sort.Strings(keys) +// for _, k := range keys { +// v := r[k] +// fmt.Fprintf(rulesBuffer, "%s = %s\n", k, v) +// } +// fmt.Fprintf(rulesBuffer, "\n") +// default: +// fmt.Fprintf(rulesBuffer, "DEFAULT ENTRY %s = %s\n", ruleName, reflect.TypeOf(rule)) +// } +// return nil +// } func createOrUpdateGitlabFileCommitAction(git *gitlab.Client, proj *gitlab.Project, ref string, filename string, content string) (*gitlab.CommitActionOptions, error) { action, err := defineCreateOrUpdateGitlabFileAction(git, proj, ref, filename) @@ -347,56 +311,70 @@ func (gs *gitlabService) Fill(rulesheet *dtos.Rulesheet) (err error) { return } - bRules, err := gitlabLoadString(git, proj, gs.cfg.GitlabDefaultBranch, "rules.featws") + bRulesJSON, err := gitlabLoadString(git, proj, gs.cfg.GitlabDefaultBranch, "rules.json") if err != nil { - log.Errorf("Failed to fetch parameters: %v", err) + log.Errorf("Failed to check rules JSON: %v", err) return } - rulesFile, err := featws.Load(bRules) - if err != nil { - log.Errorf("Failed to load featws file: %v", err) - return - } + if string(bRulesJSON) != "" { + err = gitlabLoadJSON(git, proj, gs.cfg.GitlabDefaultBranch, "rules.json", &rulesheet.Rules) + if err != nil { + log.Errorf("Failed to fetch parameters: %v", err) + return + } + } else { + bRules, err := gitlabLoadString(git, proj, gs.cfg.GitlabDefaultBranch, "rules.featws") + if err != nil { + log.Errorf("Failed to fetch parameters: %v", err) + return err + } - rules := make(map[string]interface{}) + rulesFile, err := featws.Load(bRules) + if err != nil { + log.Errorf("Failed to load featws file: %v", err) + return err + } - s := rulesFile.Section("") + rules := make(map[string]interface{}) - for _, k := range s.Keys() { - rules[k.Name()] = k.Value() - } + s := rulesFile.Section("") - for _, sname := range rulesFile.SectionStrings() { - if sname == featws.DefaultSection { - continue + for _, k := range s.Keys() { + rules[k.Name()] = k.Value() } - if sname[:1] == "[" { - continue - } - sec := make(map[string]interface{}) - for _, k := range rulesFile.Section(sname).Keys() { - sec[k.Name()] = k.Value() + + for _, sname := range rulesFile.SectionStrings() { + if sname == featws.DefaultSection { + continue + } + if sname[:1] == "[" { + continue + } + sec := make(map[string]interface{}) + for _, k := range rulesFile.Section(sname).Keys() { + sec[k.Name()] = k.Value() + } + rules[sname] = sec } - rules[sname] = sec - } - for _, aname := range rulesFile.ArrayStrings() { - a := rulesFile.Array(aname) + for _, aname := range rulesFile.ArrayStrings() { + a := rulesFile.Array(aname) - arr := make([]map[string]interface{}, 0) + arr := make([]map[string]interface{}, 0) - for _, s := range a.Sections() { - sec := make(map[string]interface{}) - for _, k := range s.Keys() { - sec[k.Name()] = k.Value() + for _, s := range a.Sections() { + sec := make(map[string]interface{}) + for _, k := range s.Keys() { + sec[k.Name()] = k.Value() + } + arr = append(arr, sec) } - arr = append(arr, sec) + rules[aname[1:len(aname)-1]] = arr } - rules[aname[1:len(aname)-1]] = arr - } - rulesheet.Rules = &rules + rulesheet.Rules = &rules + } return } diff --git a/services/gitlab_test.go b/services/gitlab_test.go index 9a9141a..6615154 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -156,7 +156,7 @@ func TestSaveTestFilesCreation(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "", rulesFeatws) + assert.Equal(t, "{}", rulesFeatws) w.Write(data) return @@ -222,7 +222,7 @@ func TestSaveTestFilesCreationWithFeatures(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "", rulesFeatws) + assert.Equal(t, "{}", rulesFeatws) w.Write(data) return @@ -288,7 +288,7 @@ func TestSaveTestFilesCreationWithParameters(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[\n {\n \"name\": \"test1\"\n },\n {\n \"name\": \"test2\"\n },\n {\n \"name\": \"test3\"\n }\n]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "", rulesFeatws) + assert.Equal(t, "{}", rulesFeatws) w.Write(data) return @@ -356,7 +356,7 @@ func TestSaveTestFilesCreationWithRuleInterface(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "[[tags]]\ncondition = test\nvalue = {\"nomeAplicativo\":\"testAplicativo\",\"textoUrlDesvio\":\"testURLdesvio\",\"textoUrlPadrao\":\"testURLpadrao\"}\ntype = object\n\n", rulesFeatws) + assert.Equal(t, "{\n \"tags\": [\n {\n \"condition\": \"test\",\n \"value\": {\n \"nomeAplicativo\": \"testAplicativo\",\n \"textoUrlDesvio\": \"testURLdesvio\",\n \"textoUrlPadrao\": \"testURLpadrao\"\n },\n \"type\": \"testType\"\n }\n ]\n}", rulesFeatws) w.Write(data) return @@ -380,8 +380,8 @@ func TestSaveTestFilesCreationWithRuleString(t *testing.T) { dto := SetupRulesheet() mappedRules := map[string]interface{}{ - "rule1": "true", - "rule2": "\"test\"", + "rule1": true, + "rule2": "test", } dto.Rules = &mappedRules @@ -412,7 +412,7 @@ func TestSaveTestFilesCreationWithRuleString(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "rule1 = true\nrule2 = \"test\"\n", rulesFeatws) + assert.Equal(t, "{\n \"rule1\": true,\n \"rule2\": \"test\"\n}", rulesFeatws) w.Write(data) return @@ -470,7 +470,7 @@ func TestSaveTestFilesCreationWithStringRule(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "test1 = test1\ntest2 = test2\ntest3 = test3\n", rulesFeatws) + assert.Equal(t, "{\n \"test1\": \"test1\",\n \"test2\": \"test2\",\n \"test3\": \"test3\"\n}", rulesFeatws) w.Write(data) return @@ -547,7 +547,7 @@ func TestSaveTestFilesCreationWithDefaultRule(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "[[tags]]\ncondition = test\nvalue = {\"NomeAplicativo\":\"testAplicativo\",\"TextoURLDesvio\":\"testURLdesvio\",\"TextoURLPadrao\":\"testURLpadrao\"}\ntype = object\n\n", rulesFeatws) + assert.Equal(t, "{\n \"tags\": [\n {\n \"condition\": \"test\",\n \"value\": {\n \"NomeAplicativo\": \"testAplicativo\",\n \"TextoURLDesvio\": \"testURLdesvio\",\n \"TextoURLPadrao\": \"testURLpadrao\"\n },\n \"type\": \"testType\"\n }\n ]\n}", rulesFeatws) w.Write(data) return @@ -609,7 +609,7 @@ func TestSaveTestFilesUpdate(t *testing.T) { parameters := c["actions"].([]interface{})[3].(map[string]interface{})["content"].(string) assert.Equal(t, "[]", parameters) rulesFeatws := c["actions"].([]interface{})[4].(map[string]interface{})["content"].(string) - assert.Equal(t, "", rulesFeatws) + assert.Equal(t, "{}", rulesFeatws) w.Write(data) return From 4edeec53249c0f2967af0f9c927bdd94571058b1 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Thu, 10 Nov 2022 12:55:09 -0300 Subject: [PATCH 38/55] Create dependent-issues.yaml --- .github/workflows/dependent-issues.yaml | 59 +++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/dependent-issues.yaml diff --git a/.github/workflows/dependent-issues.yaml b/.github/workflows/dependent-issues.yaml new file mode 100644 index 0000000..6f98d7e --- /dev/null +++ b/.github/workflows/dependent-issues.yaml @@ -0,0 +1,59 @@ +name: Dependent Issues + +on: + issues: + types: + - opened + - edited + - closed + - reopened + pull_request_target: + types: + - opened + - edited + - closed + - reopened + # Makes sure we always add status check for PRs. Useful only if + # this action is required to pass before merging. Otherwise, it + # can be removed. + - synchronize + + # Schedule a daily check. Useful if you reference cross-repository + # issues or pull requests. Otherwise, it can be removed. + schedule: + - cron: '0 0 * * *' + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: z0al/dependent-issues@v1 + env: + # (Required) The token to use to make API calls to GitHub. + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # (Optional) The token to use to make API calls to GitHub for remote repos. + GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} + + with: + # (Optional) The label to use to mark dependent issues + label: dependent + + # (Optional) Enable checking for dependencies in issues. + # Enable by setting the value to "on". Default "off" + check_issues: off + + # (Optional) Ignore dependabot PRs. + # Enable by setting the value to "on". Default "off" + ignore_dependabot: off + + # (Optional) A comma-separated list of keywords. Default + # "depends on, blocked by" + keywords: depends on, blocked by + + # (Optional) A custom comment body. It supports `{{ dependencies }}` token. + comment: > + This PR/issue depends on: + + {{ dependencies }} + + By **[Dependent Issues](https://github.com/z0al/dependent-issues)** (🤖). Happy coding! From 93e2b763e49188b0a7fb26902cc2fbc8f2056a9b Mon Sep 17 00:00:00 2001 From: EduardaCastro Date: Thu, 10 Nov 2022 16:05:34 -0300 Subject: [PATCH 39/55] feat: adding migrate dependency --- go.mod | 10 +- go.sum | 1075 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 1078 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 7fa1816..a3d447f 100644 --- a/go.mod +++ b/go.mod @@ -5,10 +5,12 @@ go 1.18 require ( github.com/bancodobrasil/gin-monitor v1.0.0-rc1 github.com/bancodobrasil/gin-telemetry v0.0.1-rc5 + github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4 github.com/bancodobrasil/healthcheck v0.0.2-rc1 github.com/gin-contrib/cors v1.3.1 github.com/gin-gonic/gin v1.7.7 github.com/go-playground/validator/v10 v10.10.1 + github.com/golang-migrate/migrate/v4 v4.15.2 github.com/gosimple/slug v1.12.0 github.com/gsdenys/healthcheck v0.0.0-20220412001953-64e5089fa0bc github.com/lestrrat-go/jwx/v2 v2.0.6 @@ -29,7 +31,6 @@ require ( github.com/KyleBanks/depth v1.2.1 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect - github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -49,7 +50,9 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/gosimple/unidecode v1.0.1 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-retryablehttp v0.6.8 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect @@ -65,7 +68,7 @@ require ( github.com/magiconair/properties v1.8.6 // indirect github.com/mailru/easyjson v0.7.6 // indirect github.com/mattn/go-isatty v0.0.14 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -87,12 +90,13 @@ require ( go.opentelemetry.io/otel v1.8.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect go.opentelemetry.io/otel/sdk v1.8.0 // indirect + go.uber.org/atomic v1.7.0 // indirect golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect golang.org/x/text v0.3.7 // indirect - golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect + golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect golang.org/x/tools v0.1.7 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.28.0 // indirect diff --git a/go.sum b/go.sum index b4b0638..cb1e68a 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= +bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -27,6 +29,7 @@ cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aD cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= @@ -36,11 +39,13 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/spanner v1.28.0/go.mod h1:7m6mtQZn/hMbMfx62ct5EWrGND4DNqkXyrmBPRS+OJo= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= @@ -48,56 +53,173 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20210715213245-6c3934b029d8/go.mod h1:CzsSbkDixRphAF5hS6wbMKq0eI6ccJRb7/A0M6JBnwg= +github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k= +github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-storage-blob-go v0.14.0/go.mod h1:SMqIBi+SuiQH32bvyjngEewEeXoPfKMgWlBDaYf6fck= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20210608223527-2377c96fe795/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= +github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= +github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= +github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= +github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= +github.com/Azure/go-autorest/autorest/adal v0.9.16/go.mod h1:tGMin8I49Yij6AQ+rvV+Xa/zwxYQB5hmsd6DkfAx2+A= +github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= +github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= +github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= +github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= +github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= +github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= +github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= +github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= +github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= +github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= +github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8= +github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= +github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= +github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= +github.com/Microsoft/hcsshim v0.8.20/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= +github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= +github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= +github.com/Microsoft/hcsshim v0.9.2/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc= +github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= +github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/agiledragon/gomonkey/v2 v2.3.1 h1:k+UnUY0EMNYUFUAQVETGY9uUTxjMdnUkP0ARyJS1zzs= github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= +github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/arrow/go/arrow v0.0.0-20210818145353-234c94e4ce64/go.mod h1:2qMFB56yOP3KzkB3PbYZ4AlUFg3a88F67TIx5lB/WwY= +github.com/apache/arrow/go/arrow v0.0.0-20211013220434-5962184e7a30/go.mod h1:Q7yQnSMnLvcXlZ8RV+jwz/6y1rQTqbX6C82SndT52Zs= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= +github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v1.8.0/go.mod h1:xEFuWz+3TYdlPRuo+CqATbeDWIWyaT5uAPwPaWtgse0= +github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= +github.com/aws/aws-sdk-go-v2/config v1.6.0/go.mod h1:TNtBVmka80lRPk5+S9ZqVfFszOQAGJJ9KbT3EM3CHNU= +github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= +github.com/aws/aws-sdk-go-v2/credentials v1.3.2/go.mod h1:PACKuTJdt6AlXvEq8rFI4eDmoqDFC5DpVKQbWysaDgM= +github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.4.0/go.mod h1:Mj/U8OpDbcVcoctrYwA2bak8k/HFPdcLzI/vaiXMwuM= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.4.0/go.mod h1:eHwXu2+uE/T6gpnYWwBwqoeqRf9IXyCcolyOWDRAErQ= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.5.4/go.mod h1:Ex7XQmbFmgFHrjUX6TN3mApKW5Hglyga+F7wZHTtYhA= +github.com/aws/aws-sdk-go-v2/internal/ini v1.2.0/go.mod h1:Q5jATQc+f1MfZp3PDMhn6ry18hGvE0i8yvbXoKbnZaE= +github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.2.2/go.mod h1:EASdTcM1lGhUe1/p4gkojHwlGJkeoRjjr1sRCzup3Is= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.3.0/go.mod h1:v8ygadNyATSm6elwJ/4gzJwcFhri9RqS8skgHKiwXPU= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.2.2/go.mod h1:NXmNI41bdEsJMrD0v9rUvbGCB5GwdBEpKvUvIY3vTFg= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.5.2/go.mod h1:QuL2Ym8BkrLmN4lUofXYq6000/i5jPjosCNK//t6gak= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.7.2/go.mod h1:np7TMuJNT83O0oDOSF8i4dF3dvGqA6hPYYo6YYkzgRA= +github.com/aws/aws-sdk-go-v2/service/s3 v1.12.0/go.mod h1:6J++A5xpo7QDsIeSqPK4UHqMSyPOCopa+zKtqAMhqVQ= +github.com/aws/aws-sdk-go-v2/service/s3 v1.16.1/go.mod h1:CQe/KvWV1AqRc65KqeJjrLzr5X2ijnFTTVzJW0VBRCI= +github.com/aws/aws-sdk-go-v2/service/sso v1.3.2/go.mod h1:J21I6kF+d/6XHVk7kp/cx9YVD2TMD2TbLwtRGVcinXo= +github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk= +github.com/aws/aws-sdk-go-v2/service/sts v1.6.1/go.mod h1:hLZ/AnkIKHLuPGjEiyghNEdvJ2PP0MgOxcmv9EBJ4xs= +github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= +github.com/aws/smithy-go v1.7.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= +github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/bancodobrasil/gin-monitor v1.0.0-rc1 h1:l98a1muGLLMQJ6BAudvL1263vj+26bOr2A7bsniPOc8= github.com/bancodobrasil/gin-monitor v1.0.0-rc1/go.mod h1:hfOEzz5YWVYU8cdyK6O5/zGy34O1lhp2/Wfo6eMCPNg= github.com/bancodobrasil/gin-telemetry v0.0.1-rc5 h1:0isKPZ3IHkINJLibI+bXEQ/ex6v/a0SAPmUCb/l2pLg= github.com/bancodobrasil/gin-telemetry v0.0.1-rc5/go.mod h1:amKV8U6OFB355twaZO92vy3GYesdTpT3esi2c13HNDI= -github.com/bancodobrasil/go-featws v0.0.0-20221010233623-acdac4e32d39 h1:9YxfUdmOA5VycHSzOeaEfiKTsfnEzbLsOC7BNWrxd94= -github.com/bancodobrasil/go-featws v0.0.0-20221010233623-acdac4e32d39/go.mod h1:hOjhXXhYmMrjninF6V6w6ZAaGvLZzWs5G+wIqH+PAX4= github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4 h1:GOmDN95lCh0VJoulLMVvDRrj+uYLoKGhSx02sFVOlpQ= github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4/go.mod h1:hOjhXXhYmMrjninF6V6w6ZAaGvLZzWs5G+wIqH+PAX4= github.com/bancodobrasil/healthcheck v0.0.2-rc1 h1:CcM4cZglmDokOtiaMSH9JokQqEQCsdtHQ2Ej0oqvTrg= github.com/bancodobrasil/healthcheck v0.0.2-rc1/go.mod h1:C/YL9OERFDjg0Xa60zP2PrWBJI1N92bXlrxIqo5GagY= +github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= +github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= +github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= +github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= +github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= +github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= +github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= +github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= +github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= +github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg= +github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= +github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= +github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -108,16 +230,180 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/cockroachdb/cockroach-go/v2 v2.1.1/go.mod h1:7NtUnP6eK+l6k483WSYNrq3Kb23bWV10IRV1TyeSpwM= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= +github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= +github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU= +github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= +github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= +github.com/containerd/btrfs v0.0.0-20201111183144-404b9149801e/go.mod h1:jg2QkJcsabfHugurUvvPhS3E08Oxiuh5W/g1ybB4e0E= +github.com/containerd/btrfs v0.0.0-20210316141732-918d888fb676/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= +github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= +github.com/containerd/cgroups v0.0.0-20190717030353-c4b9ac5c7601/go.mod h1:X9rLEHIqSf/wfK8NsPqxJmeZgW4pcfzdXITDrUSJ6uI= +github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= +github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM= +github.com/containerd/cgroups v0.0.0-20200710171044-318312a37340/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= +github.com/containerd/cgroups v0.0.0-20200824123100-0b889c03f102/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= +github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= +github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU= +github.com/containerd/cgroups v1.0.3/go.mod h1:/ofk34relqNjSGyqPrmEULrO4Sc8LJhvJmWbUCUKqj8= +github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= +github.com/containerd/console v0.0.0-20181022165439-0650fd9eeb50/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= +github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= +github.com/containerd/console v1.0.1/go.mod h1:XUsP6YE/mKtz6bxc+I8UiKKTP04qjQL4qcS3XoQ5xkw= +github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= +github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= +github.com/containerd/containerd v1.2.10/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.1-0.20191213020239-082f7e3aed57/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.0-beta.2.0.20200729163537-40b22ef07410/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.9/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7V960Tmcumvqn8Mc+pCYQ= +github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= +github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= +github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= +github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= +github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= +github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= +github.com/containerd/containerd v1.6.1 h1:oa2uY0/0G+JX4X7hpGCYvkp9FjUancz56kSNnb1sG3o= +github.com/containerd/containerd v1.6.1/go.mod h1:1nJz5xCZPusx6jJU8Frfct988y0NpumIq9ODB0kLtoE= +github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo= +github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y= +github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= +github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= +github.com/containerd/continuity v0.2.2/go.mod h1:pWygW9u7LtS1o4N/Tn0FoCFDIXZ7rxcMX7HX1Dmibvk= +github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= +github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= +github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= +github.com/containerd/fifo v0.0.0-20201026212402-0724c46b320c/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= +github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= +github.com/containerd/fifo v1.0.0/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= +github.com/containerd/go-cni v1.0.1/go.mod h1:+vUpYxKvAF72G9i1WoDOiPGRtQpqsNW/ZHtSlv++smU= +github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb1aZGrrohk= +github.com/containerd/go-cni v1.1.0/go.mod h1:Rflh2EJ/++BA2/vY5ao3K6WJRR/bZKsX123aPk+kUtA= +github.com/containerd/go-cni v1.1.3/go.mod h1:Rflh2EJ/++BA2/vY5ao3K6WJRR/bZKsX123aPk+kUtA= +github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= +github.com/containerd/go-runc v0.0.0-20190911050354-e029b79d8cda/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= +github.com/containerd/go-runc v0.0.0-20200220073739-7016d3ce2328/go.mod h1:PpyHrqVs8FTi9vpyHwPwiNEGaACDxT/N/pLcvMSRA9g= +github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= +github.com/containerd/go-runc v1.0.0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= +github.com/containerd/imgcrypt v1.0.1/go.mod h1:mdd8cEPW7TPgNG4FpuP3sGBiQ7Yi/zak9TYCG3juvb0= +github.com/containerd/imgcrypt v1.0.4-0.20210301171431-0ae5c75f59ba/go.mod h1:6TNsg0ctmizkrOgXRNQjAPFWpMYRWuiB6dSF4Pfa5SA= +github.com/containerd/imgcrypt v1.1.1-0.20210312161619-7ed62a527887/go.mod h1:5AZJNI6sLHJljKuI9IHnw1pWqo/F0nGDOuR9zgTs7ow= +github.com/containerd/imgcrypt v1.1.1/go.mod h1:xpLnwiQmEUJPvQoAapeb2SNCxz7Xr6PJrXQb0Dpc4ms= +github.com/containerd/imgcrypt v1.1.3/go.mod h1:/TPA1GIDXMzbj01yd8pIbQiLdQxed5ue1wb8bP7PQu4= +github.com/containerd/nri v0.0.0-20201007170849-eb1350a75164/go.mod h1:+2wGSDGFYfE5+So4M5syatU0N0f0LbWpuqyMi4/BE8c= +github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= +github.com/containerd/nri v0.1.0/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= +github.com/containerd/stargz-snapshotter/estargz v0.4.1/go.mod h1:x7Q9dg9QYb4+ELgxmo4gBUeJB0tl5dqH1Sdz0nJU1QM= +github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= +github.com/containerd/ttrpc v0.0.0-20190828172938-92c8520ef9f8/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= +github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c/go.mod h1:LPm1u0xBw8r8NOKoOdNMeVHSawSsltak+Ihv+etqsE8= +github.com/containerd/ttrpc v1.0.1/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= +github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= +github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ= +github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= +github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk= +github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg= +github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= +github.com/containerd/zfs v0.0.0-20200918131355-0a33824f23a2/go.mod h1:8IgZOBdv8fAgXddBT4dBXJPtxyRsejFIpXoklgxgEjw= +github.com/containerd/zfs v0.0.0-20210301145711-11e8f1707f62/go.mod h1:A9zfAbMlQwE+/is6hi0Xw8ktpL+6glmqZYtevJgaB8Y= +github.com/containerd/zfs v0.0.0-20210315114300-dde8f0fda960/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= +github.com/containerd/zfs v0.0.0-20210324211415-d5c4544f0433/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= +github.com/containerd/zfs v1.0.0/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= +github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= +github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= +github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= +github.com/containernetworking/cni v1.0.1/go.mod h1:AKuhXbN5EzmD4yTNtfSsX3tPcmtrBI6QcRV0NiNt15Y= +github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM= +github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8= +github.com/containernetworking/plugins v1.0.1/go.mod h1:QHCfGpaTwYTbbH+nZXKVTxNBDZcxSOplJT5ico8/FLE= +github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc= +github.com/containers/ocicrypt v1.1.0/go.mod h1:b8AOe0YR67uU8OqfVNcznfFpAzu3rdgUV4GP9qXPfu4= +github.com/containers/ocicrypt v1.1.1/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= +github.com/containers/ocicrypt v1.1.2/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= +github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= +github.com/coreos/go-iptables v0.6.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q= +github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= +github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= +github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= +github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= +github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= +github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= +github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= +github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= +github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= +github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dhui/dktest v0.3.10 h1:0frpeeoM9pHouHjhLeZDuDTJ0PqjDTrycaHaMmkJAo8= +github.com/dhui/dktest v0.3.10/go.mod h1:h5Enh0nG3Qbo9WjNFRrwmKUaePEBhXMOygbz3Ww7Sz0= +github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= +github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.13+incompatible h1:5s7uxnKZG+b8hYWlPYUi6x1Sjpq2MSt96d15eLZeHyw= +github.com/docker/docker v20.10.13+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= +github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= +github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= +github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= +github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= +github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -129,12 +415,30 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= +github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw= +github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= +github.com/gabriel-vasile/mimetype v1.3.1/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= +github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= +github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= +github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= +github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/cors v1.3.1 h1:doAsuITavI4IOcd0Y19U4B+O0dNWihRyX//nn4sEmgA= github.com/gin-contrib/cors v1.3.1/go.mod h1:jjEJ4268OPZUcU7k9Pm653S7lXUGcqMADzFA61xsmDk= @@ -146,30 +450,53 @@ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmC github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs= github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= +github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= +github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= +github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= +github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= +github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= @@ -186,15 +513,66 @@ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GO github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-playground/validator/v10 v10.10.1 h1:uA0+amWMiglNZKZ9FJRKUAe9U3RX91eVn1JYXMWt7ig= github.com/go-playground/validator/v10 v10.10.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= +github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= +github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= +github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= +github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= +github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= +github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= +github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= +github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= +github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= +github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= +github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= +github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM= +github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= +github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= +github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/gocql/gocql v0.0.0-20210515062232-b7ef815b4556/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY= +github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU= +github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-migrate/migrate/v4 v4.15.2 h1:vU+M05vs6jWHKDdmE1Ecwj0BznygFc4QsdRe2E/L7kc= +github.com/golang-migrate/migrate/v4 v4.15.2/go.mod h1:f2toGLkYqD3JH+Todi4aZ2ZdbeUNx4sIwiOK96rE9Lw= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -208,6 +586,7 @@ github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -226,9 +605,14 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/flatbuffers v2.0.0+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -244,9 +628,14 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0= +github.com/google/go-github/v39 v39.2.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -267,23 +656,51 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= +github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= +github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= +github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= +github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gosimple/slug v1.12.0 h1:xzuhj7G7cGtd34NXnW/yF0l+AGNfWqwgh/IXgFy7dnc= github.com/gosimple/slug v1.12.0/go.mod h1:UiRaFH+GEilHstLUmcBgWcI42viBN7mAb818JrYOeFQ= github.com/gosimple/unidecode v1.0.1 h1:hZzFTMMqSswvf0LBJZCZgThIZrpDHFXux9KeGmn6T/o= github.com/gosimple/unidecode v1.0.1/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsdenys/healthcheck v0.0.0-20220412001953-64e5089fa0bc h1:+e9Mzex/kDzm5O9jOsVDwuWfLXBVEbHBIAjkfuzi6vA= github.com/gsdenys/healthcheck v0.0.0-20220412001953-64e5089fa0bc/go.mod h1:/UTGzC0R4heMzz69zVkcx36w4RqQ23kFdyY7H5TICK4= +github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= +github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -295,33 +712,106 @@ github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXc github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-retryablehttp v0.6.8 h1:92lWxgpa+fF3FozM4B3UZtHZMJX8T5XT+TFdCxsPyWs= github.com/hashicorp/go-retryablehttp v0.6.8/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/intel/goresctrl v0.2.0/go.mod h1:+CZdzouYFn5EsxgqAQTEzMfwKwuc0fVdMrT9FCCAVRQ= +github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= +github.com/j-keck/arping v1.0.2/go.mod h1:aJbELhR92bSk7tp79AWM/ftfc90EfEi2bQJrbBFOsPw= +github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= +github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= +github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= +github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= +github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5lahk= +github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= +github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= +github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= +github.com/jackc/pgerrcode v0.0.0-20201024163028-a0d42d470451/go.mod h1:a/s9Lp5W7n/DD0VrVoyJ00FbP2ytTPDVOivvn2bMlds= +github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= +github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.0.7/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= +github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= +github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= +github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0= +github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po= +github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ= +github.com/jackc/pgtype v1.6.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= +github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= +github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= +github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= +github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXgo+kA= +github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o= +github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= +github.com/jackc/pgx/v4 v4.10.1/go.mod h1:QlrWebbs3kqEZPHCTGyxecvzG6tvIsYu+A5b1raylkA= +github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= +github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= +github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -337,9 +827,26 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/k0kubun/pp v2.3.0+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= +github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= +github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -349,9 +856,12 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4= github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= @@ -368,21 +878,43 @@ github.com/lestrrat-go/jwx/v2 v2.0.6 h1:RlyYNLV892Ed7+FTfj1ROoF6x7WxL965PGTHso/6 github.com/lestrrat-go/jwx/v2 v2.0.6/go.mod h1:aVrGuwEr3cp2Prw6TtQvr8sQxe+84gruID5C9TxT64Q= github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.0 h1:Zx5DJFEYQXio93kgXnQ09fXNiUKsqv4OUEu2UtGcB1E= +github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/pkger v0.15.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= @@ -390,17 +922,47 @@ github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOA github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= +github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= +github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= +github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= +github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= +github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= +github.com/moby/sys/signal v0.6.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg= +github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= +github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs= +github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= +github.com/moby/term v0.0.0-20210610120745-9d4ed1856297/go.mod h1:vgPCkQMyxTZ7IDy8SXRufE172gr8+K/JE/7hHFxHW3A= +github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 h1:dcztxKSvZ4Id8iPpHERQBbIJfabdt4wUm5qy3wOL2Zc= +github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -408,9 +970,75 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mutecomm/go-sqlcipher/v4 v4.4.0/go.mod h1:PyN04SaWalavxRGH9E8ZftG6Ju7rsPrGmQRjrEaVpiY= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA= +github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= +github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba/go.mod h1:ncO5VaFWh0Nrt+4KT4mOZboaczBZcLuHrG+/sUeP8gI= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= +github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= +github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2-0.20211117181255-693428a734f5/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= +github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= +github.com/opencontainers/runc v1.1.0/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= +github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= +github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= +github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= +github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= +github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -419,13 +1047,26 @@ github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT9 github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= +github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= github.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= +github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pierrec/lz4/v4 v4.1.8/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= @@ -433,68 +1074,133 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= +github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.33.0 h1:rHgav/0a6+uYgGdNt3jwz8FNSesO/Hsang3O0T9A5SE= github.com/prometheus/common v0.33.0/go.mod h1:gB3sOl7P0TvJabZpLY5uQMpUqRCPPCyRLCZYc7JZTNE= +github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= +github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= +github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= +github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= +github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snowflakedb/gosnowflake v1.6.3/go.mod h1:6hLajn6yxuJ4xUHZegMekpq9rnQbGJ7TMwXjgTmA6lg= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= +github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -511,9 +1217,19 @@ github.com/swaggo/gin-swagger v1.4.2 h1:qDs1YrBOTnurDG/JVMc8678KhoS1B1okQGPtIqVz github.com/swaggo/gin-swagger v1.4.2/go.mod h1:hmJ1vPn+XjUvnbzjCdUAxVqgraxELxk8x5zAsjCE5mg= github.com/swaggo/swag v1.7.9 h1:6vCG5mm43ebDzGlZPMGYrYI4zKFfOr5kicQX8qjeDwc= github.com/swaggo/swag v1.7.9/go.mod h1:gZ+TJ2w/Ve1RwQsA2IRoSOTidHz6DX+PIG8GWvbnoLU= +github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/toorop/gin-logrus v0.0.0-20210225092905-2c785434f26f h1:oqdnd6OGlOUu1InG37hWcCB3a+Jy3fwjylyVboaNMwY= github.com/toorop/gin-logrus v0.0.0-20210225092905-2c785434f26f/go.mod h1:X3Dd1SB8Gt1V968NTzpKFjMM6O8ccta2NPC6MprOxZQ= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= @@ -523,18 +1239,61 @@ github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.15 h1:KSd3yYV2fk04D1cu github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.15/go.mod h1:h9Fha0tfy6Bo4Zvalrd1c1MiE2QvD8DFxZ5rD1hDJcY= github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.15 h1:5eYO+onNB1mbdc3+uw6r+yNFFEzqR6sm8sj7zcrjrAs= github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.15/go.mod h1:6fGFPZDTcvHLxgWTFvf8hHWQrRO1tMXAFlxlqE+c650= +github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= +github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= +github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= +github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= +github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= +github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= +github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= +github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= +github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= +github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs= github.com/xanzy/go-gitlab v0.63.0 h1:a9fXpKWykUS6dowapFej/2Wjf4aOAEFC1q2ZIcz4IpI= github.com/xanzy/go-gitlab v0.63.0/go.mod h1:F0QEXwmqiBUxCgJm8fE9S+1veX4XC9Z4cfaAbqwk4YM= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= +github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= +github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= +github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= +go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= +go.etcd.io/etcd/pkg/v3 v3.5.0/go.mod h1:UzJGatBQ1lXChBkQF0AuAtkRQMYnHubxAEYIrC3MSsE= +go.etcd.io/etcd/raft/v3 v3.5.0/go.mod h1:UFOHSIvO/nKwd4lhkwabrTD3cqW5yVyYYf/KlD00Szc= +go.etcd.io/etcd/server/v3 v3.5.0/go.mod h1:3Ah5ruV+M+7RZr0+Y/5mNLwC+eQlni+mQmOVdCRJoS4= +go.mongodb.org/mongo-driver v1.7.0/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8= +go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -542,51 +1301,110 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/contrib v0.20.0 h1:ubFQUn0VCZ0gPwIoJfBJVpeBlyRMxu8Mm/huKWYd9p0= +go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.28.0/go.mod h1:vEhqr0m4eTc+DWxfsXoXue2GBgV2uUwVznkGIHW/e5w= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4= go.opentelemetry.io/contrib/propagators/b3 v1.6.0 h1:rHeNbko1wNe1Sazpw5IJD83x43lfzMnDb8vckdKxRu8= go.opentelemetry.io/contrib/propagators/b3 v1.6.0/go.mod h1:6kJAkL2/nNqP9AYhm/8j4dzVU8BfpcvYr2cy25RGBak= +go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= go.opentelemetry.io/otel v1.0.1/go.mod h1:OPEOD4jIT2SlZPMmwT6FqZz2C0ZNdQqiWcoK6M0SNFU= +go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs= go.opentelemetry.io/otel v1.6.1/go.mod h1:blzUabWHkX6LJewxvadmzafgh/wnvBSDBdOuwkAtrWQ= go.opentelemetry.io/otel v1.8.0 h1:zcvBFizPbpa1q7FehvFiHbQwGzmPILebO0tyqIR5Djg= go.opentelemetry.io/otel v1.8.0/go.mod h1:2pkj+iMj0o03Y+cW6/m8Y4WkRdYN3AvCXCnzRMp9yvM= go.opentelemetry.io/otel/exporters/jaeger v1.8.0 h1:TLLqD6kDhLPziEC7pgPrMvP9lAqdk3n1gf8DiFSnfW8= go.opentelemetry.io/otel/exporters/jaeger v1.8.0/go.mod h1:GbWg+ng88rDtx+id26C34QLqw2erqJeAjsCx9AFeHfE= +go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0/go.mod h1:hO1KLR7jcKaDDKDkvI9dP/FIhpmna5lkqPUQdEjFAM8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0/go.mod h1:keUU7UfnwWTWpJ+FWnyqmogPa82nuU5VUANFq49hlMY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0/go.mod h1:QNX1aly8ehqqX1LEa6YniTU7VY9I6R3X/oPxhGdTceE= +go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= +go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= +go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= go.opentelemetry.io/otel/sdk v1.0.1/go.mod h1:HrdXne+BiwsOHYYkBE5ysIcv2bvdZstxzmCQhxTcZkI= +go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs= go.opentelemetry.io/otel/sdk v1.8.0 h1:xwu69/fNuwbSHWe/0PGS888RmjWY181OmcXDQKu7ZQk= go.opentelemetry.io/otel/sdk v1.8.0/go.mod h1:uPSfc+yfDH2StDM/Rm35WE8gXSNdvCg023J6HeGNO0c= +go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE= +go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE= +go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= go.opentelemetry.io/otel/trace v1.0.1/go.mod h1:5g4i4fKLaX2BQpSBsxw8YYcgKpMMSW3x7ZTuYBr3sUk= +go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk= go.opentelemetry.io/otel/trace v1.6.1/go.mod h1:RkFRM1m0puWIq10oxImnGEduNBzxiN7TXluRBtE+5j0= go.opentelemetry.io/otel/trace v1.8.0 h1:cSy0DF9eGI5WIfNwZ1q2iUyGj00tGzP24dE1lOlHrfY= go.opentelemetry.io/otel/trace v1.8.0/go.mod h1:0Bt3PXY8w+3pheS3hQUt+wow8b1ojPaTBoTCh2zIFI4= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -612,21 +1430,35 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0 h1:UG21uOlmZabA4fW5i7ZX6bjw1xELEGg/ZLgZq9auk/Q= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190225153610-fe579d43d832/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -637,13 +1469,16 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -652,16 +1487,26 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -685,6 +1530,7 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -692,35 +1538,61 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190812073006-9eafafc0a87e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191112214154-59a1497f0cea/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -728,50 +1600,81 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -783,27 +1686,52 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 h1:M73Iuj3xbbb9Uk1DYhzydthsj6oOd6l9bpuFcNoUvTs= +golang.org/x/time v0.0.0-20220224211638-0e9765cccd65/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -823,17 +1751,22 @@ golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjs golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200616133436-c1934b75d054/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -845,11 +1778,20 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +gonum.org/v1/plot v0.9.0/go.mod h1:3Pcqqmp6RHvJI72kgb8fThyUnav364FOsdDo2aGW5lY= +google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -881,8 +1823,11 @@ google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqiv google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/appengine v1.0.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= @@ -890,11 +1835,13 @@ google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190522204451-c2c4e71fbf69/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= @@ -903,6 +1850,7 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200117163144-32f20d992d24/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -911,17 +1859,21 @@ google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -937,6 +1889,7 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= @@ -951,12 +1904,21 @@ google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac h1:qSNTkEN+L2mvWcLgJOR+8bdHX9rN/IdU3A1Ghpfb1Rg= +google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -979,7 +1941,10 @@ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -997,24 +1962,40 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0 h1:FVCohIoYO7IJoDDVpV2pdq7SgrMH6wHnuTyrdrxJNoY= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= @@ -1026,9 +2007,16 @@ 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/mysql v1.3.3 h1:jXG9ANrwBc4+bMvBcSl8zCfPBaVoPyBEBshA8dA93X8= gorm.io/driver/mysql v1.3.3/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= +gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= +gorm.io/gorm v1.20.12/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gorm.io/gorm v1.21.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.5 h1:TnlF26wScKSvknUC/Rn8t0NLLM22fypYBlvj1+aH6dM= gorm.io/gorm v1.23.5/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= +gotest.tools/v3 v3.1.0/go.mod h1:fHy7eyTmJFO5bQbUsEGQ1v4m2J3Jz9eWL54TP2/ZuYQ= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1036,6 +2024,85 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= +k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= +k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= +k8s.io/api v0.22.5/go.mod h1:mEhXyLaSD1qTOf40rRiKXkc+2iCem09rWLlFwhCEiAs= +k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= +k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= +k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= +k8s.io/apimachinery v0.22.1/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= +k8s.io/apimachinery v0.22.5/go.mod h1:xziclGKwuuJ2RM5/rSFQSYAj0zdbci3DH8kj+WvyN0U= +k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= +k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= +k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= +k8s.io/apiserver v0.22.5/go.mod h1:s2WbtgZAkTKt679sYtSudEQrTGWUSQAPe6MupLnlmaQ= +k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= +k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= +k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= +k8s.io/client-go v0.22.5/go.mod h1:cs6yf/61q2T1SdQL5Rdcjg9J1ElXSwbjSrW2vFImM4Y= +k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NIla0= +k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= +k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= +k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= +k8s.io/component-base v0.22.5/go.mod h1:VK3I+TjuF9eaa+Ln67dKxhGar5ynVbwnGrUiNF4MqCI= +k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= +k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= +k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= +k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= +k8s.io/cri-api v0.23.1/go.mod h1:REJE3PSU0h/LOV1APBrupxrEJqnoxZC8KWzkBUHwrK4= +k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20201113003025-83324d819ded/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= +k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= +k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= +k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= +k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= +k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= +k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= +k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +modernc.org/b v1.0.0/go.mod h1:uZWcZfRj1BpYzfN9JTerzlNUnnPsV9O2ZA8JsRcubNg= +modernc.org/cc/v3 v3.32.4/go.mod h1:0R6jl1aZlIl2avnYfbfHBS1QB6/f+16mihBObaBC878= +modernc.org/ccgo/v3 v3.9.2/go.mod h1:gnJpy6NIVqkETT+L5zPsQFj7L2kkhfPMzOghRNv/CFo= +modernc.org/db v1.0.0/go.mod h1:kYD/cO29L/29RM0hXYl4i3+Q5VojL31kTUVpVJDw0s8= +modernc.org/file v1.0.0/go.mod h1:uqEokAEn1u6e+J45e54dsEA/pw4o7zLrA2GwyntZzjw= +modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8= +modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= +modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= +modernc.org/internal v1.0.0/go.mod h1:VUD/+JAkhCpvkUitlEOnhpVxCgsBI90oTzSCRcqQVSM= +modernc.org/libc v1.7.13-0.20210308123627-12f642a52bb8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= +modernc.org/libc v1.9.5/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= +modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8= +modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= +modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= +modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= +modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc= +modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= +modernc.org/ql v1.0.0/go.mod h1:xGVyrLIatPcO2C1JvI/Co8c0sr6y91HKFNy4pt9JXEY= +modernc.org/sortutil v1.1.0/go.mod h1:ZyL98OQHJgH9IEfN71VsamvJgrtRX9Dj2gX+vH86L1k= +modernc.org/sqlite v1.10.6/go.mod h1:Z9FEjUtZP4qFEg6/SiADg9XCER7aYy9a/j7Pg9P7CPs= +modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= +modernc.org/tcl v1.5.2/go.mod h1:pmJYOLgpiys3oI4AeAafkcUfE+TKKilminxNyU/+Zlo= +modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= +modernc.org/z v1.0.1-0.20210308123920-1f282aa71362/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA= +modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA= +modernc.org/zappy v1.0.0/go.mod h1:hHe+oGahLVII/aTTyWK/b53VDHMAGCBYYeZ9sn83HC4= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= +sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= From d1713f4ff478859e8e77db7f5d11ad01f6aafadc Mon Sep 17 00:00:00 2001 From: EduardaCastro Date: Thu, 10 Nov 2022 16:23:10 -0300 Subject: [PATCH 40/55] feat: migrate command. --- Makefile | 8 +++++++- config/config.go | 6 ++++-- main.go | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b12b766..d29a396 100644 --- a/Makefile +++ b/Makefile @@ -37,4 +37,10 @@ generate-mocks: generate-swagger: # Install swag on https://github.com/swaggo/swag - swag i \ No newline at end of file + swag i + +migrate-up: + MIGRATE=up make run + +migrate-down: + MIGRATE=down make run \ No newline at end of file diff --git a/config/config.go b/config/config.go index ee51989..dd2caf5 100644 --- a/config/config.go +++ b/config/config.go @@ -7,11 +7,12 @@ import ( "github.com/spf13/viper" ) -//Config ... +// Config ... type Config struct { AllowOrigins string `mapstructure:"ALLOW_ORIGINS"` Port string `mapstructure:"PORT"` MysqlURI string `mapstructure:"FEATWS_API_MYSQL_URI"` + Migrate string `mapstructure:"MIGRATE"` GitlabToken string `mapstructure:"FEATWS_API_GITLAB_TOKEN"` GitlabURL string `mapstructure:"FEATWS_API_GITLAB_URL"` GitlabNamespace string `mapstructure:"FEATWS_API_GITLAB_NAMESPACE"` @@ -25,7 +26,7 @@ type Config struct { var config = &Config{} -//LoadConfig ... +// LoadConfig ... func LoadConfig() (err error) { viper.AddConfigPath("./") viper.SetConfigFile(".env") @@ -43,6 +44,7 @@ func LoadConfig() (err error) { viper.SetDefault("FEATWS_API_GITLAB_DEFAULT_BRANCH", "main") viper.SetDefault("FEATWS_API_GITLAB_CI_SCRIPT", "") viper.SetDefault("EXTERNAL_HOST", "localhost:9007") + viper.SetDefault("MIGRATE", "") viper.SetDefault("OPENAM_URL", "") viper.SetDefault("FEATWS_API_AUTH_MODE", "none") diff --git a/main.go b/main.go index 6463582..f607146 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "os" + "strconv" "strings" "github.com/bancodobrasil/featws-api/config" @@ -12,6 +13,9 @@ import ( ginMonitor "github.com/bancodobrasil/gin-monitor" "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" + "github.com/golang-migrate/migrate/v4" + _ "github.com/golang-migrate/migrate/v4/database/mysql" + _ "github.com/golang-migrate/migrate/v4/source/file" "github.com/prometheus/client_golang/prometheus/promhttp" log "github.com/sirupsen/logrus" ginlogrus "github.com/toorop/gin-logrus" @@ -69,6 +73,43 @@ func main() { database.ConnectDB() + isCmd := false + + if cfg.Migrate != "" { + isCmd = true + log.Debug("Migrating database...") + m, err := migrate.New( + "file://database/migrations/", + "mysql://"+cfg.MysqlURI, + ) + if err != nil { + log.Fatalf("Migration failed with error: %v", err) + os.Exit(1) + } + if strings.ToLower(cfg.Migrate) == "up" { + if err := m.Up(); err != nil { + if err.Error() == "no change" { + log.Println("No change made by migration scripts") + } else { + log.Fatalf("Migration Up failed with error: %v", err) + os.Exit(1) + } + } + } else if strings.ToLower(cfg.Migrate) == "down" { + if err := m.Down(); err != nil { + log.Fatalf("Migration Down failed with error: %v", err) + os.Exit(1) + } + } else if steps, err := strconv.Atoi(cfg.Migrate); err == nil { + m.Steps(steps) + } + } + + if isCmd == true { + log.Debug("Finished Successfully") + os.Exit(0) + } + monitor, err := ginMonitor.New("v1.0.0", ginMonitor.DefaultErrorMessageKey, ginMonitor.DefaultBuckets) if err != nil { log.Panic(err) From f6e7e48a6a887e82deb77688551d668f43b9460e Mon Sep 17 00:00:00 2001 From: EduardaCastro Date: Thu, 10 Nov 2022 16:40:10 -0300 Subject: [PATCH 41/55] feat: migration duplicated names --- database/migrations/1_update_rulesheet_duplicated_names.down.sql | 0 database/migrations/1_update_rulesheet_duplicated_names.up.sql | 1 + 2 files changed, 1 insertion(+) create mode 100644 database/migrations/1_update_rulesheet_duplicated_names.down.sql create mode 100644 database/migrations/1_update_rulesheet_duplicated_names.up.sql diff --git a/database/migrations/1_update_rulesheet_duplicated_names.down.sql b/database/migrations/1_update_rulesheet_duplicated_names.down.sql new file mode 100644 index 0000000..e69de29 diff --git a/database/migrations/1_update_rulesheet_duplicated_names.up.sql b/database/migrations/1_update_rulesheet_duplicated_names.up.sql new file mode 100644 index 0000000..76cf1b2 --- /dev/null +++ b/database/migrations/1_update_rulesheet_duplicated_names.up.sql @@ -0,0 +1 @@ +UPDATE rulesheets AS r SET name = concat(r.name, concat("-deleted-", r.id)) WHERE r.deleted_at IS NOT NULL and name not like "%-deleted-%"; From 3fcc31f7a503fb77de875f298b23596ba78ee1d8 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 11 Nov 2022 11:30:56 -0300 Subject: [PATCH 42/55] feat: include fill JSON test --- services/gitlab_test.go | 121 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/services/gitlab_test.go b/services/gitlab_test.go index 6615154..447d638 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -751,6 +751,127 @@ func TestFill(t *testing.T) { } } +func TestFillJSON(t *testing.T) { + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste", "path":"testpath"}`)) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/testpath/prefix-Test" { + w.Write([]byte(`{"id":1,"description":"testeDesc","name":"teste"}`)) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/rules.json" { + content := base64.StdEncoding.EncodeToString([]byte("{\"regra\": \"$test\"")) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/parameters.json" { + content := base64.StdEncoding.EncodeToString([]byte(`[ + { + "name": "param1", + "type": "string" + }, + { + "name": "param2", + "type": "string" + } + ]`)) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/features.json" { + content := base64.StdEncoding.EncodeToString([]byte(`[ + { + "name": "feat1", + "type": "string" + }, + { + "name": "feat2", + "type": "string" + } + ]`)) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := SetupConfig(s) + + ngl := services.NewGitlab(cfg) + ngl.Connect() + dto := SetupRulesheet() + err := ngl.Fill(dto) + if err != nil { + t.Errorf("unexpected error on fill: %s", err.Error()) + return + } + + if (*dto.Rules)["regra"].(string) != "$test" { + t.Error("error on unmarshalling rules") + return + } + + if (dto.Parameters) == nil || len(*dto.Parameters) != 2 { + t.Error("error on unmarshalling parameters") + return + } + + param1 := (*dto.Parameters)[0] + if param1["name"] != "param1" || param1["type"] != "string" { + t.Error("error on unmarshalling parameter 1") + return + } + + param2 := (*dto.Parameters)[1] + if param2["name"] != "param2" || param1["type"] != "string" { + t.Error("error on unmarshalling parameter 2") + return + } + + if (dto.Features) == nil || len(*dto.Features) != 2 { + t.Error("error on unmarshalling Features") + return + } + + feat1 := (*dto.Features)[0] + if feat1["name"] != "feat1" || feat1["type"] != "string" { + t.Error("error on unmarshalling Feature 1") + return + } + + feat2 := (*dto.Features)[1] + if feat2["name"] != "feat2" || param1["type"] != "string" { + t.Error("error on unmarshalling Feature 2") + return + } +} + // Functions to test fill function func TestFillRulesSlices(t *testing.T) { dto := SetupRulesheet() From ffa53eb7129c22d1f0c78ed1620d45432dc893a6 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 11 Nov 2022 13:40:40 -0300 Subject: [PATCH 43/55] feat: add support to db transactions --- go.mod | 31 ++++--- go.sum | 43 ++++++++++ mocks/repository/Repository.go | 146 ++++++++++++++++++++++++++++++++- mocks/repository/Rulesheets.go | 146 ++++++++++++++++++++++++++++++++- repository/repository.go | 61 +++++++++++--- 5 files changed, 401 insertions(+), 26 deletions(-) diff --git a/go.mod b/go.mod index 7fa1816..9c8eab1 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/lestrrat-go/jwx/v2 v2.0.6 github.com/prometheus/client_golang v1.12.1 github.com/sirupsen/logrus v1.9.0 - github.com/spf13/viper v1.11.0 + github.com/spf13/viper v1.12.0 github.com/stretchr/testify v1.8.0 github.com/swaggo/gin-swagger v1.4.2 github.com/swaggo/swag v1.7.9 @@ -34,7 +34,7 @@ require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect - github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -52,6 +52,7 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.6.8 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -64,39 +65,47 @@ require ( github.com/lestrrat-go/option v1.0.0 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mailru/easyjson v0.7.6 // indirect + github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/pelletier/go-toml v1.9.4 // indirect - github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.2 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.33.0 // indirect github.com/prometheus/procfs v0.7.3 // indirect + github.com/rs/zerolog v1.27.0 // indirect github.com/spf13/afero v1.8.2 // indirect - github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/cast v1.5.0 // indirect + github.com/spf13/cobra v1.4.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.4.0 // indirect - github.com/subosito/gotenv v1.2.0 // indirect + github.com/subosito/gotenv v1.4.0 // indirect github.com/ugorji/go/codec v1.2.7 // indirect github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.15 // indirect github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.15 // indirect + github.com/vektra/mockery/v2 v2.14.1 // indirect go.opentelemetry.io/otel v1.8.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect go.opentelemetry.io/otel/sdk v1.8.0 // indirect - golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect - golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect + golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect + golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect + golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect - golang.org/x/tools v0.1.7 // indirect + golang.org/x/tools v0.1.11 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.28.0 // indirect - gopkg.in/ini.v1 v1.66.4 // indirect + gopkg.in/ini.v1 v1.66.6 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index b4b0638..b875480 100644 --- a/go.sum +++ b/go.sum @@ -110,7 +110,9 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -135,6 +137,8 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/cors v1.3.1 h1:doAsuITavI4IOcd0Y19U4B+O0dNWihRyX//nn4sEmgA= github.com/gin-contrib/cors v1.3.1/go.mod h1:jjEJ4268OPZUcU7k9Pm653S7lXUGcqMADzFA61xsmDk= @@ -317,6 +321,8 @@ github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpT github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= @@ -395,12 +401,15 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -421,11 +430,16 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= github.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= +github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= @@ -465,7 +479,11 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.27.0 h1:1T7qCieN22GVc8S4Q2yuexzBb1EqjbgjSH9RohbMjKs= +github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -484,6 +502,10 @@ github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -491,6 +513,8 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= +github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= @@ -502,10 +526,13 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/subosito/gotenv v1.4.0 h1:yAzM1+SmVcz5R4tXGsNMu1jUl2aOJXoiWUCEwwnGrvs= +github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= github.com/swaggo/gin-swagger v1.4.2 h1:qDs1YrBOTnurDG/JVMc8678KhoS1B1okQGPtIqVz4YU= github.com/swaggo/gin-swagger v1.4.2/go.mod h1:hmJ1vPn+XjUvnbzjCdUAxVqgraxELxk8x5zAsjCE5mg= @@ -524,6 +551,8 @@ github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.15/go.mod h1:h9Fha0tfy github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.15 h1:5eYO+onNB1mbdc3+uw6r+yNFFEzqR6sm8sj7zcrjrAs= github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.15/go.mod h1:6fGFPZDTcvHLxgWTFvf8hHWQrRO1tMXAFlxlqE+c650= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/vektra/mockery/v2 v2.14.1 h1:Xamr4zUkFBDGdZhJ6iCiJ1AwkGRmUgZd8zkwjRXt+TU= +github.com/vektra/mockery/v2 v2.14.1/go.mod h1:bnD1T8tExSgPD1ripLkDbr60JA9VtQeu12P3wgLZd7M= github.com/xanzy/go-gitlab v0.63.0 h1:a9fXpKWykUS6dowapFej/2Wjf4aOAEFC1q2ZIcz4IpI= github.com/xanzy/go-gitlab v0.63.0/go.mod h1:F0QEXwmqiBUxCgJm8fE9S+1veX4XC9Z4cfaAbqwk4YM= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -575,6 +604,8 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -612,6 +643,8 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0 h1:UG21uOlmZabA4fW5i7ZX6bjw1xELEGg/ZLgZq9auk/Q= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -661,6 +694,8 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -768,11 +803,14 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 h1:CBpWXWQpIRjzmkkA+M7q9Fqnwd2mZr3AFqexg8YTfoM= +golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -845,11 +883,14 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/tools v0.1.11 h1:loJ25fNOEhSXfHrpoGj91eCUThwdNX6u24rO1xnNteY= +golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df h1:5Pf6pFKu98ODmgnpvkJ3kFUOQGGLIzLIkbzUHp47618= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1010,6 +1051,8 @@ gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWd gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI= +gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/mocks/repository/Repository.go b/mocks/repository/Repository.go index 630916b..bf04fe1 100644 --- a/mocks/repository/Repository.go +++ b/mocks/repository/Repository.go @@ -5,8 +5,11 @@ package mocks import ( context "context" - repository "github.com/bancodobrasil/featws-api/repository" + gorm "gorm.io/gorm" + mock "github.com/stretchr/testify/mock" + + repository "github.com/bancodobrasil/featws-api/repository" ) // Repository is an autogenerated mock type for the Repository type @@ -35,6 +38,27 @@ func (_m *Repository[T]) Count(ctx context.Context, entity interface{}) (int64, return r0, r1 } +// CountInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Repository[T]) CountInTransaction(ctx context.Context, db *gorm.DB, entity interface{}) (int64, error) { + ret := _m.Called(ctx, db, entity) + + var r0 int64 + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, interface{}) int64); ok { + r0 = rf(ctx, db, entity) + } else { + r0 = ret.Get(0).(int64) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, interface{}) error); ok { + r1 = rf(ctx, db, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Create provides a mock function with given fields: ctx, entity func (_m *Repository[T]) Create(ctx context.Context, entity *T) error { ret := _m.Called(ctx, entity) @@ -49,6 +73,20 @@ func (_m *Repository[T]) Create(ctx context.Context, entity *T) error { return r0 } +// CreateInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Repository[T]) CreateInTransaction(ctx context.Context, db *gorm.DB, entity *T) error { + ret := _m.Called(ctx, db, entity) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, *T) error); ok { + r0 = rf(ctx, db, entity) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // Delete provides a mock function with given fields: ctx, id func (_m *Repository[T]) Delete(ctx context.Context, id string) (bool, error) { ret := _m.Called(ctx, id) @@ -70,6 +108,27 @@ func (_m *Repository[T]) Delete(ctx context.Context, id string) (bool, error) { return r0, r1 } +// DeleteInTransaction provides a mock function with given fields: ctx, db, id +func (_m *Repository[T]) DeleteInTransaction(ctx context.Context, db *gorm.DB, id string) (bool, error) { + ret := _m.Called(ctx, db, id) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, string) bool); ok { + r0 = rf(ctx, db, id) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, string) error); ok { + r1 = rf(ctx, db, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Find provides a mock function with given fields: ctx, entity, options func (_m *Repository[T]) Find(ctx context.Context, entity interface{}, options *repository.FindOptions) ([]*T, error) { ret := _m.Called(ctx, entity, options) @@ -93,6 +152,29 @@ func (_m *Repository[T]) Find(ctx context.Context, entity interface{}, options * return r0, r1 } +// FindInTransaction provides a mock function with given fields: ctx, db, entity, options +func (_m *Repository[T]) FindInTransaction(ctx context.Context, db *gorm.DB, entity interface{}, options *repository.FindOptions) ([]*T, error) { + ret := _m.Called(ctx, db, entity, options) + + var r0 []*T + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, interface{}, *repository.FindOptions) []*T); ok { + r0 = rf(ctx, db, entity, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*T) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, interface{}, *repository.FindOptions) error); ok { + r1 = rf(ctx, db, entity, options) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Get provides a mock function with given fields: ctx, id func (_m *Repository[T]) Get(ctx context.Context, id string) (*T, error) { ret := _m.Called(ctx, id) @@ -116,6 +198,45 @@ func (_m *Repository[T]) Get(ctx context.Context, id string) (*T, error) { return r0, r1 } +// GetDB provides a mock function with given fields: +func (_m *Repository[T]) GetDB() *gorm.DB { + ret := _m.Called() + + var r0 *gorm.DB + if rf, ok := ret.Get(0).(func() *gorm.DB); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gorm.DB) + } + } + + return r0 +} + +// GetInTransaction provides a mock function with given fields: ctx, db, id +func (_m *Repository[T]) GetInTransaction(ctx context.Context, db *gorm.DB, id string) (*T, error) { + ret := _m.Called(ctx, db, id) + + var r0 *T + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, string) *T); ok { + r0 = rf(ctx, db, id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*T) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, string) error); ok { + r1 = rf(ctx, db, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Update provides a mock function with given fields: ctx, entity func (_m *Repository[T]) Update(ctx context.Context, entity T) (*T, error) { ret := _m.Called(ctx, entity) @@ -139,6 +260,29 @@ func (_m *Repository[T]) Update(ctx context.Context, entity T) (*T, error) { return r0, r1 } +// UpdateInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Repository[T]) UpdateInTransaction(ctx context.Context, db *gorm.DB, entity T) (*T, error) { + ret := _m.Called(ctx, db, entity) + + var r0 *T + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, T) *T); ok { + r0 = rf(ctx, db, entity) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*T) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, T) error); ok { + r1 = rf(ctx, db, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + type mockConstructorTestingTNewRepository interface { mock.TestingT Cleanup(func()) diff --git a/mocks/repository/Rulesheets.go b/mocks/repository/Rulesheets.go index 82a7364..e1992c4 100644 --- a/mocks/repository/Rulesheets.go +++ b/mocks/repository/Rulesheets.go @@ -5,9 +5,12 @@ package mocks import ( context "context" - models "github.com/bancodobrasil/featws-api/models" + gorm "gorm.io/gorm" + mock "github.com/stretchr/testify/mock" + models "github.com/bancodobrasil/featws-api/models" + repository "github.com/bancodobrasil/featws-api/repository" ) @@ -37,6 +40,27 @@ func (_m *Rulesheets) Count(ctx context.Context, entity interface{}) (int64, err return r0, r1 } +// CountInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Rulesheets) CountInTransaction(ctx context.Context, db *gorm.DB, entity interface{}) (int64, error) { + ret := _m.Called(ctx, db, entity) + + var r0 int64 + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, interface{}) int64); ok { + r0 = rf(ctx, db, entity) + } else { + r0 = ret.Get(0).(int64) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, interface{}) error); ok { + r1 = rf(ctx, db, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Create provides a mock function with given fields: ctx, entity func (_m *Rulesheets) Create(ctx context.Context, entity *models.Rulesheet) error { ret := _m.Called(ctx, entity) @@ -51,6 +75,20 @@ func (_m *Rulesheets) Create(ctx context.Context, entity *models.Rulesheet) erro return r0 } +// CreateInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Rulesheets) CreateInTransaction(ctx context.Context, db *gorm.DB, entity *models.Rulesheet) error { + ret := _m.Called(ctx, db, entity) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, *models.Rulesheet) error); ok { + r0 = rf(ctx, db, entity) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // Delete provides a mock function with given fields: ctx, id func (_m *Rulesheets) Delete(ctx context.Context, id string) (bool, error) { ret := _m.Called(ctx, id) @@ -72,6 +110,27 @@ func (_m *Rulesheets) Delete(ctx context.Context, id string) (bool, error) { return r0, r1 } +// DeleteInTransaction provides a mock function with given fields: ctx, db, id +func (_m *Rulesheets) DeleteInTransaction(ctx context.Context, db *gorm.DB, id string) (bool, error) { + ret := _m.Called(ctx, db, id) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, string) bool); ok { + r0 = rf(ctx, db, id) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, string) error); ok { + r1 = rf(ctx, db, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Find provides a mock function with given fields: ctx, entity, options func (_m *Rulesheets) Find(ctx context.Context, entity interface{}, options *repository.FindOptions) ([]*models.Rulesheet, error) { ret := _m.Called(ctx, entity, options) @@ -95,6 +154,29 @@ func (_m *Rulesheets) Find(ctx context.Context, entity interface{}, options *rep return r0, r1 } +// FindInTransaction provides a mock function with given fields: ctx, db, entity, options +func (_m *Rulesheets) FindInTransaction(ctx context.Context, db *gorm.DB, entity interface{}, options *repository.FindOptions) ([]*models.Rulesheet, error) { + ret := _m.Called(ctx, db, entity, options) + + var r0 []*models.Rulesheet + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, interface{}, *repository.FindOptions) []*models.Rulesheet); ok { + r0 = rf(ctx, db, entity, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*models.Rulesheet) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, interface{}, *repository.FindOptions) error); ok { + r1 = rf(ctx, db, entity, options) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Get provides a mock function with given fields: ctx, id func (_m *Rulesheets) Get(ctx context.Context, id string) (*models.Rulesheet, error) { ret := _m.Called(ctx, id) @@ -118,6 +200,45 @@ func (_m *Rulesheets) Get(ctx context.Context, id string) (*models.Rulesheet, er return r0, r1 } +// GetDB provides a mock function with given fields: +func (_m *Rulesheets) GetDB() *gorm.DB { + ret := _m.Called() + + var r0 *gorm.DB + if rf, ok := ret.Get(0).(func() *gorm.DB); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gorm.DB) + } + } + + return r0 +} + +// GetInTransaction provides a mock function with given fields: ctx, db, id +func (_m *Rulesheets) GetInTransaction(ctx context.Context, db *gorm.DB, id string) (*models.Rulesheet, error) { + ret := _m.Called(ctx, db, id) + + var r0 *models.Rulesheet + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, string) *models.Rulesheet); ok { + r0 = rf(ctx, db, id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*models.Rulesheet) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, string) error); ok { + r1 = rf(ctx, db, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Update provides a mock function with given fields: ctx, entity func (_m *Rulesheets) Update(ctx context.Context, entity models.Rulesheet) (*models.Rulesheet, error) { ret := _m.Called(ctx, entity) @@ -141,6 +262,29 @@ func (_m *Rulesheets) Update(ctx context.Context, entity models.Rulesheet) (*mod return r0, r1 } +// UpdateInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Rulesheets) UpdateInTransaction(ctx context.Context, db *gorm.DB, entity models.Rulesheet) (*models.Rulesheet, error) { + ret := _m.Called(ctx, db, entity) + + var r0 *models.Rulesheet + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, models.Rulesheet) *models.Rulesheet); ok { + r0 = rf(ctx, db, entity) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*models.Rulesheet) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, models.Rulesheet) error); ok { + r1 = rf(ctx, db, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + type mockConstructorTestingTNewRulesheets interface { mock.TestingT Cleanup(func()) diff --git a/repository/repository.go b/repository/repository.go index 1b62a42..e1d4f1a 100644 --- a/repository/repository.go +++ b/repository/repository.go @@ -20,12 +20,19 @@ type FindOptions struct { // Repository ... type Repository[T any] interface { + GetDB() *gorm.DB Create(ctx context.Context, entity *T) error + CreateInTransaction(ctx context.Context, db *gorm.DB, entity *T) error Find(ctx context.Context, entity interface{}, options *FindOptions) (list []*T, err error) + FindInTransaction(ctx context.Context, db *gorm.DB, entity interface{}, options *FindOptions) (list []*T, err error) Count(ctx context.Context, entity interface{}) (count int64, err error) + CountInTransaction(ctx context.Context, db *gorm.DB, entity interface{}) (count int64, err error) Get(ctx context.Context, id string) (entity *T, err error) + GetInTransaction(ctx context.Context, db *gorm.DB, id string) (entity *T, err error) Update(ctx context.Context, entity T) (updated *T, err error) + UpdateInTransaction(ctx context.Context, db *gorm.DB, entity T) (updated *T, err error) Delete(ctx context.Context, id string) (deleted bool, err error) + DeleteInTransaction(ctx context.Context, db *gorm.DB, id string) (deleted bool, err error) } // Repository ... @@ -44,12 +51,16 @@ const ( // Create ... func (r *repository[T]) Create(ctx context.Context, entity *T) error { + db := r.newSession(ctx) + return r.CreateInTransaction(ctx, db, entity) +} + +// CreateInTransaction ... +func (r *repository[T]) CreateInTransaction(ctx context.Context, db *gorm.DB, entity *T) error { // add the span of database query on the root span of the context span := utils.GenerateSpanTracer(ctx, create) defer span() - db := r.newSession(ctx) - result := db.Create(&entity) if result.Error != nil { log.WithContext(ctx).Errorf("error on insert the result into model: %v", result.Error) @@ -67,13 +78,17 @@ func (r *repository[T]) Create(ctx context.Context, entity *T) error { // Find ... func (r *repository[T]) Find(ctx context.Context, entity interface{}, options *FindOptions) (list []*T, err error) { + db := r.newSession(ctx) + return r.FindInTransaction(ctx, db, entity, options) +} + +// FindInTransaction ... +func (r *repository[T]) FindInTransaction(ctx context.Context, db *gorm.DB, entity interface{}, options *FindOptions) (list []*T, err error) { // add the span of database query on the root span of the context tracer := telemetry.GetTracer(ctx) ctx, span := tracer.Start(ctx, "repo-find", trace.WithSpanKind(trace.SpanKindInternal)) defer span.End() - db := r.newSession(ctx) - if options != nil { limit := 10 if options.Limit != 0 { @@ -98,13 +113,17 @@ func (r *repository[T]) Find(ctx context.Context, entity interface{}, options *F // Count ... func (r *repository[T]) Count(ctx context.Context, entity interface{}) (count int64, err error) { + db := r.newSession(ctx) + return r.CountInTransaction(ctx, db, entity) +} + +// CountInTransaction ... +func (r *repository[T]) CountInTransaction(ctx context.Context, db *gorm.DB, entity interface{}) (count int64, err error) { // add the span of database query on the root span of the context tracer := telemetry.GetTracer(ctx) ctx, span := tracer.Start(ctx, "repo-count", trace.WithSpanKind(trace.SpanKindInternal)) defer span.End() - db := r.newSession(ctx) - count = 0 result := db.Where(entity).Count(&count) @@ -120,13 +139,17 @@ func (r *repository[T]) Count(ctx context.Context, entity interface{}) (count in // Get ... func (r *repository[T]) Get(ctx context.Context, id string) (entity *T, err error) { + db := r.newSession(ctx) + return r.GetInTransaction(ctx, db, id) +} + +// Get ... +func (r *repository[T]) GetInTransaction(ctx context.Context, db *gorm.DB, id string) (entity *T, err error) { // add the span of database query on the root span of the context tracer := telemetry.GetTracer(ctx) ctx, span := tracer.Start(ctx, "repo-get", trace.WithSpanKind(trace.SpanKindInternal)) defer span.End() - db := r.newSession(ctx) - result := db.First(&entity, id) err = result.Error @@ -140,13 +163,17 @@ func (r *repository[T]) Get(ctx context.Context, id string) (entity *T, err erro // Update ... func (r *repository[T]) Update(ctx context.Context, entity T) (updated *T, err error) { + db := r.newSession(ctx) + return r.UpdateInTransaction(ctx, db, entity) +} + +// UpdateInTransaction ... +func (r *repository[T]) UpdateInTransaction(ctx context.Context, db *gorm.DB, entity T) (updated *T, err error) { // add the span of database query on the root span of the context tracer := telemetry.GetTracer(ctx) ctx, span := tracer.Start(ctx, "repo-update", trace.WithSpanKind(trace.SpanKindInternal)) defer span.End() - db := r.newSession(ctx) - result := db.Model(entity).Save(&entity) err = result.Error @@ -162,13 +189,17 @@ func (r *repository[T]) Update(ctx context.Context, entity T) (updated *T, err e // Delete ... func (r *repository[T]) Delete(ctx context.Context, id string) (deleted bool, err error) { + db := r.newSession(ctx) + return r.DeleteInTransaction(ctx, db, id) +} + +// DeleteInTransaction ... +func (r *repository[T]) DeleteInTransaction(ctx context.Context, db *gorm.DB, id string) (deleted bool, err error) { // add the span of database query on the root span of the context tracer := telemetry.GetTracer(ctx) ctx, span := tracer.Start(ctx, "repo-delete", trace.WithSpanKind(trace.SpanKindInternal)) defer span.End() - db := r.newSession(ctx) - entity, err := r.Get(ctx, id) if err != nil { @@ -195,5 +226,9 @@ func (r *repository[T]) Delete(ctx context.Context, id string) (deleted bool, er } func (r *repository[T]) newSession(ctx context.Context) *gorm.DB { - return r.db.Session(&gorm.Session{}).Model(new(T)).WithContext(ctx) + return r.GetDB().Session(&gorm.Session{}).Model(new(T)).WithContext(ctx) +} + +func (r *repository[T]) GetDB() *gorm.DB { + return r.db } From 56f5e918c2592321a49db99ae093a0ec9b1461ad Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 11 Nov 2022 14:19:37 -0300 Subject: [PATCH 44/55] fix: tests --- services/gitlab_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/gitlab_test.go b/services/gitlab_test.go index 447d638..17f12be 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -767,7 +767,7 @@ func TestFillJSON(t *testing.T) { } if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/rules.json" { - content := base64.StdEncoding.EncodeToString([]byte("{\"regra\": \"$test\"")) + content := base64.StdEncoding.EncodeToString([]byte("{\"regra\": \"$test\"}")) file := gitlab.File{ Content: content, From 2e960b58427f8772e1c9a8a34c613662abb0b395 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 11 Nov 2022 11:30:56 -0300 Subject: [PATCH 45/55] feat: include fill JSON test --- services/gitlab_test.go | 121 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/services/gitlab_test.go b/services/gitlab_test.go index 6615154..447d638 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -751,6 +751,127 @@ func TestFill(t *testing.T) { } } +func TestFillJSON(t *testing.T) { + + namespace := "test" + + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/api/v4/namespaces/"+namespace { + w.Write([]byte(`{"id":1,"name":"teste", "path":"testpath"}`)) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/testpath/prefix-Test" { + w.Write([]byte(`{"id":1,"description":"testeDesc","name":"teste"}`)) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/rules.json" { + content := base64.StdEncoding.EncodeToString([]byte("{\"regra\": \"$test\"")) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/parameters.json" { + content := base64.StdEncoding.EncodeToString([]byte(`[ + { + "name": "param1", + "type": "string" + }, + { + "name": "param2", + "type": "string" + } + ]`)) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + + if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/features.json" { + content := base64.StdEncoding.EncodeToString([]byte(`[ + { + "name": "feat1", + "type": "string" + }, + { + "name": "feat2", + "type": "string" + } + ]`)) + + file := gitlab.File{ + Content: content, + } + data, _ := json.Marshal(file) + w.Write(data) + return + } + + w.WriteHeader(http.StatusNotFound) + })) + defer s.Close() + + cfg := SetupConfig(s) + + ngl := services.NewGitlab(cfg) + ngl.Connect() + dto := SetupRulesheet() + err := ngl.Fill(dto) + if err != nil { + t.Errorf("unexpected error on fill: %s", err.Error()) + return + } + + if (*dto.Rules)["regra"].(string) != "$test" { + t.Error("error on unmarshalling rules") + return + } + + if (dto.Parameters) == nil || len(*dto.Parameters) != 2 { + t.Error("error on unmarshalling parameters") + return + } + + param1 := (*dto.Parameters)[0] + if param1["name"] != "param1" || param1["type"] != "string" { + t.Error("error on unmarshalling parameter 1") + return + } + + param2 := (*dto.Parameters)[1] + if param2["name"] != "param2" || param1["type"] != "string" { + t.Error("error on unmarshalling parameter 2") + return + } + + if (dto.Features) == nil || len(*dto.Features) != 2 { + t.Error("error on unmarshalling Features") + return + } + + feat1 := (*dto.Features)[0] + if feat1["name"] != "feat1" || feat1["type"] != "string" { + t.Error("error on unmarshalling Feature 1") + return + } + + feat2 := (*dto.Features)[1] + if feat2["name"] != "feat2" || param1["type"] != "string" { + t.Error("error on unmarshalling Feature 2") + return + } +} + // Functions to test fill function func TestFillRulesSlices(t *testing.T) { dto := SetupRulesheet() From 432cb0c9618a5ed950ca2d7da3aa8dded638be0e Mon Sep 17 00:00:00 2001 From: EduardaCastro Date: Mon, 14 Nov 2022 12:15:24 -0300 Subject: [PATCH 46/55] fix: merge conflicts --- go.mod | 22 ++--- go.sum | 47 ++++++----- mocks/repository/Repository.go | 146 ++++++++++++++++++++++++++++++++- mocks/repository/Rulesheets.go | 146 ++++++++++++++++++++++++++++++++- repository/repository.go | 61 +++++++++++--- 5 files changed, 377 insertions(+), 45 deletions(-) diff --git a/go.mod b/go.mod index a3d447f..d92dd86 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/lestrrat-go/jwx/v2 v2.0.6 github.com/prometheus/client_golang v1.12.1 github.com/sirupsen/logrus v1.9.0 - github.com/spf13/viper v1.11.0 + github.com/spf13/viper v1.12.0 github.com/stretchr/testify v1.8.0 github.com/swaggo/gin-swagger v1.4.2 github.com/swaggo/swag v1.7.9 @@ -35,7 +35,7 @@ require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect - github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -69,21 +69,21 @@ require ( github.com/mailru/easyjson v0.7.6 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect - github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/pelletier/go-toml v1.9.4 // indirect - github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.33.0 // indirect github.com/prometheus/procfs v0.7.3 // indirect github.com/spf13/afero v1.8.2 // indirect - github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.4.0 // indirect - github.com/subosito/gotenv v1.2.0 // indirect + github.com/subosito/gotenv v1.4.0 // indirect github.com/ugorji/go/codec v1.2.7 // indirect github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.15 // indirect github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.15 // indirect @@ -91,16 +91,16 @@ require ( go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect go.opentelemetry.io/otel/sdk v1.8.0 // indirect go.uber.org/atomic v1.7.0 // indirect - golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect - golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect + golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect + golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect - golang.org/x/tools v0.1.7 // indirect + golang.org/x/tools v0.1.11 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.28.0 // indirect - gopkg.in/ini.v1 v1.66.4 // indirect + gopkg.in/ini.v1 v1.66.6 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index cb1e68a..5987fa6 100644 --- a/go.sum +++ b/go.sum @@ -428,10 +428,12 @@ github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoD github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/gabriel-vasile/mimetype v1.3.1/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= @@ -948,8 +950,9 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= @@ -1051,10 +1054,11 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= -github.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= +github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= @@ -1172,8 +1176,9 @@ github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= @@ -1190,8 +1195,8 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= -github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= -github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= +github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -1208,10 +1213,12 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/subosito/gotenv v1.4.0 h1:yAzM1+SmVcz5R4tXGsNMu1jUl2aOJXoiWUCEwwnGrvs= +github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= github.com/swaggo/gin-swagger v1.4.2 h1:qDs1YrBOTnurDG/JVMc8678KhoS1B1okQGPtIqVz4YU= github.com/swaggo/gin-swagger v1.4.2/go.mod h1:hmJ1vPn+XjUvnbzjCdUAxVqgraxELxk8x5zAsjCE5mg= @@ -1380,8 +1387,9 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1428,8 +1436,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0 h1:UG21uOlmZabA4fW5i7ZX6bjw1xELEGg/ZLgZq9auk/Q= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1502,8 +1510,8 @@ golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1668,6 +1676,7 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1776,15 +1785,15 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/tools v0.1.11 h1:loJ25fNOEhSXfHrpoGj91eCUThwdNX6u24rO1xnNteY= +golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0= @@ -1910,7 +1919,7 @@ google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac h1:qSNTkEN+L2mvWcLgJOR+8bdHX9rN/IdU3A1Ghpfb1Rg= +google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd h1:e0TwkXOdbnH/1x5rc5MZ/VYyiZ4v+RdVfrGMqEwT68I= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1943,8 +1952,8 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1981,8 +1990,8 @@ gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:a gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= -gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI= +gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= diff --git a/mocks/repository/Repository.go b/mocks/repository/Repository.go index 630916b..bf04fe1 100644 --- a/mocks/repository/Repository.go +++ b/mocks/repository/Repository.go @@ -5,8 +5,11 @@ package mocks import ( context "context" - repository "github.com/bancodobrasil/featws-api/repository" + gorm "gorm.io/gorm" + mock "github.com/stretchr/testify/mock" + + repository "github.com/bancodobrasil/featws-api/repository" ) // Repository is an autogenerated mock type for the Repository type @@ -35,6 +38,27 @@ func (_m *Repository[T]) Count(ctx context.Context, entity interface{}) (int64, return r0, r1 } +// CountInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Repository[T]) CountInTransaction(ctx context.Context, db *gorm.DB, entity interface{}) (int64, error) { + ret := _m.Called(ctx, db, entity) + + var r0 int64 + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, interface{}) int64); ok { + r0 = rf(ctx, db, entity) + } else { + r0 = ret.Get(0).(int64) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, interface{}) error); ok { + r1 = rf(ctx, db, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Create provides a mock function with given fields: ctx, entity func (_m *Repository[T]) Create(ctx context.Context, entity *T) error { ret := _m.Called(ctx, entity) @@ -49,6 +73,20 @@ func (_m *Repository[T]) Create(ctx context.Context, entity *T) error { return r0 } +// CreateInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Repository[T]) CreateInTransaction(ctx context.Context, db *gorm.DB, entity *T) error { + ret := _m.Called(ctx, db, entity) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, *T) error); ok { + r0 = rf(ctx, db, entity) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // Delete provides a mock function with given fields: ctx, id func (_m *Repository[T]) Delete(ctx context.Context, id string) (bool, error) { ret := _m.Called(ctx, id) @@ -70,6 +108,27 @@ func (_m *Repository[T]) Delete(ctx context.Context, id string) (bool, error) { return r0, r1 } +// DeleteInTransaction provides a mock function with given fields: ctx, db, id +func (_m *Repository[T]) DeleteInTransaction(ctx context.Context, db *gorm.DB, id string) (bool, error) { + ret := _m.Called(ctx, db, id) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, string) bool); ok { + r0 = rf(ctx, db, id) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, string) error); ok { + r1 = rf(ctx, db, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Find provides a mock function with given fields: ctx, entity, options func (_m *Repository[T]) Find(ctx context.Context, entity interface{}, options *repository.FindOptions) ([]*T, error) { ret := _m.Called(ctx, entity, options) @@ -93,6 +152,29 @@ func (_m *Repository[T]) Find(ctx context.Context, entity interface{}, options * return r0, r1 } +// FindInTransaction provides a mock function with given fields: ctx, db, entity, options +func (_m *Repository[T]) FindInTransaction(ctx context.Context, db *gorm.DB, entity interface{}, options *repository.FindOptions) ([]*T, error) { + ret := _m.Called(ctx, db, entity, options) + + var r0 []*T + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, interface{}, *repository.FindOptions) []*T); ok { + r0 = rf(ctx, db, entity, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*T) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, interface{}, *repository.FindOptions) error); ok { + r1 = rf(ctx, db, entity, options) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Get provides a mock function with given fields: ctx, id func (_m *Repository[T]) Get(ctx context.Context, id string) (*T, error) { ret := _m.Called(ctx, id) @@ -116,6 +198,45 @@ func (_m *Repository[T]) Get(ctx context.Context, id string) (*T, error) { return r0, r1 } +// GetDB provides a mock function with given fields: +func (_m *Repository[T]) GetDB() *gorm.DB { + ret := _m.Called() + + var r0 *gorm.DB + if rf, ok := ret.Get(0).(func() *gorm.DB); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gorm.DB) + } + } + + return r0 +} + +// GetInTransaction provides a mock function with given fields: ctx, db, id +func (_m *Repository[T]) GetInTransaction(ctx context.Context, db *gorm.DB, id string) (*T, error) { + ret := _m.Called(ctx, db, id) + + var r0 *T + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, string) *T); ok { + r0 = rf(ctx, db, id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*T) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, string) error); ok { + r1 = rf(ctx, db, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Update provides a mock function with given fields: ctx, entity func (_m *Repository[T]) Update(ctx context.Context, entity T) (*T, error) { ret := _m.Called(ctx, entity) @@ -139,6 +260,29 @@ func (_m *Repository[T]) Update(ctx context.Context, entity T) (*T, error) { return r0, r1 } +// UpdateInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Repository[T]) UpdateInTransaction(ctx context.Context, db *gorm.DB, entity T) (*T, error) { + ret := _m.Called(ctx, db, entity) + + var r0 *T + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, T) *T); ok { + r0 = rf(ctx, db, entity) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*T) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, T) error); ok { + r1 = rf(ctx, db, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + type mockConstructorTestingTNewRepository interface { mock.TestingT Cleanup(func()) diff --git a/mocks/repository/Rulesheets.go b/mocks/repository/Rulesheets.go index 82a7364..e1992c4 100644 --- a/mocks/repository/Rulesheets.go +++ b/mocks/repository/Rulesheets.go @@ -5,9 +5,12 @@ package mocks import ( context "context" - models "github.com/bancodobrasil/featws-api/models" + gorm "gorm.io/gorm" + mock "github.com/stretchr/testify/mock" + models "github.com/bancodobrasil/featws-api/models" + repository "github.com/bancodobrasil/featws-api/repository" ) @@ -37,6 +40,27 @@ func (_m *Rulesheets) Count(ctx context.Context, entity interface{}) (int64, err return r0, r1 } +// CountInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Rulesheets) CountInTransaction(ctx context.Context, db *gorm.DB, entity interface{}) (int64, error) { + ret := _m.Called(ctx, db, entity) + + var r0 int64 + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, interface{}) int64); ok { + r0 = rf(ctx, db, entity) + } else { + r0 = ret.Get(0).(int64) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, interface{}) error); ok { + r1 = rf(ctx, db, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Create provides a mock function with given fields: ctx, entity func (_m *Rulesheets) Create(ctx context.Context, entity *models.Rulesheet) error { ret := _m.Called(ctx, entity) @@ -51,6 +75,20 @@ func (_m *Rulesheets) Create(ctx context.Context, entity *models.Rulesheet) erro return r0 } +// CreateInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Rulesheets) CreateInTransaction(ctx context.Context, db *gorm.DB, entity *models.Rulesheet) error { + ret := _m.Called(ctx, db, entity) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, *models.Rulesheet) error); ok { + r0 = rf(ctx, db, entity) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // Delete provides a mock function with given fields: ctx, id func (_m *Rulesheets) Delete(ctx context.Context, id string) (bool, error) { ret := _m.Called(ctx, id) @@ -72,6 +110,27 @@ func (_m *Rulesheets) Delete(ctx context.Context, id string) (bool, error) { return r0, r1 } +// DeleteInTransaction provides a mock function with given fields: ctx, db, id +func (_m *Rulesheets) DeleteInTransaction(ctx context.Context, db *gorm.DB, id string) (bool, error) { + ret := _m.Called(ctx, db, id) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, string) bool); ok { + r0 = rf(ctx, db, id) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, string) error); ok { + r1 = rf(ctx, db, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Find provides a mock function with given fields: ctx, entity, options func (_m *Rulesheets) Find(ctx context.Context, entity interface{}, options *repository.FindOptions) ([]*models.Rulesheet, error) { ret := _m.Called(ctx, entity, options) @@ -95,6 +154,29 @@ func (_m *Rulesheets) Find(ctx context.Context, entity interface{}, options *rep return r0, r1 } +// FindInTransaction provides a mock function with given fields: ctx, db, entity, options +func (_m *Rulesheets) FindInTransaction(ctx context.Context, db *gorm.DB, entity interface{}, options *repository.FindOptions) ([]*models.Rulesheet, error) { + ret := _m.Called(ctx, db, entity, options) + + var r0 []*models.Rulesheet + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, interface{}, *repository.FindOptions) []*models.Rulesheet); ok { + r0 = rf(ctx, db, entity, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*models.Rulesheet) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, interface{}, *repository.FindOptions) error); ok { + r1 = rf(ctx, db, entity, options) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Get provides a mock function with given fields: ctx, id func (_m *Rulesheets) Get(ctx context.Context, id string) (*models.Rulesheet, error) { ret := _m.Called(ctx, id) @@ -118,6 +200,45 @@ func (_m *Rulesheets) Get(ctx context.Context, id string) (*models.Rulesheet, er return r0, r1 } +// GetDB provides a mock function with given fields: +func (_m *Rulesheets) GetDB() *gorm.DB { + ret := _m.Called() + + var r0 *gorm.DB + if rf, ok := ret.Get(0).(func() *gorm.DB); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gorm.DB) + } + } + + return r0 +} + +// GetInTransaction provides a mock function with given fields: ctx, db, id +func (_m *Rulesheets) GetInTransaction(ctx context.Context, db *gorm.DB, id string) (*models.Rulesheet, error) { + ret := _m.Called(ctx, db, id) + + var r0 *models.Rulesheet + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, string) *models.Rulesheet); ok { + r0 = rf(ctx, db, id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*models.Rulesheet) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, string) error); ok { + r1 = rf(ctx, db, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Update provides a mock function with given fields: ctx, entity func (_m *Rulesheets) Update(ctx context.Context, entity models.Rulesheet) (*models.Rulesheet, error) { ret := _m.Called(ctx, entity) @@ -141,6 +262,29 @@ func (_m *Rulesheets) Update(ctx context.Context, entity models.Rulesheet) (*mod return r0, r1 } +// UpdateInTransaction provides a mock function with given fields: ctx, db, entity +func (_m *Rulesheets) UpdateInTransaction(ctx context.Context, db *gorm.DB, entity models.Rulesheet) (*models.Rulesheet, error) { + ret := _m.Called(ctx, db, entity) + + var r0 *models.Rulesheet + if rf, ok := ret.Get(0).(func(context.Context, *gorm.DB, models.Rulesheet) *models.Rulesheet); ok { + r0 = rf(ctx, db, entity) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*models.Rulesheet) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *gorm.DB, models.Rulesheet) error); ok { + r1 = rf(ctx, db, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + type mockConstructorTestingTNewRulesheets interface { mock.TestingT Cleanup(func()) diff --git a/repository/repository.go b/repository/repository.go index 1b62a42..e1d4f1a 100644 --- a/repository/repository.go +++ b/repository/repository.go @@ -20,12 +20,19 @@ type FindOptions struct { // Repository ... type Repository[T any] interface { + GetDB() *gorm.DB Create(ctx context.Context, entity *T) error + CreateInTransaction(ctx context.Context, db *gorm.DB, entity *T) error Find(ctx context.Context, entity interface{}, options *FindOptions) (list []*T, err error) + FindInTransaction(ctx context.Context, db *gorm.DB, entity interface{}, options *FindOptions) (list []*T, err error) Count(ctx context.Context, entity interface{}) (count int64, err error) + CountInTransaction(ctx context.Context, db *gorm.DB, entity interface{}) (count int64, err error) Get(ctx context.Context, id string) (entity *T, err error) + GetInTransaction(ctx context.Context, db *gorm.DB, id string) (entity *T, err error) Update(ctx context.Context, entity T) (updated *T, err error) + UpdateInTransaction(ctx context.Context, db *gorm.DB, entity T) (updated *T, err error) Delete(ctx context.Context, id string) (deleted bool, err error) + DeleteInTransaction(ctx context.Context, db *gorm.DB, id string) (deleted bool, err error) } // Repository ... @@ -44,12 +51,16 @@ const ( // Create ... func (r *repository[T]) Create(ctx context.Context, entity *T) error { + db := r.newSession(ctx) + return r.CreateInTransaction(ctx, db, entity) +} + +// CreateInTransaction ... +func (r *repository[T]) CreateInTransaction(ctx context.Context, db *gorm.DB, entity *T) error { // add the span of database query on the root span of the context span := utils.GenerateSpanTracer(ctx, create) defer span() - db := r.newSession(ctx) - result := db.Create(&entity) if result.Error != nil { log.WithContext(ctx).Errorf("error on insert the result into model: %v", result.Error) @@ -67,13 +78,17 @@ func (r *repository[T]) Create(ctx context.Context, entity *T) error { // Find ... func (r *repository[T]) Find(ctx context.Context, entity interface{}, options *FindOptions) (list []*T, err error) { + db := r.newSession(ctx) + return r.FindInTransaction(ctx, db, entity, options) +} + +// FindInTransaction ... +func (r *repository[T]) FindInTransaction(ctx context.Context, db *gorm.DB, entity interface{}, options *FindOptions) (list []*T, err error) { // add the span of database query on the root span of the context tracer := telemetry.GetTracer(ctx) ctx, span := tracer.Start(ctx, "repo-find", trace.WithSpanKind(trace.SpanKindInternal)) defer span.End() - db := r.newSession(ctx) - if options != nil { limit := 10 if options.Limit != 0 { @@ -98,13 +113,17 @@ func (r *repository[T]) Find(ctx context.Context, entity interface{}, options *F // Count ... func (r *repository[T]) Count(ctx context.Context, entity interface{}) (count int64, err error) { + db := r.newSession(ctx) + return r.CountInTransaction(ctx, db, entity) +} + +// CountInTransaction ... +func (r *repository[T]) CountInTransaction(ctx context.Context, db *gorm.DB, entity interface{}) (count int64, err error) { // add the span of database query on the root span of the context tracer := telemetry.GetTracer(ctx) ctx, span := tracer.Start(ctx, "repo-count", trace.WithSpanKind(trace.SpanKindInternal)) defer span.End() - db := r.newSession(ctx) - count = 0 result := db.Where(entity).Count(&count) @@ -120,13 +139,17 @@ func (r *repository[T]) Count(ctx context.Context, entity interface{}) (count in // Get ... func (r *repository[T]) Get(ctx context.Context, id string) (entity *T, err error) { + db := r.newSession(ctx) + return r.GetInTransaction(ctx, db, id) +} + +// Get ... +func (r *repository[T]) GetInTransaction(ctx context.Context, db *gorm.DB, id string) (entity *T, err error) { // add the span of database query on the root span of the context tracer := telemetry.GetTracer(ctx) ctx, span := tracer.Start(ctx, "repo-get", trace.WithSpanKind(trace.SpanKindInternal)) defer span.End() - db := r.newSession(ctx) - result := db.First(&entity, id) err = result.Error @@ -140,13 +163,17 @@ func (r *repository[T]) Get(ctx context.Context, id string) (entity *T, err erro // Update ... func (r *repository[T]) Update(ctx context.Context, entity T) (updated *T, err error) { + db := r.newSession(ctx) + return r.UpdateInTransaction(ctx, db, entity) +} + +// UpdateInTransaction ... +func (r *repository[T]) UpdateInTransaction(ctx context.Context, db *gorm.DB, entity T) (updated *T, err error) { // add the span of database query on the root span of the context tracer := telemetry.GetTracer(ctx) ctx, span := tracer.Start(ctx, "repo-update", trace.WithSpanKind(trace.SpanKindInternal)) defer span.End() - db := r.newSession(ctx) - result := db.Model(entity).Save(&entity) err = result.Error @@ -162,13 +189,17 @@ func (r *repository[T]) Update(ctx context.Context, entity T) (updated *T, err e // Delete ... func (r *repository[T]) Delete(ctx context.Context, id string) (deleted bool, err error) { + db := r.newSession(ctx) + return r.DeleteInTransaction(ctx, db, id) +} + +// DeleteInTransaction ... +func (r *repository[T]) DeleteInTransaction(ctx context.Context, db *gorm.DB, id string) (deleted bool, err error) { // add the span of database query on the root span of the context tracer := telemetry.GetTracer(ctx) ctx, span := tracer.Start(ctx, "repo-delete", trace.WithSpanKind(trace.SpanKindInternal)) defer span.End() - db := r.newSession(ctx) - entity, err := r.Get(ctx, id) if err != nil { @@ -195,5 +226,9 @@ func (r *repository[T]) Delete(ctx context.Context, id string) (deleted bool, er } func (r *repository[T]) newSession(ctx context.Context) *gorm.DB { - return r.db.Session(&gorm.Session{}).Model(new(T)).WithContext(ctx) + return r.GetDB().Session(&gorm.Session{}).Model(new(T)).WithContext(ctx) +} + +func (r *repository[T]) GetDB() *gorm.DB { + return r.db } From 36ea2c82db62d8163e9d1f33e92b7164f68a7052 Mon Sep 17 00:00:00 2001 From: Raphael Pinto Date: Fri, 11 Nov 2022 14:19:37 -0300 Subject: [PATCH 47/55] fix: tests --- services/gitlab_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/gitlab_test.go b/services/gitlab_test.go index 447d638..17f12be 100644 --- a/services/gitlab_test.go +++ b/services/gitlab_test.go @@ -767,7 +767,7 @@ func TestFillJSON(t *testing.T) { } if r.Method == "GET" && r.URL.Path == "/api/v4/projects/1/repository/files/rules.json" { - content := base64.StdEncoding.EncodeToString([]byte("{\"regra\": \"$test\"")) + content := base64.StdEncoding.EncodeToString([]byte("{\"regra\": \"$test\"}")) file := gitlab.File{ Content: content, From f71b2acaa1321daa0cf07a9451263f1cef556675 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Mon, 14 Nov 2022 15:14:50 -0300 Subject: [PATCH 48/55] feat: allowing transactions --- Makefile | 2 +- mocks/services/Rulesheets.go | 44 +++++++++++++++++++++++++++++ services/rulesheets.go | 54 ++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b12b766..57c124d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ lint: @make run-on-our-code-directories ARGS="golint" up-services: - docker-compose up -d adminer + docker compose up -d adminer build:generate-swagger go build -o api diff --git a/mocks/services/Rulesheets.go b/mocks/services/Rulesheets.go index 2387028..a700254 100644 --- a/mocks/services/Rulesheets.go +++ b/mocks/services/Rulesheets.go @@ -72,6 +72,27 @@ func (_m *Rulesheets) Delete(ctx context.Context, id string) (bool, error) { return r0, r1 } +// DeleteInTransaction provides a mock function with given fields: ctx, id +func (_m *Rulesheets) DeleteInTransaction(ctx context.Context, id string) (bool, error) { + ret := _m.Called(ctx, id) + + var r0 bool + if rf, ok := ret.Get(0).(func(context.Context, string) bool); ok { + r0 = rf(ctx, id) + } else { + r0 = ret.Get(0).(bool) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Find provides a mock function with given fields: ctx, filter, options func (_m *Rulesheets) Find(ctx context.Context, filter interface{}, options *services.FindOptions) ([]*dtos.Rulesheet, error) { ret := _m.Called(ctx, filter, options) @@ -141,6 +162,29 @@ func (_m *Rulesheets) Update(ctx context.Context, entity dtos.Rulesheet) (*dtos. return r0, r1 } +// UpdateInTransaction provides a mock function with given fields: ctx, entity +func (_m *Rulesheets) UpdateInTransaction(ctx context.Context, entity dtos.Rulesheet) (*dtos.Rulesheet, error) { + ret := _m.Called(ctx, entity) + + var r0 *dtos.Rulesheet + if rf, ok := ret.Get(0).(func(context.Context, dtos.Rulesheet) *dtos.Rulesheet); ok { + r0 = rf(ctx, entity) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dtos.Rulesheet) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, dtos.Rulesheet) error); ok { + r1 = rf(ctx, entity) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + type mockConstructorTestingTNewRulesheets interface { mock.TestingT Cleanup(func()) diff --git a/services/rulesheets.go b/services/rulesheets.go index 7c7e774..e640c4f 100644 --- a/services/rulesheets.go +++ b/services/rulesheets.go @@ -25,6 +25,8 @@ type Rulesheets interface { Get(ctx context.Context, id string) (*dtos.Rulesheet, error) Update(ctx context.Context, entity dtos.Rulesheet) (*dtos.Rulesheet, error) Delete(ctx context.Context, id string) (bool, error) + DeleteInTransaction(ctx context.Context, id string) (bool, error) + UpdateInTransaction(ctx context.Context, entity dtos.Rulesheet) (*dtos.Rulesheet, error) } type rulesheets struct { @@ -133,6 +135,37 @@ func (rs rulesheets) Get(ctx context.Context, id string) (result *dtos.Rulesheet return } +func (rs rulesheets) UpdateInTransaction(ctx context.Context, rulesheetDTO dtos.Rulesheet) (result *dtos.Rulesheet, err error) { + db := rs.repository.GetDB() + + tx := db.Begin() + defer func() { + if r := recover(); r != nil { + tx.Rollback() + } + }() + + entity, _ := models.NewRulesheetV1(rulesheetDTO) + + _, err = rs.repository.UpdateInTransaction(ctx, db, entity) + if err != nil { + tx.Rollback() + log.Errorf("Error on update the rulesheet from repository: %v", err) + return + } + + err = rs.gitlabService.Save(&rulesheetDTO, "[FEATWS BOT] Update Repo") + if err != nil { + tx.Rollback() + log.Errorf("Error on save the rulesheet into repository: %v", err) + return + } + + result = &rulesheetDTO + + return result, tx.Commit().Error +} + // UpdateRulesheet ... func (rs rulesheets) Update(ctx context.Context, rulesheetDTO dtos.Rulesheet) (result *dtos.Rulesheet, err error) { @@ -155,6 +188,27 @@ func (rs rulesheets) Update(ctx context.Context, rulesheetDTO dtos.Rulesheet) (r return } +func (rs rulesheets) DeleteInTransaction(ctx context.Context, id string) (bool, error) { + + db := rs.repository.GetDB() + + tx := db.Begin() + defer func() { + if r := recover(); r != nil { + tx.Rollback() + } + }() + + _, err := rs.repository.DeleteInTransaction(ctx, db, id) + if err != nil { + tx.Rollback() + log.Errorf("Error on delete the rulesheet from repository: %v", err) + return false, err + } + + return true, tx.Commit().Error +} + // DeleteRulesheet ... func (rs rulesheets) Delete(ctx context.Context, id string) (deleted bool, err error) { From a1a5d2cb0f7779542c6ee573cfb6742d0d751b03 Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Mon, 14 Nov 2022 15:17:29 -0300 Subject: [PATCH 49/55] refactor: removing middlewares package --- main.go | 3 - middlewares/middlewares.go | 18 ------ middlewares/verify_auth_token.go | 103 ------------------------------- routes/api/v1/v1.go | 10 --- 4 files changed, 134 deletions(-) delete mode 100644 middlewares/middlewares.go delete mode 100644 middlewares/verify_auth_token.go diff --git a/main.go b/main.go index f607146..9d0e081 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,6 @@ import ( "github.com/bancodobrasil/featws-api/config" "github.com/bancodobrasil/featws-api/database" _ "github.com/bancodobrasil/featws-api/docs" - "github.com/bancodobrasil/featws-api/middlewares" "github.com/bancodobrasil/featws-api/routes" ginMonitor "github.com/bancodobrasil/gin-monitor" "github.com/gin-contrib/cors" @@ -119,8 +118,6 @@ func main() { router := gin.New() - middlewares.InitializeMiddlewares() - router.Use(ginlogrus.Logger(log.StandardLogger()), gin.Recovery()) router.Use(monitor.Prometheus()) router.GET("metrics", gin.WrapH(promhttp.Handler())) diff --git a/middlewares/middlewares.go b/middlewares/middlewares.go deleted file mode 100644 index cd0e01e..0000000 --- a/middlewares/middlewares.go +++ /dev/null @@ -1,18 +0,0 @@ -package middlewares - -import "github.com/gin-gonic/gin" - -// Middleware ... -type Middleware interface { - Run() -} - -// InitializeMiddlewares ... -func InitializeMiddlewares() { - NewVerifyAuthTokenMiddleware() -} - -// Helper function to abort the request with an error status code and message -func respondWithError(c *gin.Context, code int, message interface{}) { - c.AbortWithStatusJSON(code, gin.H{"error": message}) -} diff --git a/middlewares/verify_auth_token.go b/middlewares/verify_auth_token.go deleted file mode 100644 index c9e88dc..0000000 --- a/middlewares/verify_auth_token.go +++ /dev/null @@ -1,103 +0,0 @@ -package middlewares - -import ( - "bytes" - "context" - "log" - "strings" - "time" - - "github.com/bancodobrasil/featws-api/config" - "github.com/gin-gonic/gin" - "github.com/lestrrat-go/jwx/v2/jwa" - "github.com/lestrrat-go/jwx/v2/jwk" - "github.com/lestrrat-go/jwx/v2/jws" -) - -// VerifyAuthTokenMiddleware ... -type VerifyAuthTokenMiddleware struct { - url string - ctx context.Context - signatureKeyCache *jwk.Cache -} - -var verifyAuthTokenMiddleware *VerifyAuthTokenMiddleware - -// VerifyAuthToken Middleware function to verify the JWT token -func VerifyAuthToken() gin.HandlerFunc { - return verifyAuthTokenMiddleware.Run() -} - -// NewVerifyAuthTokenMiddleware ... -func NewVerifyAuthTokenMiddleware() { - cfg := config.GetConfig() - ctx := context.Background() - - verifyAuthTokenMiddleware = &VerifyAuthTokenMiddleware{ - url: cfg.OpenAMURL, - ctx: ctx, - signatureKeyCache: jwk.NewCache(ctx, jwk.WithRefreshWindow(1*time.Minute)), - } - - verifyAuthTokenMiddleware.setup() -} - -func (m *VerifyAuthTokenMiddleware) setup() { - log.Println("Initializing VerifyAuthTokenMiddleware") - m.signatureKeyCache.Register(m.url, jwk.WithMinRefreshInterval(5*time.Minute)) - _, err := m.signatureKeyCache.Refresh(m.ctx, m.url) - if err != nil { - log.Panicf("Failed to refresh OpenAM JWKS: %s\n", err) - } -} - -// Run ... -func (m *VerifyAuthTokenMiddleware) Run() gin.HandlerFunc { - return func(c *gin.Context) { - token := m.extractTokenFromHeader(c) - - msg, err := jws.Parse([]byte(token)) - errorMsg := "Invalid Auth JWT" - if err != nil { - respondWithError(c, 401, errorMsg) - } - - key := m.getSignatureKey(c) - verified, err := jws.Verify([]byte(token), jws.WithKey(jwa.RS256, key)) - if err != nil { - respondWithError(c, 401, errorMsg) - } - - if !bytes.Equal(verified, msg.Payload()) { - respondWithError(c, 401, errorMsg) - } - - c.Next() - } -} - -func (m *VerifyAuthTokenMiddleware) extractTokenFromHeader(c *gin.Context) string { - authorizationHeader := c.Request.Header.Get("Authorization") - if authorizationHeader == "" { - respondWithError(c, 401, "Missing Authorization Header") - } - splitHeader := strings.Split(authorizationHeader, "Bearer") - if len(splitHeader) != 2 { - respondWithError(c, 401, "Invalid Authorization Header") - } - return strings.TrimSpace(splitHeader[1]) -} -func (m *VerifyAuthTokenMiddleware) getSignatureKey(c *gin.Context) jwk.Key { - keyset, err := m.signatureKeyCache.Get(m.ctx, m.url) - errorMsg := "Failed to fetch OpenAM JWKS" - if err != nil { - log.Printf("%s: %s\n", errorMsg, err) - respondWithError(c, 502, errorMsg) - } - key, exists := keyset.Key(0) - if !exists { - log.Printf("%s: %s\n", errorMsg, err) - respondWithError(c, 502, errorMsg) - } - return key -} diff --git a/routes/api/v1/v1.go b/routes/api/v1/v1.go index 1880d89..f22981a 100644 --- a/routes/api/v1/v1.go +++ b/routes/api/v1/v1.go @@ -1,21 +1,11 @@ package v1 import ( - "strings" - - "github.com/bancodobrasil/featws-api/config" - "github.com/bancodobrasil/featws-api/middlewares" "github.com/gin-gonic/gin" ) // Router define routes the API V1 func Router(router *gin.RouterGroup) { - cfg := config.GetConfig() - - switch strings.ToLower(cfg.AuthMode) { - case "openam": - router.Use(middlewares.VerifyAuthToken()) - } rulesheetsRouter(router.Group("/rulesheets")) //rpcRouter(router.Group("/")) From 2a870b7461b17953810fabfd035f1e71877cc59b Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Mon, 14 Nov 2022 15:21:04 -0300 Subject: [PATCH 50/55] feat: adding goauth and goauth-gin dependencies --- go.mod | 12 +++++++----- go.sum | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index d92dd86..0381693 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4 github.com/bancodobrasil/healthcheck v0.0.2-rc1 github.com/gin-contrib/cors v1.3.1 - github.com/gin-gonic/gin v1.7.7 + github.com/gin-gonic/gin v1.8.1 github.com/go-playground/validator/v10 v10.10.1 github.com/golang-migrate/migrate/v4 v4.15.2 github.com/gosimple/slug v1.12.0 @@ -16,7 +16,7 @@ require ( github.com/lestrrat-go/jwx/v2 v2.0.6 github.com/prometheus/client_golang v1.12.1 github.com/sirupsen/logrus v1.9.0 - github.com/spf13/viper v1.12.0 + github.com/spf13/viper v1.13.0 github.com/stretchr/testify v1.8.0 github.com/swaggo/gin-swagger v1.4.2 github.com/swaggo/swag v1.7.9 @@ -31,6 +31,8 @@ require ( github.com/KyleBanks/depth v1.2.1 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect + github.com/bancodobrasil/goauth v1.0.2 // indirect + github.com/bancodobrasil/goauth-gin v0.0.3 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -73,7 +75,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.33.0 // indirect @@ -83,7 +85,7 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.4.0 // indirect - github.com/subosito/gotenv v1.4.0 // indirect + github.com/subosito/gotenv v1.4.1 // indirect github.com/ugorji/go/codec v1.2.7 // indirect github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.15 // indirect github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.15 // indirect @@ -100,7 +102,7 @@ require ( golang.org/x/tools v0.1.11 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.28.0 // indirect - gopkg.in/ini.v1 v1.66.6 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 5987fa6..36f973c 100644 --- a/go.sum +++ b/go.sum @@ -170,6 +170,10 @@ github.com/bancodobrasil/gin-telemetry v0.0.1-rc5 h1:0isKPZ3IHkINJLibI+bXEQ/ex6v github.com/bancodobrasil/gin-telemetry v0.0.1-rc5/go.mod h1:amKV8U6OFB355twaZO92vy3GYesdTpT3esi2c13HNDI= github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4 h1:GOmDN95lCh0VJoulLMVvDRrj+uYLoKGhSx02sFVOlpQ= github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4/go.mod h1:hOjhXXhYmMrjninF6V6w6ZAaGvLZzWs5G+wIqH+PAX4= +github.com/bancodobrasil/goauth v1.0.2 h1:p2/iLUE7zjYGHz+eU+4ZQA5w58T+1bUCM0dYdMi7E9I= +github.com/bancodobrasil/goauth v1.0.2/go.mod h1:+RQ4B1Yq+zzDRsiLVHXIRbBJ+xHU0bnc1Ears6ZJZDc= +github.com/bancodobrasil/goauth-gin v0.0.3 h1:HCUTyvgFKEFgOtlbhCVCTKiuy2aHjCknc7/dHK/0Abw= +github.com/bancodobrasil/goauth-gin v0.0.3/go.mod h1:sifrZ2UVYpigGZ0rfPns92ihPZC89vlKK5NSj/Sak4g= github.com/bancodobrasil/healthcheck v0.0.2-rc1 h1:CcM4cZglmDokOtiaMSH9JokQqEQCsdtHQ2Ej0oqvTrg= github.com/bancodobrasil/healthcheck v0.0.2-rc1/go.mod h1:C/YL9OERFDjg0Xa60zP2PrWBJI1N92bXlrxIqo5GagY= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= @@ -452,6 +456,8 @@ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmC github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs= github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= @@ -1059,6 +1065,8 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= +github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= +github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= @@ -1197,6 +1205,8 @@ github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= +github.com/spf13/viper v1.13.0 h1:BWSJ/M+f+3nmdz9bxB+bWX28kkALN2ok11D0rSo8EJU= +github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+zgdYw= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -1219,6 +1229,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.4.0 h1:yAzM1+SmVcz5R4tXGsNMu1jUl2aOJXoiWUCEwwnGrvs= github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= +github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= +github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= github.com/swaggo/gin-swagger v1.4.2 h1:qDs1YrBOTnurDG/JVMc8678KhoS1B1okQGPtIqVz4YU= github.com/swaggo/gin-swagger v1.4.2/go.mod h1:hmJ1vPn+XjUvnbzjCdUAxVqgraxELxk8x5zAsjCE5mg= @@ -1992,6 +2004,8 @@ gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI= gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= From 29d5fb5508452db75d0cd558fbad4e1d3ed0db9d Mon Sep 17 00:00:00 2001 From: Elias Feijo de Almeida Pereira Lima Date: Mon, 14 Nov 2022 15:39:14 -0300 Subject: [PATCH 51/55] feat: goauth setup --- main.go | 3 +++ routes/api/v1/v1.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/main.go b/main.go index 9d0e081..779bd7d 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( _ "github.com/bancodobrasil/featws-api/docs" "github.com/bancodobrasil/featws-api/routes" ginMonitor "github.com/bancodobrasil/gin-monitor" + "github.com/bancodobrasil/goauth" "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" "github.com/golang-migrate/migrate/v4" @@ -118,6 +119,8 @@ func main() { router := gin.New() + goauth.BootstrapMiddleware() + router.Use(ginlogrus.Logger(log.StandardLogger()), gin.Recovery()) router.Use(monitor.Prometheus()) router.GET("metrics", gin.WrapH(promhttp.Handler())) diff --git a/routes/api/v1/v1.go b/routes/api/v1/v1.go index f22981a..c7ed550 100644 --- a/routes/api/v1/v1.go +++ b/routes/api/v1/v1.go @@ -1,12 +1,14 @@ package v1 import ( + goauthgin "github.com/bancodobrasil/goauth-gin" "github.com/gin-gonic/gin" ) // Router define routes the API V1 func Router(router *gin.RouterGroup) { + router.Use(goauthgin.Authenticate()) rulesheetsRouter(router.Group("/rulesheets")) //rpcRouter(router.Group("/")) } From 72f1e809ee371f6658bf3e0c72f7656693fee6a8 Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Thu, 17 Nov 2022 10:59:35 -0300 Subject: [PATCH 52/55] feat: update before delete --- services/rulesheets.go | 59 ++++++++++++------------------------------ 1 file changed, 16 insertions(+), 43 deletions(-) diff --git a/services/rulesheets.go b/services/rulesheets.go index e640c4f..457f533 100644 --- a/services/rulesheets.go +++ b/services/rulesheets.go @@ -25,8 +25,6 @@ type Rulesheets interface { Get(ctx context.Context, id string) (*dtos.Rulesheet, error) Update(ctx context.Context, entity dtos.Rulesheet) (*dtos.Rulesheet, error) Delete(ctx context.Context, id string) (bool, error) - DeleteInTransaction(ctx context.Context, id string) (bool, error) - UpdateInTransaction(ctx context.Context, entity dtos.Rulesheet) (*dtos.Rulesheet, error) } type rulesheets struct { @@ -135,37 +133,6 @@ func (rs rulesheets) Get(ctx context.Context, id string) (result *dtos.Rulesheet return } -func (rs rulesheets) UpdateInTransaction(ctx context.Context, rulesheetDTO dtos.Rulesheet) (result *dtos.Rulesheet, err error) { - db := rs.repository.GetDB() - - tx := db.Begin() - defer func() { - if r := recover(); r != nil { - tx.Rollback() - } - }() - - entity, _ := models.NewRulesheetV1(rulesheetDTO) - - _, err = rs.repository.UpdateInTransaction(ctx, db, entity) - if err != nil { - tx.Rollback() - log.Errorf("Error on update the rulesheet from repository: %v", err) - return - } - - err = rs.gitlabService.Save(&rulesheetDTO, "[FEATWS BOT] Update Repo") - if err != nil { - tx.Rollback() - log.Errorf("Error on save the rulesheet into repository: %v", err) - return - } - - result = &rulesheetDTO - - return result, tx.Commit().Error -} - // UpdateRulesheet ... func (rs rulesheets) Update(ctx context.Context, rulesheetDTO dtos.Rulesheet) (result *dtos.Rulesheet, err error) { @@ -188,7 +155,7 @@ func (rs rulesheets) Update(ctx context.Context, rulesheetDTO dtos.Rulesheet) (r return } -func (rs rulesheets) DeleteInTransaction(ctx context.Context, id string) (bool, error) { +func (rs rulesheets) Delete(ctx context.Context, id string) (bool, error) { db := rs.repository.GetDB() @@ -199,26 +166,32 @@ func (rs rulesheets) DeleteInTransaction(ctx context.Context, id string) (bool, } }() - _, err := rs.repository.DeleteInTransaction(ctx, db, id) + // get the specific rulesheet + rulesheet, err := rs.repository.Get(ctx, id) if err != nil { tx.Rollback() - log.Errorf("Error on delete the rulesheet from repository: %v", err) + log.Errorf("Error on fetch rulesheet(get): %v", err) return false, err } - return true, tx.Commit().Error -} + // update the ruleshet name to deleted + rulesheet.Name = fmt.Sprintf("%s-deleted-%v", rulesheet.Name, rulesheet.ID) -// DeleteRulesheet ... -func (rs rulesheets) Delete(ctx context.Context, id string) (deleted bool, err error) { + // update the rulesheet + _, err = rs.repository.Update(ctx, *rulesheet) + if err != nil { + tx.Rollback() + return false, err + } - deleted, err = rs.repository.Delete(ctx, id) + _, err = rs.repository.DeleteInTransaction(ctx, db, id) if err != nil { + tx.Rollback() log.Errorf("Error on delete the rulesheet from repository: %v", err) - return + return false, err } - return + return true, tx.Commit().Error } func newRulesheetDTO(entity *models.Rulesheet) *dtos.Rulesheet { From 29d6f829cdafe89a5bd4ba779d91dea2492d248f Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Mon, 21 Nov 2022 14:43:00 -0300 Subject: [PATCH 53/55] fix: test-cases --- services/rulesheets.go | 14 +-- services/rulesheets_test.go | 183 ++++++++++++++++++++++++++++++++++-- 2 files changed, 183 insertions(+), 14 deletions(-) diff --git a/services/rulesheets.go b/services/rulesheets.go index 457f533..bbbf09e 100644 --- a/services/rulesheets.go +++ b/services/rulesheets.go @@ -160,11 +160,11 @@ func (rs rulesheets) Delete(ctx context.Context, id string) (bool, error) { db := rs.repository.GetDB() tx := db.Begin() - defer func() { - if r := recover(); r != nil { - tx.Rollback() - } - }() + // defer func() { + // if r := recover(); r != nil { + // tx.Rollback() + // } + // }() // get the specific rulesheet rulesheet, err := rs.repository.Get(ctx, id) @@ -178,13 +178,13 @@ func (rs rulesheets) Delete(ctx context.Context, id string) (bool, error) { rulesheet.Name = fmt.Sprintf("%s-deleted-%v", rulesheet.Name, rulesheet.ID) // update the rulesheet - _, err = rs.repository.Update(ctx, *rulesheet) + _, err = rs.repository.UpdateInTransaction(ctx, tx, *rulesheet) if err != nil { tx.Rollback() return false, err } - _, err = rs.repository.DeleteInTransaction(ctx, db, id) + _, err = rs.repository.DeleteInTransaction(ctx, tx, id) if err != nil { tx.Rollback() log.Errorf("Error on delete the rulesheet from repository: %v", err) diff --git a/services/rulesheets_test.go b/services/rulesheets_test.go index 00cf9eb..04e5a02 100644 --- a/services/rulesheets_test.go +++ b/services/rulesheets_test.go @@ -3,14 +3,21 @@ package services_test import ( "context" "errors" + "log" + "strconv" "testing" + "github.com/DATA-DOG/go-sqlmock" "github.com/bancodobrasil/featws-api/dtos" mocks_repository "github.com/bancodobrasil/featws-api/mocks/repository" mocks_services "github.com/bancodobrasil/featws-api/mocks/services" "github.com/bancodobrasil/featws-api/models" "github.com/bancodobrasil/featws-api/repository" "github.com/bancodobrasil/featws-api/services" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "gorm.io/driver/mysql" + "gorm.io/gorm" ) func TestGetWithErrorOnFill(t *testing.T) { @@ -313,17 +320,70 @@ func TestUpdateWithError(t *testing.T) { } } +// func (s *RepositorySuite) SetupSuite() { +// var ( +// err error +// ) +// + +// // Dialector for mariadb +// dialector := mysql.New(mysql.Config{ +// DSN: "sqlmock_db_0", // DSN data source name +// DriverName: "mysql", +// Conn: s.conn, +// }) + +// s.DB, err = gorm.Open(dialector, &gorm.Config{}) +// assert.NoError(s.T(), err) +// } + +// func (s *RepositorySuite) TestDeleteRulesheet() { +// ctx := context.Background() +// dto := &dtos.Rulesheet{ +// ID: 1, +// Name: "test", +// } +// entity, err := models.NewRulesheetV1(*dto) + +// s.mock.ExpectBegin() + +// } + func TestDeleteSuccess(t *testing.T) { + // Init fake db connection + conn, mocks, err := sqlmock.New() + assert.NoError(t, err) + + mocks.ExpectBegin() + + mocks.ExpectCommit() + + dialector := mysql.New(mysql.Config{ + DriverName: "mysql", + Conn: conn, + SkipInitializeWithVersion: true, + }) + + db, err := gorm.Open(dialector, &gorm.Config{}) + assert.NoError(t, err) + ctx := context.Background() dto := &dtos.Rulesheet{ - ID: 1, + ID: 1, + Name: "test", } - _, err := models.NewRulesheetV1(*dto) + + entity, err := models.NewRulesheetV1(*dto) if err != nil { t.Error("unexpected error on model creation") } + newID := strconv.Itoa(int(dto.ID)) repository := new(mocks_repository.Rulesheets) - repository.On("Delete", ctx, "1").Return(true, nil) + repository.On("GetDB").Return(db) + repository.On("Get", ctx, newID).Return(&entity, nil) + entity.Name = "test-deleted-1" + repository.On("UpdateInTransaction", ctx, mock.Anything, mock.Anything).Return(&entity, nil) + repository.On("DeleteInTransaction", ctx, mock.Anything, "1").Return(true, nil) gitlabService := new(mocks_services.Gitlab) gitlabService.On("Delete", dto).Return(true, nil) service := services.NewRulesheets(repository, gitlabService) @@ -334,21 +394,130 @@ func TestDeleteSuccess(t *testing.T) { } func TestDeleteWithError(t *testing.T) { + // Init fake db connection + conn, mocks, err := sqlmock.New() + assert.NoError(t, err) + + mocks.ExpectBegin() + + mocks.ExpectRollback() + + dialector := mysql.New(mysql.Config{ + DriverName: "mysql", + Conn: conn, + SkipInitializeWithVersion: true, + }) + + db, err := gorm.Open(dialector, &gorm.Config{}) + assert.NoError(t, err) + ctx := context.Background() dto := &dtos.Rulesheet{ - ID: 1, + ID: 1, + Name: "test", } - _, err := models.NewRulesheetV1(*dto) + + entity, err := models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + newID := strconv.Itoa(int(dto.ID)) + repository := new(mocks_repository.Rulesheets) + repository.On("GetDB").Return(db) + repository.On("Get", ctx, newID).Return(&entity, nil) + entity.Name = "test-deleted-1" + repository.On("UpdateInTransaction", ctx, mock.Anything, mock.Anything).Return(nil, errors.New("error on update")) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Delete", dto).Return(true, nil) + service := services.NewRulesheets(repository, gitlabService) + _, err = service.Delete(ctx, "1") + if err == nil || err.Error() != "error on update" { + log.Println(err) + t.Error("expected error on update") + } +} + +func TestDeleteWithRollBackOnGet(t *testing.T) { + // Init fake db connection + conn, mocks, err := sqlmock.New() + assert.NoError(t, err) + + mocks.ExpectBegin() + + mocks.ExpectRollback() + + dialector := mysql.New(mysql.Config{ + DriverName: "mysql", + Conn: conn, + SkipInitializeWithVersion: true, + }) + + db, err := gorm.Open(dialector, &gorm.Config{}) + assert.NoError(t, err) + + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + Name: "test", + } + + _, err = models.NewRulesheetV1(*dto) + if err != nil { + t.Error("unexpected error on model creation") + } + newID := strconv.Itoa(int(dto.ID)) + repository := new(mocks_repository.Rulesheets) + repository.On("GetDB").Return(db) + repository.On("Get", ctx, newID).Return(nil, errors.New("error on get")) + gitlabService := new(mocks_services.Gitlab) + gitlabService.On("Delete", dto).Return(true, nil) + service := services.NewRulesheets(repository, gitlabService) + _, err = service.Delete(ctx, "1") + if err == nil || err.Error() != "error on get" { + t.Error("expected error on get") + } +} + +func TestDeleteWithRollBackOnDeleteInTransaction(t *testing.T) { + // Init fake db connection + conn, mocks, err := sqlmock.New() + assert.NoError(t, err) + + mocks.ExpectBegin() + + mocks.ExpectRollback() + + dialector := mysql.New(mysql.Config{ + DriverName: "mysql", + Conn: conn, + SkipInitializeWithVersion: true, + }) + + db, err := gorm.Open(dialector, &gorm.Config{}) + assert.NoError(t, err) + + ctx := context.Background() + dto := &dtos.Rulesheet{ + ID: 1, + Name: "test", + } + + entity, err := models.NewRulesheetV1(*dto) if err != nil { t.Error("unexpected error on model creation") } + newID := strconv.Itoa(int(dto.ID)) repository := new(mocks_repository.Rulesheets) - repository.On("Delete", ctx, "1").Return(true, errors.New("error on delete")) + repository.On("GetDB").Return(db) + repository.On("Get", ctx, newID).Return(&entity, nil) + entity.Name = "test-deleted-1" + repository.On("UpdateInTransaction", ctx, mock.Anything, mock.Anything).Return(&entity, nil) + repository.On("DeleteInTransaction", ctx, mock.Anything, "1").Return(false, errors.New("error on delete")) gitlabService := new(mocks_services.Gitlab) gitlabService.On("Delete", dto).Return(true, nil) service := services.NewRulesheets(repository, gitlabService) _, err = service.Delete(ctx, "1") if err == nil || err.Error() != "error on delete" { - t.Error("unexpected error on delete") + t.Error("expected error on delete") } } From 769c72bd9000b89d54edd17061c6a364c2463dcd Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Mon, 21 Nov 2022 14:48:51 -0300 Subject: [PATCH 54/55] fix: test-cases --- go.mod | 12 ++-------- go.sum | 40 +++----------------------------- mocks/services/Rulesheets.go | 44 ------------------------------------ repository/rulesheets.go | 5 ++++ 4 files changed, 10 insertions(+), 91 deletions(-) diff --git a/go.mod b/go.mod index 9c8eab1..2c141fe 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,10 @@ module github.com/bancodobrasil/featws-api go 1.18 require ( + github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/bancodobrasil/gin-monitor v1.0.0-rc1 github.com/bancodobrasil/gin-telemetry v0.0.1-rc5 + github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4 github.com/bancodobrasil/healthcheck v0.0.2-rc1 github.com/gin-contrib/cors v1.3.1 github.com/gin-gonic/gin v1.7.7 @@ -29,7 +31,6 @@ require ( github.com/KyleBanks/depth v1.2.1 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect - github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -52,7 +53,6 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.6.8 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -65,24 +65,19 @@ require ( github.com/lestrrat-go/option v1.0.0 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mailru/easyjson v0.7.6 // indirect - github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.2 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.33.0 // indirect github.com/prometheus/procfs v0.7.3 // indirect - github.com/rs/zerolog v1.27.0 // indirect github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.5.0 // indirect - github.com/spf13/cobra v1.4.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.4.0 // indirect @@ -90,16 +85,13 @@ require ( github.com/ugorji/go/codec v1.2.7 // indirect github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.15 // indirect github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.15 // indirect - github.com/vektra/mockery/v2 v2.14.1 // indirect go.opentelemetry.io/otel v1.8.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect go.opentelemetry.io/otel/sdk v1.8.0 // indirect golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect - golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect - golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect golang.org/x/tools v0.1.11 // indirect diff --git a/go.sum b/go.sum index b875480..72a5dac 100644 --- a/go.sum +++ b/go.sum @@ -50,6 +50,8 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= +github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= @@ -75,8 +77,6 @@ github.com/bancodobrasil/gin-monitor v1.0.0-rc1 h1:l98a1muGLLMQJ6BAudvL1263vj+26 github.com/bancodobrasil/gin-monitor v1.0.0-rc1/go.mod h1:hfOEzz5YWVYU8cdyK6O5/zGy34O1lhp2/Wfo6eMCPNg= github.com/bancodobrasil/gin-telemetry v0.0.1-rc5 h1:0isKPZ3IHkINJLibI+bXEQ/ex6v/a0SAPmUCb/l2pLg= github.com/bancodobrasil/gin-telemetry v0.0.1-rc5/go.mod h1:amKV8U6OFB355twaZO92vy3GYesdTpT3esi2c13HNDI= -github.com/bancodobrasil/go-featws v0.0.0-20221010233623-acdac4e32d39 h1:9YxfUdmOA5VycHSzOeaEfiKTsfnEzbLsOC7BNWrxd94= -github.com/bancodobrasil/go-featws v0.0.0-20221010233623-acdac4e32d39/go.mod h1:hOjhXXhYmMrjninF6V6w6ZAaGvLZzWs5G+wIqH+PAX4= github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4 h1:GOmDN95lCh0VJoulLMVvDRrj+uYLoKGhSx02sFVOlpQ= github.com/bancodobrasil/go-featws v0.0.0-20221011001318-743544d3c8a4/go.mod h1:hOjhXXhYmMrjninF6V6w6ZAaGvLZzWs5G+wIqH+PAX4= github.com/bancodobrasil/healthcheck v0.0.2-rc1 h1:CcM4cZglmDokOtiaMSH9JokQqEQCsdtHQ2Ej0oqvTrg= @@ -110,9 +110,7 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -135,7 +133,7 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= @@ -321,8 +319,6 @@ github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpT github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= @@ -401,12 +397,10 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -428,18 +422,14 @@ github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT9 github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= -github.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= @@ -479,11 +469,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= -github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.27.0 h1:1T7qCieN22GVc8S4Q2yuexzBb1EqjbgjSH9RohbMjKs= -github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -500,19 +486,14 @@ github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY52 github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= -github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= -github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= -github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -529,7 +510,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.4.0 h1:yAzM1+SmVcz5R4tXGsNMu1jUl2aOJXoiWUCEwwnGrvs= github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= @@ -551,8 +531,6 @@ github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.15/go.mod h1:h9Fha0tfy github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.15 h1:5eYO+onNB1mbdc3+uw6r+yNFFEzqR6sm8sj7zcrjrAs= github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.15/go.mod h1:6fGFPZDTcvHLxgWTFvf8hHWQrRO1tMXAFlxlqE+c650= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/vektra/mockery/v2 v2.14.1 h1:Xamr4zUkFBDGdZhJ6iCiJ1AwkGRmUgZd8zkwjRXt+TU= -github.com/vektra/mockery/v2 v2.14.1/go.mod h1:bnD1T8tExSgPD1ripLkDbr60JA9VtQeu12P3wgLZd7M= github.com/xanzy/go-gitlab v0.63.0 h1:a9fXpKWykUS6dowapFej/2Wjf4aOAEFC1q2ZIcz4IpI= github.com/xanzy/go-gitlab v0.63.0/go.mod h1:F0QEXwmqiBUxCgJm8fE9S+1veX4XC9Z4cfaAbqwk4YM= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -602,7 +580,6 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -641,10 +618,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0 h1:UG21uOlmZabA4fW5i7ZX6bjw1xELEGg/ZLgZq9auk/Q= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -692,8 +667,6 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -809,8 +782,6 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9w golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 h1:CBpWXWQpIRjzmkkA+M7q9Fqnwd2mZr3AFqexg8YTfoM= -golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -881,7 +852,6 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.11 h1:loJ25fNOEhSXfHrpoGj91eCUThwdNX6u24rO1xnNteY= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= @@ -889,8 +859,6 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df h1:5Pf6pFKu98ODmgnpvkJ3kFUOQGGLIzLIkbzUHp47618= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1049,8 +1017,6 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= -gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI= gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/mocks/services/Rulesheets.go b/mocks/services/Rulesheets.go index a700254..2387028 100644 --- a/mocks/services/Rulesheets.go +++ b/mocks/services/Rulesheets.go @@ -72,27 +72,6 @@ func (_m *Rulesheets) Delete(ctx context.Context, id string) (bool, error) { return r0, r1 } -// DeleteInTransaction provides a mock function with given fields: ctx, id -func (_m *Rulesheets) DeleteInTransaction(ctx context.Context, id string) (bool, error) { - ret := _m.Called(ctx, id) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, string) bool); ok { - r0 = rf(ctx, id) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, id) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // Find provides a mock function with given fields: ctx, filter, options func (_m *Rulesheets) Find(ctx context.Context, filter interface{}, options *services.FindOptions) ([]*dtos.Rulesheet, error) { ret := _m.Called(ctx, filter, options) @@ -162,29 +141,6 @@ func (_m *Rulesheets) Update(ctx context.Context, entity dtos.Rulesheet) (*dtos. return r0, r1 } -// UpdateInTransaction provides a mock function with given fields: ctx, entity -func (_m *Rulesheets) UpdateInTransaction(ctx context.Context, entity dtos.Rulesheet) (*dtos.Rulesheet, error) { - ret := _m.Called(ctx, entity) - - var r0 *dtos.Rulesheet - if rf, ok := ret.Get(0).(func(context.Context, dtos.Rulesheet) *dtos.Rulesheet); ok { - r0 = rf(ctx, entity) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*dtos.Rulesheet) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, dtos.Rulesheet) error); ok { - r1 = rf(ctx, entity) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - type mockConstructorTestingTNewRulesheets interface { mock.TestingT Cleanup(func()) diff --git a/repository/rulesheets.go b/repository/rulesheets.go index d30c2cc..9caee83 100644 --- a/repository/rulesheets.go +++ b/repository/rulesheets.go @@ -3,6 +3,7 @@ package repository import ( "github.com/bancodobrasil/featws-api/database" "github.com/bancodobrasil/featws-api/models" + "gorm.io/gorm" ) // Rulesheets ... @@ -30,6 +31,10 @@ func GetRulesheets() Rulesheets { func newRulesheets() (Rulesheets, error) { db := database.GetConn() + return NewRulesheetsWithDB(db) +} + +func NewRulesheetsWithDB(db *gorm.DB) (Rulesheets, error) { err := db.AutoMigrate(&models.Rulesheet{}) if err != nil { return nil, err From 4177a60781087ef166be869b1c07806c0315705a Mon Sep 17 00:00:00 2001 From: C1325543 Matheus Romano Braga Date: Mon, 21 Nov 2022 15:24:52 -0300 Subject: [PATCH 55/55] fix: linter error --- repository/rulesheets.go | 1 + 1 file changed, 1 insertion(+) diff --git a/repository/rulesheets.go b/repository/rulesheets.go index 9caee83..f55552e 100644 --- a/repository/rulesheets.go +++ b/repository/rulesheets.go @@ -34,6 +34,7 @@ func newRulesheets() (Rulesheets, error) { return NewRulesheetsWithDB(db) } +// NewRulesheetsWithDB ... func NewRulesheetsWithDB(db *gorm.DB) (Rulesheets, error) { err := db.AutoMigrate(&models.Rulesheet{}) if err != nil {