Merge pull request #2141 from dexidp/update-gosundheit

Update gosundheit
This commit is contained in:
Márk Sági-Kazár 2021-05-26 17:05:40 +02:00 committed by GitHub
commit aef61cea8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 16 deletions

View file

@ -336,14 +336,14 @@ func runServe(options serveOptions) error {
telemetryRouter.Handle("/healthz/ready", handler)
}
healthChecker.RegisterCheck(&gosundheit.Config{
Check: &checks.CustomCheck{
healthChecker.RegisterCheck(
&checks.CustomCheck{
CheckName: "storage",
CheckFunc: storage.NewCustomHealthCheckFunc(serverConfig.Storage, serverConfig.Now),
},
ExecutionPeriod: 15 * time.Second,
InitiallyPassing: true,
})
gosundheit.ExecutionPeriod(15*time.Second),
gosundheit.InitiallyPassing(true),
)
var group run.Group

2
go.mod
View file

@ -4,7 +4,7 @@ go 1.16
require (
entgo.io/ent v0.8.0
github.com/AppsFlyer/go-sundheit v0.3.1
github.com/AppsFlyer/go-sundheit v0.4.0
github.com/beevik/etree v1.1.0
github.com/coreos/go-oidc/v3 v3.0.0
github.com/dexidp/dex/api/v2 v2.0.0

4
go.sum
View file

@ -40,8 +40,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
entgo.io/ent v0.8.0 h1:xirrW//1oda7pp0bz+XssSOv4/C3nmgYQOxjIfljFt8=
entgo.io/ent v0.8.0/go.mod h1:KNjsukat/NJi6zJh1utwRadsbGOZsBbAZNDxkW7tMCc=
github.com/AppsFlyer/go-sundheit v0.3.1 h1:Zqnr3wV3WQmXonc234k9XZAoV2KHUHw3osR5k2iHQZE=
github.com/AppsFlyer/go-sundheit v0.3.1/go.mod h1:iZ8zWMS7idcvmqewf5mEymWWgoOiG/0WD4+aeh+heX4=
github.com/AppsFlyer/go-sundheit v0.4.0 h1:7ECd0YWaXJQ9LzdCFrpGxJVeAgXvNarN6uwxrJsh69A=
github.com/AppsFlyer/go-sundheit v0.4.0/go.mod h1:iZ8zWMS7idcvmqewf5mEymWWgoOiG/0WD4+aeh+heX4=
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28=
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=

View file

@ -43,16 +43,16 @@ func TestHandleHealthFailure(t *testing.T) {
httpServer, server := newTestServer(ctx, t, func(c *Config) {
c.HealthChecker = gosundheit.New()
c.HealthChecker.RegisterCheck(&gosundheit.Config{
Check: &checks.CustomCheck{
c.HealthChecker.RegisterCheck(
&checks.CustomCheck{
CheckName: "fail",
CheckFunc: func() (details interface{}, err error) {
CheckFunc: func(_ context.Context) (details interface{}, err error) {
return nil, errors.New("error")
},
},
InitiallyPassing: false,
ExecutionPeriod: 1 * time.Second,
})
gosundheit.InitiallyPassing(false),
gosundheit.ExecutionPeriod(1*time.Second),
)
})
defer httpServer.Close()

View file

@ -1,13 +1,14 @@
package storage
import (
"context"
"fmt"
"time"
)
// NewCustomHealthCheckFunc returns a new health check function.
func NewCustomHealthCheckFunc(s Storage, now func() time.Time) func() (details interface{}, err error) {
return func() (details interface{}, err error) {
func NewCustomHealthCheckFunc(s Storage, now func() time.Time) func(context.Context) (details interface{}, err error) {
return func(_ context.Context) (details interface{}, err error) {
a := AuthRequest{
ID: NewID(),
ClientID: NewID(),