From 730a6f5b9a75b52a8456c2121775d32206d11176 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Tue, 18 Dec 2018 15:07:30 -0800 Subject: [PATCH] lint --- client/fingerprint_manager_test.go | 2 +- devices/gpu/nvidia/device.go | 2 +- drivers/rkt/driver_test.go | 12 ++++++++---- plugins/shared/loader/api_versions.go | 4 ++-- plugins/shared/loader/loader_test.go | 6 +++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/client/fingerprint_manager_test.go b/client/fingerprint_manager_test.go index 922559ba2..f9095a0b2 100644 --- a/client/fingerprint_manager_test.go +++ b/client/fingerprint_manager_test.go @@ -565,7 +565,7 @@ func TestFingerprintManager_Run_DriverFailure(t *testing.T) { dispenseCalls := 0 loader := &loader.MockCatalog{ - DispenseF: func(name, pluginType string, cfg *base.ClientAgentConfig, logger log.Logger) (loader.PluginInstance, error) { + DispenseF: func(name, pluginType string, cfg *base.AgentConfig, logger log.Logger) (loader.PluginInstance, error) { if pluginType == base.PluginTypeDriver && name == "raw_exec" { dispenseCalls++ } diff --git a/devices/gpu/nvidia/device.go b/devices/gpu/nvidia/device.go index 97be7d153..110287681 100644 --- a/devices/gpu/nvidia/device.go +++ b/devices/gpu/nvidia/device.go @@ -38,7 +38,7 @@ var ( // pluginInfo describes the plugin pluginInfo = &base.PluginInfoResponse{ Type: base.PluginTypeDevice, - PluginApiVersions: []string{"v0.2.0"}, + PluginApiVersions: []string{device.ApiVersion010}, PluginVersion: "0.1.0", Name: pluginName, } diff --git a/drivers/rkt/driver_test.go b/drivers/rkt/driver_test.go index 9ac402dd7..95a75e371 100644 --- a/drivers/rkt/driver_test.go +++ b/drivers/rkt/driver_test.go @@ -64,13 +64,15 @@ func TestRktDriver_SetConfig(t *testing.T) { var data []byte require.NoError(basePlug.MsgPackEncode(&data, config)) - require.NoError(harness.SetConfig(data, nil)) + bconfig := &basePlug.Config{PluginConfig: data} + require.NoError(harness.SetConfig(bconfig)) require.Exactly(config, d.(*Driver).config) config.VolumesEnabled = false data = []byte{} require.NoError(basePlug.MsgPackEncode(&data, config)) - require.NoError(harness.SetConfig(data, nil)) + bconfig = &basePlug.Config{PluginConfig: data} + require.NoError(harness.SetConfig(bconfig)) require.Exactly(config, d.(*Driver).config) } @@ -446,7 +448,8 @@ func TestRktDriver_Start_Wait_Volume(t *testing.T) { var data []byte require.NoError(basePlug.MsgPackEncode(&data, config)) - require.NoError(harness.SetConfig(data, nil)) + bconfig := &basePlug.Config{PluginConfig: data} + require.NoError(harness.SetConfig(bconfig)) task := &drivers.TaskConfig{ ID: uuid.Generate(), @@ -530,7 +533,8 @@ func TestRktDriver_Start_Wait_TaskMounts(t *testing.T) { var data []byte require.NoError(basePlug.MsgPackEncode(&data, config)) - require.NoError(harness.SetConfig(data, nil)) + bconfig := &basePlug.Config{PluginConfig: data} + require.NoError(harness.SetConfig(bconfig)) tmpvol, err := ioutil.TempDir("", "nomadtest_rktdriver_volumes") require.NoError(err) diff --git a/plugins/shared/loader/api_versions.go b/plugins/shared/loader/api_versions.go index 8ceb02da0..51a680b9c 100644 --- a/plugins/shared/loader/api_versions.go +++ b/plugins/shared/loader/api_versions.go @@ -9,7 +9,7 @@ var ( // AgentSupportedApiVersions is the set of API versions supported by the // Nomad agent by plugin type. AgentSupportedApiVersions = map[string][]string{ - base.PluginTypeDevice: []string{device.ApiVersion010}, - base.PluginTypeDriver: []string{device.ApiVersion010}, + base.PluginTypeDevice: {device.ApiVersion010}, + base.PluginTypeDriver: {device.ApiVersion010}, } ) diff --git a/plugins/shared/loader/loader_test.go b/plugins/shared/loader/loader_test.go index 82c8bb0b2..f8b31aea8 100644 --- a/plugins/shared/loader/loader_test.go +++ b/plugins/shared/loader/loader_test.go @@ -22,7 +22,7 @@ var ( // supportedApiVersions is the set of api versions that the "client" can // support supportedApiVersions = map[string][]string{ - base.PluginTypeDevice: []string{device.ApiVersion010}, + base.PluginTypeDevice: {device.ApiVersion010}, } ) @@ -177,7 +177,7 @@ func TestPluginLoader_External_ApiVersions(t *testing.T) { Logger: logger, PluginDir: h.pluginDir(), SupportedVersions: map[string][]string{ - base.PluginTypeDevice: []string{"0.2.0", "0.2.1", "0.3.0"}, + base.PluginTypeDevice: {"0.2.0", "0.2.1", "0.3.0"}, }, Configs: []*config.PluginConfig{ { @@ -527,7 +527,7 @@ func TestPluginLoader_Internal_ApiVersions(t *testing.T) { Logger: logger, PluginDir: h.pluginDir(), SupportedVersions: map[string][]string{ - base.PluginTypeDevice: []string{"0.2.0", "0.2.1", "0.3.0"}, + base.PluginTypeDevice: {"0.2.0", "0.2.1", "0.3.0"}, }, InternalPlugins: map[PluginID]*InternalPluginConfig{ {