s/mananger/manager

This commit is contained in:
Preetha Appan 2019-03-04 12:25:54 -06:00
parent c9e7b11df1
commit 0e547d29ad
No known key found for this signature in database
GPG key ID: 9F7C19990A50EAFC
4 changed files with 17 additions and 17 deletions

View file

@ -148,10 +148,10 @@ func New(c *Config) *manager {
}
}
// PluginType returns the type of plugin this mananger mananges
// PluginType returns the type of plugin this manager mananges
func (*manager) PluginType() string { return base.PluginTypeDriver }
// Run starts the mananger, initializes driver plugins and blocks until Shutdown
// Run starts the manager, initializes driver plugins and blocks until Shutdown
// is called.
func (m *manager) Run() {
// Load any previous plugin reattach configuration

View file

@ -100,7 +100,7 @@ func mockTaskEvent(taskID string) *drivers.TaskEvent {
func noopUpdater(string, *structs.DriverInfo) {}
func noopEventHandlerFactory(string, string) EventHandler { return nil }
func TestMananger_Fingerprint(t *testing.T) {
func TestManager_Fingerprint(t *testing.T) {
t.Parallel()
require := require.New(t)
fpChan, _, mgr := testSetup(t)
@ -114,7 +114,7 @@ func TestMananger_Fingerprint(t *testing.T) {
testutil.WaitForResult(func() (bool, error) {
mgr.instancesMu.Lock()
defer mgr.instancesMu.Unlock()
return len(mgr.instances) == 1, fmt.Errorf("mananger should have registered 1 instance")
return len(mgr.instances) == 1, fmt.Errorf("manager should have registered 1 instance")
}, func(err error) {
require.NoError(err)
})
@ -167,7 +167,7 @@ func TestMananger_Fingerprint(t *testing.T) {
require.False(infos[2].Detected)
}
func TestMananger_TaskEvents(t *testing.T) {
func TestManager_TaskEvents(t *testing.T) {
t.Parallel()
require := require.New(t)
fpChan, evChan, mgr := testSetup(t)
@ -177,7 +177,7 @@ func TestMananger_TaskEvents(t *testing.T) {
testutil.WaitForResult(func() (bool, error) {
mgr.instancesMu.Lock()
defer mgr.instancesMu.Unlock()
return len(mgr.instances) == 1, fmt.Errorf("mananger should have registered 1 instance")
return len(mgr.instances) == 1, fmt.Errorf("manager should have registered 1 instance")
}, func(err error) {
require.NoError(err)
})
@ -212,7 +212,7 @@ func TestManager_Run_AllowedDrivers(t *testing.T) {
testutil.AssertUntil(200*time.Millisecond, func() (bool, error) {
mgr.instancesMu.Lock()
defer mgr.instancesMu.Unlock()
return len(mgr.instances) == 0, fmt.Errorf("mananger should have no registered instances")
return len(mgr.instances) == 0, fmt.Errorf("manager should have no registered instances")
}, func(err error) {
require.NoError(err)
})
@ -232,7 +232,7 @@ func TestManager_Run_BlockedDrivers(t *testing.T) {
testutil.AssertUntil(200*time.Millisecond, func() (bool, error) {
mgr.instancesMu.Lock()
defer mgr.instancesMu.Unlock()
return len(mgr.instances) == 0, fmt.Errorf("mananger should have no registered instances")
return len(mgr.instances) == 0, fmt.Errorf("manager should have no registered instances")
}, func(err error) {
require.NoError(err)
})
@ -285,7 +285,7 @@ func TestManager_Run_AllowedBlockedDrivers_Combined(t *testing.T) {
testutil.AssertUntil(250*time.Millisecond, func() (bool, error) {
mgr.instancesMu.Lock()
defer mgr.instancesMu.Unlock()
return len(mgr.instances) < 2, fmt.Errorf("mananger should have 1 registered instance, %v", len(mgr.instances))
return len(mgr.instances) < 2, fmt.Errorf("manager should have 1 registered instance, %v", len(mgr.instances))
}, func(err error) {
require.NoError(err)
})

View file

@ -17,7 +17,7 @@ type PluginGroup struct {
// shutdown indicates if shutdown has been called, access is synced by mLock
shutdown bool
// mLock gaurds manangers and shutdown
// mLock gaurds managers and shutdown
mLock sync.Mutex
logger log.Logger
@ -45,7 +45,7 @@ func (m *PluginGroup) RegisterAndRun(manager PluginManager) error {
return nil
}
// Ready returns a channel which will be closed once all plugin manangers are ready.
// Ready returns a channel which will be closed once all plugin managers are ready.
// A timeout for waiting on each manager is given
func (m *PluginGroup) WaitForFirstFingerprint(ctx context.Context) (<-chan struct{}, error) {
m.mLock.Lock()
@ -64,14 +64,14 @@ func (m *PluginGroup) WaitForFirstFingerprint(ctx context.Context) (<-chan struc
wg.Add(1)
go func() {
defer wg.Done()
logger.Debug("waiting on plugin mananger initial fingerprint")
logger.Debug("waiting on plugin manager initial fingerprint")
select {
case <-manager.WaitForFirstFingerprint(ctx):
select {
case <-ctx.Done():
logger.Warn("timeout waiting for plugin manager to be ready")
default:
logger.Debug("finished plugin mananger initial fingerprint")
logger.Debug("finished plugin manager initial fingerprint")
}
}
}()

View file

@ -15,13 +15,13 @@ func TestPluginGroup_RegisterAndRun(t *testing.T) {
var hasRun bool
var wg sync.WaitGroup
wg.Add(1)
mananger := &MockPluginManager{RunF: func() {
manager := &MockPluginManager{RunF: func() {
hasRun = true
wg.Done()
}}
group := New(testlog.HCLogger(t))
require.NoError(group.RegisterAndRun(mananger))
require.NoError(group.RegisterAndRun(manager))
wg.Wait()
require.True(hasRun)
}
@ -39,7 +39,7 @@ func TestPluginGroup_Shutdown(t *testing.T) {
i := i
runWg.Add(1)
shutdownWg.Add(1)
mananger := &MockPluginManager{RunF: func() {
manager := &MockPluginManager{RunF: func() {
stackMu.Lock()
defer stackMu.Unlock()
defer runWg.Done()
@ -53,7 +53,7 @@ func TestPluginGroup_Shutdown(t *testing.T) {
require.Equal(i, val)
stack = stack[:idx]
}}
require.NoError(group.RegisterAndRun(mananger))
require.NoError(group.RegisterAndRun(manager))
runWg.Wait()
}
group.Shutdown()