Skip to content

Commit

Permalink
chore(deps): bump github.com/ViBiOh/mailer from 1.29.0 to 1.30.0
Browse files Browse the repository at this point in the history
Bumps [github.com/ViBiOh/mailer](https://github.com/ViBiOh/mailer) from 1.29.0 to 1.30.0.
- [Release notes](https://github.com/ViBiOh/mailer/releases)
- [Commits](ViBiOh/mailer@v1.29.0...v1.30.0)

---
updated-dependencies:
- dependency-name: github.com/ViBiOh/mailer
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
dependabot[bot] authored and ViBiOh committed Aug 21, 2022
1 parent ec85f72 commit b01d26d
Show file tree
Hide file tree
Showing 25 changed files with 690 additions and 328 deletions.
11 changes: 6 additions & 5 deletions cmd/ketchup/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
repositoryStore "github.com/ViBiOh/ketchup/pkg/store/repository"
userStore "github.com/ViBiOh/ketchup/pkg/store/user"
mailer "github.com/ViBiOh/mailer/pkg/client"
"go.opentelemetry.io/otel/trace"
)

const (
Expand All @@ -56,11 +57,11 @@ const (
//go:embed templates static
var content embed.FS

func initAuth(db db.App, tracerApp tracer.App) (authService.App, authMiddleware.App) {
func initAuth(db db.App, tracer trace.Tracer) (authService.App, authMiddleware.App) {
authProvider := authStore.New(db)
identProvider := authIdent.New(authProvider, "ketchup")

return authService.New(authProvider, authProvider), authMiddleware.New(authProvider, tracerApp, identProvider)
return authService.New(authProvider, authProvider), authMiddleware.New(authProvider, tracer, identProvider)
}

func main() {
Expand Down Expand Up @@ -113,7 +114,7 @@ func main() {

healthApp := health.New(healthConfig, ketchupDb.Ping, redisApp.Ping)

authServiceApp, authMiddlewareApp := initAuth(ketchupDb, tracerApp)
authServiceApp, authMiddlewareApp := initAuth(ketchupDb, tracerApp.GetTracer("auth"))

userServiceApp := userService.New(userStore.New(ketchupDb), &authServiceApp)
githubApp := github.New(githubConfig, redisApp, tracerApp)
Expand All @@ -124,15 +125,15 @@ func main() {
repositoryServiceApp := repositoryService.New(repositoryStore.New(ketchupDb), githubApp, helmApp, dockerApp, npmApp, pypiApp)
ketchupServiceApp := ketchupService.New(ketchupStore.New(ketchupDb), repositoryServiceApp)

mailerApp, err := mailer.New(mailerConfig, prometheusApp.Registerer())
mailerApp, err := mailer.New(mailerConfig, prometheusApp.Registerer(), tracerApp.GetTracer("mailer"))
logger.Fatal(err)
defer mailerApp.Close()

publicRendererApp, err := renderer.New(rendererConfig, content, ketchup.FuncMap, tracerApp.GetTracer("renderer"))
logger.Fatal(err)

notifierApp := notifier.New(notifierConfig, repositoryServiceApp, ketchupServiceApp, userServiceApp, mailerApp, helmApp)
schedulerApp := scheduler.New(schedulerConfig, notifierApp, redisApp, tracerApp)
schedulerApp := scheduler.New(schedulerConfig, notifierApp, redisApp, tracerApp.GetTracer("scheduler"))
ketchupApp := ketchup.New(publicRendererApp, ketchupServiceApp, userServiceApp, repositoryServiceApp, redisApp)

publicHandler := publicRendererApp.Handler(ketchupApp.PublicTemplateFunc)
Expand Down
2 changes: 1 addition & 1 deletion cmd/notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func main() {
defer tracerApp.Close()
request.AddTracerToDefaultClient(tracerApp.GetProvider())

mailerApp, err := mailer.New(mailerConfig, nil)
mailerApp, err := mailer.New(mailerConfig, nil, tracerApp.GetTracer("mailer"))
logger.Fatal(err)
defer mailerApp.Close()

Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/ViBiOh/ketchup
go 1.19

require (
github.com/ViBiOh/auth/v2 v2.13.0
github.com/ViBiOh/auth/v2 v2.14.0
github.com/ViBiOh/flags v1.2.0
github.com/ViBiOh/httputils/v4 v4.46.1
github.com/ViBiOh/mailer v1.29.0
github.com/ViBiOh/httputils/v4 v4.46.2
github.com/ViBiOh/mailer v1.30.0
github.com/golang/mock v1.6.0
github.com/jackc/pgconn v1.13.0
github.com/jackc/pgproto3/v2 v2.3.1
Expand Down Expand Up @@ -43,7 +43,7 @@ require (
go.opentelemetry.io/otel/exporters/jaeger v1.9.0 // indirect
go.opentelemetry.io/otel/metric v0.31.0 // indirect
go.opentelemetry.io/otel/sdk v1.9.0 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8 // indirect
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/text v0.3.7 // indirect
Expand Down
15 changes: 8 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
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/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/ViBiOh/auth/v2 v2.13.0 h1:AGPU5WFefkZHvLJkWA8bpMb0a2hu9zJNoYOiz7NLKpQ=
github.com/ViBiOh/auth/v2 v2.13.0/go.mod h1:eGqz0ln1SdfuOG8N2XsruKh8NCU7Plx0P5mQPHsNWxQ=
github.com/ViBiOh/auth/v2 v2.14.0 h1:v/t+pOZOBbSemSRV2TZ+C44fZFR0xQqIR7F/PZgC440=
github.com/ViBiOh/auth/v2 v2.14.0/go.mod h1:w1nqMK6Zve6fpSvBi5J2gg8+4nDxmRpbUILqS0eTw5M=
github.com/ViBiOh/flags v1.2.0 h1:DaujjNXzD29KxKyp4eZdn7c9+uBN5DokWgDAe7DcUmc=
github.com/ViBiOh/flags v1.2.0/go.mod h1:UyMB5zeD/aId7Xw3x7577ZNU298JmukzOcV8p/H2W1s=
github.com/ViBiOh/httputils/v4 v4.46.1 h1:TWSfDGZe8biy5LOSDmyvKdoEfMNS/LZ2y3Ksh7lvbGk=
github.com/ViBiOh/httputils/v4 v4.46.1/go.mod h1:WADqXz2lb3av9YkDlF+ZJCSh1EaXCstj8AFn2snDarY=
github.com/ViBiOh/mailer v1.29.0 h1:TAOBtBmxtFodlf+41B9VBGXCCUbmC0u1UJ+Ea5OBMjI=
github.com/ViBiOh/mailer v1.29.0/go.mod h1:ptg4AiVVHsesPei54sMzkEv7mx7z6XoH+ZTOqS1BKHE=
github.com/ViBiOh/httputils/v4 v4.46.2 h1:Dv21a3U0K78Iw4eHxxt3tRz8kQeC0ThT4jdZMdk+7nI=
github.com/ViBiOh/httputils/v4 v4.46.2/go.mod h1:WADqXz2lb3av9YkDlF+ZJCSh1EaXCstj8AFn2snDarY=
github.com/ViBiOh/mailer v1.30.0 h1:lA3HHYQev7wLxhai1tapvw9TF3PoPkGY5rZXyBrDVT8=
github.com/ViBiOh/mailer v1.30.0/go.mod h1:qOFjr4TT9z0QYmBnjvSci+tRtS8g65n7EDa7fDzSDis=
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=
Expand Down Expand Up @@ -363,8 +363,9 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8 h1:GIAS/yBem/gq2MUqgNIzUHW7cJMmx3TGZOrnyYaNQ6c=
golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8/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=
Expand Down
12 changes: 9 additions & 3 deletions pkg/ketchup/renderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package ketchup
import "testing"

func TestMin(t *testing.T) {
t.Parallel()

type args struct {
a uint64
b uint64
Expand All @@ -28,10 +30,14 @@ func TestMin(t *testing.T) {
},
}

for intention, tc := range cases {
for intention, testCase := range cases {
intention, testCase := intention, testCase

t.Run(intention, func(t *testing.T) {
if got := min(tc.args.a, tc.args.b); got != tc.want {
t.Errorf("min() = %d, want %d", got, tc.want)
t.Parallel()

if got := min(testCase.args.a, testCase.args.b); got != testCase.want {
t.Errorf("min() = %d, want %d", got, testCase.want)
}
})
}
Expand Down
22 changes: 14 additions & 8 deletions pkg/middleware/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
)

func TestMiddleware(t *testing.T) {
t.Parallel()

cases := map[string]struct {
next http.Handler
request *http.Request
Expand Down Expand Up @@ -41,8 +43,12 @@ func TestMiddleware(t *testing.T) {
},
}

for intention, tc := range cases {
for intention, testCase := range cases {
intention, testCase := intention, testCase

t.Run(intention, func(t *testing.T) {
t.Parallel()

ctrl := gomock.NewController(t)
defer ctrl.Finish()

Expand All @@ -52,18 +58,18 @@ func TestMiddleware(t *testing.T) {
}

writer := httptest.NewRecorder()
New(userService).Middleware(tc.next).ServeHTTP(writer, tc.request)
New(userService).Middleware(testCase.next).ServeHTTP(writer, testCase.request)

if got := writer.Code; got != tc.wantStatus {
t.Errorf("Middleware = %d, want %d", got, tc.wantStatus)
if got := writer.Code; got != testCase.wantStatus {
t.Errorf("Middleware = %d, want %d", got, testCase.wantStatus)
}

if got, _ := request.ReadBodyResponse(writer.Result()); string(got) != tc.want {
t.Errorf("Middleware = `%s`, want `%s`", string(got), tc.want)
if got, _ := request.ReadBodyResponse(writer.Result()); string(got) != testCase.want {
t.Errorf("Middleware = `%s`, want `%s`", string(got), testCase.want)
}

for key := range tc.wantHeader {
want := tc.wantHeader.Get(key)
for key := range testCase.wantHeader {
want := testCase.wantHeader.Get(key)
if got := writer.Header().Get(key); got != want {
t.Errorf("`%s` Header = `%s`, want `%s`", key, got, want)
}
Expand Down
76 changes: 53 additions & 23 deletions pkg/model/ketchup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
)

func TestParseKetchupFrequency(t *testing.T) {
t.Parallel()

type args struct {
value string
}
Expand Down Expand Up @@ -43,30 +45,36 @@ func TestParseKetchupFrequency(t *testing.T) {
},
}

for intention, tc := range cases {
for intention, testCase := range cases {
intention, testCase := intention, testCase

t.Run(intention, func(t *testing.T) {
got, gotErr := ParseKetchupFrequency(tc.args.value)
t.Parallel()

got, gotErr := ParseKetchupFrequency(testCase.args.value)

failed := false

if tc.wantErr == nil && gotErr != nil {
if testCase.wantErr == nil && gotErr != nil {
failed = true
} else if tc.wantErr != nil && gotErr == nil {
} else if testCase.wantErr != nil && gotErr == nil {
failed = true
} else if tc.wantErr != nil && !strings.Contains(gotErr.Error(), tc.wantErr.Error()) {
} else if testCase.wantErr != nil && !strings.Contains(gotErr.Error(), testCase.wantErr.Error()) {
failed = true
} else if got != tc.want {
} else if got != testCase.want {
failed = true
}

if failed {
t.Errorf("ParseRepositoryKind() = (`%s`, `%s`), want (`%s`, `%s`)", got, gotErr, tc.want, tc.wantErr)
t.Errorf("ParseRepositoryKind() = (`%s`, `%s`), want (`%s`, `%s`)", got, gotErr, testCase.want, testCase.wantErr)
}
})
}
}

func TestKetchupByRepositoryID(t *testing.T) {
t.Parallel()

type args struct {
array []Ketchup
}
Expand All @@ -91,17 +99,23 @@ func TestKetchupByRepositoryID(t *testing.T) {
},
}

for intention, tc := range cases {
for intention, testCase := range cases {
intention, testCase := intention, testCase

t.Run(intention, func(t *testing.T) {
sort.Sort(KetchupByRepositoryIDAndPattern(tc.args.array))
if got := tc.args.array; !reflect.DeepEqual(got, tc.want) {
t.Errorf("KetchupByRepositoryID() = %+v, want %+v", got, tc.want)
t.Parallel()

sort.Sort(KetchupByRepositoryIDAndPattern(testCase.args.array))
if got := testCase.args.array; !reflect.DeepEqual(got, testCase.want) {
t.Errorf("KetchupByRepositoryID() = %+v, want %+v", got, testCase.want)
}
})
}
}

func TestKetchupByPriority(t *testing.T) {
t.Parallel()

type args struct {
array []Ketchup
}
Expand Down Expand Up @@ -168,17 +182,23 @@ func TestKetchupByPriority(t *testing.T) {
},
}

for intention, tc := range cases {
for intention, testCase := range cases {
intention, testCase := intention, testCase

t.Run(intention, func(t *testing.T) {
sort.Sort(KetchupByPriority(tc.args.array))
if got := tc.args.array; !reflect.DeepEqual(got, tc.want) {
t.Errorf("KetchupByPriority() = %+v, want %+v", got, tc.want)
t.Parallel()

sort.Sort(KetchupByPriority(testCase.args.array))
if got := testCase.args.array; !reflect.DeepEqual(got, testCase.want) {
t.Errorf("KetchupByPriority() = %+v, want %+v", got, testCase.want)
}
})
}
}

func TestReleaseByRepositoryID(t *testing.T) {
t.Parallel()

type args struct {
array []Release
}
Expand All @@ -203,17 +223,23 @@ func TestReleaseByRepositoryID(t *testing.T) {
},
}

for intention, tc := range cases {
for intention, testCase := range cases {
intention, testCase := intention, testCase

t.Run(intention, func(t *testing.T) {
sort.Sort(ReleaseByRepositoryIDAndPattern(tc.args.array))
if got := tc.args.array; !reflect.DeepEqual(got, tc.want) {
t.Errorf("ReleaseByRepositoryID() = %+v, want %+v", got, tc.want)
t.Parallel()

sort.Sort(ReleaseByRepositoryIDAndPattern(testCase.args.array))
if got := testCase.args.array; !reflect.DeepEqual(got, testCase.want) {
t.Errorf("ReleaseByRepositoryID() = %+v, want %+v", got, testCase.want)
}
})
}
}

func TestReleaseByKindAndName(t *testing.T) {
t.Parallel()

type args struct {
array []Release
}
Expand All @@ -238,11 +264,15 @@ func TestReleaseByKindAndName(t *testing.T) {
},
}

for intention, tc := range cases {
for intention, testCase := range cases {
intention, testCase := intention, testCase

t.Run(intention, func(t *testing.T) {
sort.Sort(ReleaseByKindAndName(tc.args.array))
if got := tc.args.array; !reflect.DeepEqual(got, tc.want) {
t.Errorf("ReleaseByRepositoryID() = %+v, want %+v", got, tc.want)
t.Parallel()

sort.Sort(ReleaseByKindAndName(testCase.args.array))
if got := testCase.args.array; !reflect.DeepEqual(got, testCase.want) {
t.Errorf("ReleaseByRepositoryID() = %+v, want %+v", got, testCase.want)
}
})
}
Expand Down
Loading

0 comments on commit b01d26d

Please sign in to comment.