Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No more sending on closed channels during checkscontroller shutdown #245

Merged
merged 10 commits into from
Jan 27, 2025
Prev Previous commit
Next Next commit
test: added metrics to the tests
puffitos committed Dec 23, 2024
commit 0c7eb4a485a11f670407c5f037626638e91df286
4 changes: 4 additions & 0 deletions pkg/sparrow/targets/manager_test.go
Original file line number Diff line number Diff line change
@@ -121,6 +121,7 @@ func Test_gitlabTargetManager_refreshTargets(t *testing.T) {
interactor: remote,
name: "test",
cfg: General{UnhealthyThreshold: time.Hour, Scheme: "https"},
metrics: newMetrics(),
}
if err := gtm.refreshTargets(context.Background()); (err != nil) != (tt.wantErr != nil) {
t.Fatalf("refreshTargets() error = %v, wantErr %v", err, tt.wantErr)
@@ -193,6 +194,7 @@ func Test_gitlabTargetManager_refreshTargets_No_Threshold(t *testing.T) {
interactor: remote,
name: "test",
cfg: General{UnhealthyThreshold: 0, Scheme: "https"},
metrics: newMetrics(),
}
if err := gtm.refreshTargets(context.Background()); (err != nil) != (tt.wantErr != nil) {
t.Fatalf("refreshTargets() error = %v, wantErr %v", err, tt.wantErr)
@@ -304,6 +306,7 @@ func Test_gitlabTargetManager_register(t *testing.T) {
}
gtm := &manager{
interactor: glmock,
metrics: newMetrics(),
}
if err := gtm.register(context.Background()); (err != nil) != tt.wantErr {
t.Fatalf("register() error = %v, wantErr %v", err, tt.wantErr)
@@ -830,6 +833,7 @@ func mockGitlabTargetManager(g *remotemock.MockClient, name string) *manager { /
done: make(chan struct{}, 1),
interactor: g,
name: name,
metrics: newMetrics(),
cfg: General{
CheckInterval: 100 * time.Millisecond,
UnhealthyThreshold: 1 * time.Second,