From 1c514f45ac131a521dca937c28aa2db47123aa2d Mon Sep 17 00:00:00 2001 From: zackattack01 Date: Thu, 27 Jun 2024 12:14:36 -0400 Subject: [PATCH] fix up power watcher tests and stubs for non-windows --- .../power_event_watcher_other.go | 16 ++++------------ .../power_event_watcher_other_test.go | 3 ++- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/ee/powereventwatcher/power_event_watcher_other.go b/ee/powereventwatcher/power_event_watcher_other.go index 676f82971..dd0d0d7a7 100644 --- a/ee/powereventwatcher/power_event_watcher_other.go +++ b/ee/powereventwatcher/power_event_watcher_other.go @@ -16,21 +16,13 @@ type noOpPowerEventWatcher struct { interrupted bool } -type knapsackSubscriber struct{} +type noOpKnapsackSubscriber struct{} -func NewKnapsackSubscriber(_ *slog.Logger, _ types.Knapsack) *knapsackSubscriber { - return &knapsackSubscriber{} +func NewKnapsackSubscriber(_ *slog.Logger, _ types.Knapsack) *noOpKnapsackSubscriber { + return &noOpKnapsackSubscriber{} } -func (ks *knapsackSubscriber) OnPowerEvent(_ int) error { - return nil -} - -func (ks *knapsackSubscriber) OnStartup() error { - return nil -} - -func New(ctx context.Context, _ types.Knapsack, _ *slog.Logger) (*noOpPowerEventWatcher, error) { +func New(ctx context.Context, _ *slog.Logger, _ *noOpKnapsackSubscriber) (*noOpPowerEventWatcher, error) { _, span := traces.StartSpan(ctx) defer span.End() diff --git a/ee/powereventwatcher/power_event_watcher_other_test.go b/ee/powereventwatcher/power_event_watcher_other_test.go index ca4b62525..5ad4907b4 100644 --- a/ee/powereventwatcher/power_event_watcher_other_test.go +++ b/ee/powereventwatcher/power_event_watcher_other_test.go @@ -17,7 +17,8 @@ import ( func TestInterrupt_Multiple(t *testing.T) { t.Parallel() - p, err := New(context.TODO(), typesmocks.NewKnapsack(t), multislogger.NewNopLogger()) + ksubscriber := NewKnapsackSubscriber(multislogger.NewNopLogger(), typesmocks.NewKnapsack(t)) + p, err := New(context.TODO(), multislogger.NewNopLogger(), ksubscriber) require.NoError(t, err) // Start and then interrupt