This commit is contained in:
Alex Dadgar 2018-12-18 15:07:30 -08:00
parent 4c57d2ec4d
commit 730a6f5b9a
5 changed files with 15 additions and 11 deletions

View file

@ -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++
}

View file

@ -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,
}

View file

@ -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)

View file

@ -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},
}
)

View file

@ -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{
{