Repository: dexidp/dex
Pull request #2141 (2021-05-26 12:51:58)

Update gosundheit
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>

<!--
Thank you for sending a pull request! Here some tips for contributors:

1. Fill the description template below.
2. Sign a DCO (if you haven't already signed it).
3. Include appropriate tests (if necessary). Make sure that all CI checks passed.
4. If the Pull Request is a work in progress, make use of GitHub's "Draft PR" feature and mark it as such.
-->

#### Overview

Update gosundheit

#### What this PR does / why we need it

To keep dependencies up-to-date.

#### Special notes for your reviewer

#### Does this PR introduce a user-facing change?

<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
NONE
```



Patch:
diff --git a/cmd/dex/serve.go b/cmd/dex/serve.go
index aaf36b32..fd7da833 100644
--- a/cmd/dex/serve.go
+++ b/cmd/dex/serve.go
@@ -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
 
diff --git a/go.mod b/go.mod
index b3cb6aa8..3baeaa26 100644
--- a/go.mod
+++ b/go.mod
@@ -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
diff --git a/go.sum b/go.sum
index 8bc5794c..713a288f 100644
--- a/go.sum
+++ b/go.sum
@@ -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=
diff --git a/storage/health.go b/storage/health.go
index 5df0373d..8a2f5a3d 100644
--- a/storage/health.go
+++ b/storage/health.go
@@ -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(),


Test patch:
diff --git a/server/handlers_test.go b/server/handlers_test.go
index d195af64..a1c60102 100644
--- a/server/handlers_test.go
+++ b/server/handlers_test.go
@@ -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()