Skip to content

Commit

Permalink
fix up power watcher tests and stubs for non-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
zackattack01 committed Jun 27, 2024
1 parent a3d0bef commit 57d1252
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
16 changes: 4 additions & 12 deletions ee/powereventwatcher/power_event_watcher_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
3 changes: 2 additions & 1 deletion ee/powereventwatcher/power_event_watcher_other_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 57d1252

Please sign in to comment.