mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
rename NomadConfig to ClientAgentConfig
This commit is contained in:
@@ -43,7 +43,7 @@ func (s *SingletonLoader) Catalog() map[string][]*base.PluginInfoResponse {
|
||||
// Dispense returns the plugin given its name and type. This will also
|
||||
// configure the plugin. If there is an instance of an already running plugin,
|
||||
// this is used.
|
||||
func (s *SingletonLoader) Dispense(name, pluginType string, config *base.NomadConfig, logger log.Logger) (loader.PluginInstance, error) {
|
||||
func (s *SingletonLoader) Dispense(name, pluginType string, config *base.ClientAgentConfig, logger log.Logger) (loader.PluginInstance, error) {
|
||||
return s.getPlugin(false, name, pluginType, logger, config, nil)
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func (s *SingletonLoader) Reattach(name, pluginType string, config *plugin.Reatt
|
||||
// getPlugin is a helper that either dispenses or reattaches to a plugin using
|
||||
// futures to ensure only a single instance is retrieved
|
||||
func (s *SingletonLoader) getPlugin(reattach bool, name, pluginType string, logger log.Logger,
|
||||
nomadConfig *base.NomadConfig, config *plugin.ReattachConfig) (loader.PluginInstance, error) {
|
||||
nomadConfig *base.ClientAgentConfig, config *plugin.ReattachConfig) (loader.PluginInstance, error) {
|
||||
|
||||
// Lock the instance map to prevent races
|
||||
s.instanceLock.Lock()
|
||||
@@ -95,7 +95,7 @@ func (s *SingletonLoader) getPlugin(reattach bool, name, pluginType string, logg
|
||||
|
||||
// dispense should be called in a go routine to not block and creates the
|
||||
// desired plugin, setting the results in the future.
|
||||
func (s *SingletonLoader) dispense(f *future, name, pluginType string, config *base.NomadConfig, logger log.Logger) {
|
||||
func (s *SingletonLoader) dispense(f *future, name, pluginType string, config *base.ClientAgentConfig, logger log.Logger) {
|
||||
i, err := s.loader.Dispense(name, pluginType, config, logger)
|
||||
f.set(i, err)
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ func TestSingleton_Dispense(t *testing.T) {
|
||||
|
||||
dispenseCalled := 0
|
||||
s, c := harness(t)
|
||||
c.DispenseF = func(_, _ string, _ *base.NomadConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
c.DispenseF = func(_, _ string, _ *base.ClientAgentConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
p := &base.MockPlugin{}
|
||||
i := &loader.MockInstance{
|
||||
ExitedF: func() bool { return false },
|
||||
@@ -77,7 +77,7 @@ func TestSingleton_Dispense_Exit_Dispense(t *testing.T) {
|
||||
exited := false
|
||||
dispenseCalled := 0
|
||||
s, c := harness(t)
|
||||
c.DispenseF = func(_, _ string, _ *base.NomadConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
c.DispenseF = func(_, _ string, _ *base.ClientAgentConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
p := &base.MockPlugin{}
|
||||
i := &loader.MockInstance{
|
||||
ExitedF: func() bool { return exited },
|
||||
@@ -125,7 +125,7 @@ func TestSingleton_DispenseError_Dispense(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
dispenseCalled := 0
|
||||
good := func(_, _ string, _ *base.NomadConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
good := func(_, _ string, _ *base.ClientAgentConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
p := &base.MockPlugin{}
|
||||
i := &loader.MockInstance{
|
||||
ExitedF: func() bool { return false },
|
||||
@@ -135,7 +135,7 @@ func TestSingleton_DispenseError_Dispense(t *testing.T) {
|
||||
return i, nil
|
||||
}
|
||||
|
||||
bad := func(_, _ string, _ *base.NomadConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
bad := func(_, _ string, _ *base.ClientAgentConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
dispenseCalled++
|
||||
return nil, fmt.Errorf("bad")
|
||||
}
|
||||
@@ -169,7 +169,7 @@ func TestSingleton_ReattachError_Dispense(t *testing.T) {
|
||||
|
||||
dispenseCalled, reattachCalled := 0, 0
|
||||
s, c := harness(t)
|
||||
c.DispenseF = func(_, _ string, _ *base.NomadConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
c.DispenseF = func(_, _ string, _ *base.ClientAgentConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
p := &base.MockPlugin{}
|
||||
i := &loader.MockInstance{
|
||||
ExitedF: func() bool { return false },
|
||||
@@ -209,7 +209,7 @@ func TestSingleton_Reattach_Dispense(t *testing.T) {
|
||||
|
||||
dispenseCalled, reattachCalled := 0, 0
|
||||
s, c := harness(t)
|
||||
c.DispenseF = func(_, _ string, _ *base.NomadConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
c.DispenseF = func(_, _ string, _ *base.ClientAgentConfig, _ log.Logger) (loader.PluginInstance, error) {
|
||||
dispenseCalled++
|
||||
return nil, fmt.Errorf("bad")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user