Skip to content

Commit

Permalink
Fixed issue in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evg4b committed Apr 21, 2024
1 parent bb16f15 commit b15cf31
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/helpers/graceful_shutdown_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/signal"
"sync"
"sync/atomic"
"syscall"
"testing"
"time"
Expand Down Expand Up @@ -54,18 +55,19 @@ func TestGracefulShutdown(t *testing.T) {
t.Run("shutdown when context is done", WithGoroutines(func(t *testing.T, env *Env) {
ctx, cancel := context.WithCancel(context.Background())

called := false
called := &atomic.Bool{}

env.Go(func() {
err := GracefulShutdown(ctx, func(_ context.Context) error {
called = true
called.Store(true)

return nil
})
require.NoError(t, err)
})

env.CheckAfterAll(func() {
assert.True(t, called)
assert.True(t, called.Load())
})

cancel()
Expand Down

0 comments on commit b15cf31

Please sign in to comment.