2023-04-10 15:36:59 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2018-11-27 04:40:55 +00:00
|
|
|
package pluginmanager
|
|
|
|
|
2020-12-10 15:27:15 +00:00
|
|
|
import "context"
|
|
|
|
|
2018-11-27 04:40:55 +00:00
|
|
|
type MockPluginManager struct {
|
2020-12-10 15:27:15 +00:00
|
|
|
RunF func()
|
|
|
|
ShutdownF func()
|
|
|
|
WaitForFirstFingerprintCh <-chan struct{}
|
2018-11-27 04:40:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *MockPluginManager) Run() { m.RunF() }
|
|
|
|
func (m *MockPluginManager) Shutdown() { m.ShutdownF() }
|
|
|
|
func (m *MockPluginManager) PluginType() string { return "mock" }
|
2020-12-10 15:27:15 +00:00
|
|
|
func (m *MockPluginManager) WaitForFirstFingerprint(ctx context.Context) <-chan struct{} {
|
|
|
|
if m.WaitForFirstFingerprintCh != nil {
|
|
|
|
return m.WaitForFirstFingerprintCh
|
|
|
|
}
|
|
|
|
|
|
|
|
ch := make(chan struct{})
|
|
|
|
close(ch)
|
|
|
|
return ch
|
|
|
|
}
|