Files
ITWorx-Pulse-Public/internal/service/signal_test.go
T
ITWorx Pulse release export bd774932d5
Public source validation / validate (push) Failing after 3m8s
Publish ITWorx Pulse source
2026-09-03 02:09:19 +02:00

26 lines
452 B
Go

package service
import (
"context"
"os"
"testing"
"time"
)
func TestWaitForStopReturnsOnSignal(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
signals := make(chan os.Signal, 1)
done := make(chan struct{})
go func() {
WaitForStop(ctx, signals)
close(done)
}()
signals <- os.Interrupt
select {
case <-done:
case <-time.After(time.Second):
t.Fatal("shutdown did not return after signal")
}
}