mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
plugin/driver: fix tests and add new dep to vendor
This commit is contained in:
@@ -175,6 +175,15 @@ type Capabilities struct {
|
||||
MustInitiateNetwork bool
|
||||
}
|
||||
|
||||
func (c *Capabilities) HasNetIsolationMode(m NetIsolationMode) bool {
|
||||
for _, mode := range c.NetIsolationModes {
|
||||
if mode == m {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type NetIsolationMode string
|
||||
|
||||
var (
|
||||
|
||||
@@ -195,6 +195,19 @@ type MockDriver struct {
|
||||
SignalTaskF func(string, string) error
|
||||
ExecTaskF func(string, []string, time.Duration) (*drivers.ExecTaskResult, error)
|
||||
ExecTaskStreamingF func(context.Context, string, *drivers.ExecOptions) (*drivers.ExitResult, error)
|
||||
MockNetworkManager
|
||||
}
|
||||
|
||||
type MockNetworkManager struct {
|
||||
CreateNetworkF func(string) (*drivers.NetworkIsolationSpec, error)
|
||||
DestroyNetworkF func(string, *drivers.NetworkIsolationSpec) error
|
||||
}
|
||||
|
||||
func (m *MockNetworkManager) CreateNetwork(id string) (*drivers.NetworkIsolationSpec, error) {
|
||||
return m.CreateNetworkF(id)
|
||||
}
|
||||
func (m *MockNetworkManager) DestroyNetwork(id string, spec *drivers.NetworkIsolationSpec) error {
|
||||
return m.DestroyNetworkF(id, spec)
|
||||
}
|
||||
|
||||
func (d *MockDriver) TaskConfigSchema() (*hclspec.Spec, error) { return d.TaskConfigSchemaF() }
|
||||
|
||||
Reference in New Issue
Block a user