From cd6879409cf1737865821c5feb01a3e2e148ed19 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Thu, 13 Dec 2018 16:21:41 -0800 Subject: [PATCH] Drivers --- client/allocrunner/taskrunner/task_runner.go | 5 +- drivers/docker/driver_test.go | 26 ++-- drivers/exec/driver_test.go | 10 +- drivers/java/driver_test.go | 10 +- drivers/lxc/driver_test.go | 20 ++- drivers/lxc/lxc.go | 2 +- drivers/lxc/lxc_test.go | 10 +- drivers/qemu/driver.go | 5 +- drivers/qemu/driver_test.go | 58 ++++++--- drivers/rkt/driver_test.go | 115 ++++++++++++------ drivers/shared/executor/executor_linux.go | 13 +- .../shared/executor/executor_linux_test.go | 4 +- drivers/shared/executor/executor_test.go | 7 +- 13 files changed, 186 insertions(+), 99 deletions(-) diff --git a/client/allocrunner/taskrunner/task_runner.go b/client/allocrunner/taskrunner/task_runner.go index 174d11bba..bbeb5726e 100644 --- a/client/allocrunner/taskrunner/task_runner.go +++ b/client/allocrunner/taskrunner/task_runner.go @@ -697,15 +697,14 @@ func (tr *TaskRunner) buildTaskConfig() *drivers.TaskConfig { task := tr.Task() alloc := tr.Alloc() invocationid := uuid.Generate()[:8] - - // TODO This shouldn't use the task resources + taskResources := tr.taskResources return &drivers.TaskConfig{ ID: fmt.Sprintf("%s/%s/%s", alloc.ID, task.Name, invocationid), Name: task.Name, JobName: alloc.Job.Name, Resources: &drivers.Resources{ - NomadResources: task.Resources, + NomadResources: taskResources, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: int64(task.Resources.MemoryMB) * 1024 * 1024, CPUShares: int64(task.Resources.CPU), diff --git a/drivers/docker/driver_test.go b/drivers/docker/driver_test.go index e2906f3e4..8335ff97d 100644 --- a/drivers/docker/driver_test.go +++ b/drivers/docker/driver_test.go @@ -17,8 +17,6 @@ import ( "testing" "time" - dtestutil "github.com/hashicorp/nomad/plugins/drivers/testutils" - docker "github.com/fsouza/go-dockerclient" "github.com/hashicorp/consul/lib/freeport" hclog "github.com/hashicorp/go-hclog" @@ -30,6 +28,7 @@ import ( "github.com/hashicorp/nomad/nomad/structs" "github.com/hashicorp/nomad/plugins/base" "github.com/hashicorp/nomad/plugins/drivers" + dtestutil "github.com/hashicorp/nomad/plugins/drivers/testutils" "github.com/hashicorp/nomad/plugins/shared/loader" tu "github.com/hashicorp/nomad/testutil" "github.com/stretchr/testify/assert" @@ -38,10 +37,13 @@ import ( var ( basicResources = &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 256, - CPU: 512, - DiskMB: 20, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 256, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 250, + }, }, LinuxResources: &drivers.LinuxResources{ CPUShares: 512, @@ -96,9 +98,13 @@ func dockerTask(t *testing.T) (*drivers.TaskConfig, *TaskConfig, []int) { ID: uuid.Generate(), Name: "redis-demo", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 256, - CPU: 512, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 256, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 512, + }, Networks: []*structs.NetworkResource{ { IP: "127.0.0.1", @@ -2259,7 +2265,7 @@ func TestDockerDriver_OOMKilled(t *testing.T) { Resources: basicResources, } task.Resources.LinuxResources.MemoryLimitBytes = 10 * 1024 * 1024 - task.Resources.NomadResources.MemoryMB = 10 + task.Resources.NomadResources.Memory.MemoryMB = 10 require.NoError(t, task.EncodeConcreteDriverConfig(&taskCfg)) diff --git a/drivers/exec/driver_test.go b/drivers/exec/driver_test.go index bb7322ba8..eee5c426e 100644 --- a/drivers/exec/driver_test.go +++ b/drivers/exec/driver_test.go @@ -35,9 +35,13 @@ func TestMain(m *testing.M) { } var testResources = &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, diff --git a/drivers/java/driver_test.go b/drivers/java/driver_test.go index 34ba1fb1e..89966c571 100644 --- a/drivers/java/driver_test.go +++ b/drivers/java/driver_test.go @@ -249,9 +249,13 @@ func basicTask(t *testing.T, name string, taskConfig map[string]interface{}) *dr ID: uuid.Generate(), Name: name, Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, diff --git a/drivers/lxc/driver_test.go b/drivers/lxc/driver_test.go index f031c103f..8a79510a1 100644 --- a/drivers/lxc/driver_test.go +++ b/drivers/lxc/driver_test.go @@ -102,9 +102,13 @@ func TestLXCDriver_Start_Wait(t *testing.T) { ID: uuid.Generate(), Name: "test", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - CPU: 1, - MemoryMB: 2, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 2, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 1024, + }, }, LinuxResources: &drivers.LinuxResources{ CPUShares: 1024, @@ -196,9 +200,13 @@ func TestLXCDriver_Start_Stop(t *testing.T) { ID: uuid.Generate(), Name: "test", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - CPU: 1, - MemoryMB: 2, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 2, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 1024, + }, }, LinuxResources: &drivers.LinuxResources{ CPUShares: 1024, diff --git a/drivers/lxc/lxc.go b/drivers/lxc/lxc.go index 721752342..c1431591b 100644 --- a/drivers/lxc/lxc.go +++ b/drivers/lxc/lxc.go @@ -209,7 +209,7 @@ func (d *Driver) formatMount(hostPath, taskPath string, readOnly bool) string { } func (d *Driver) setResourceLimits(c *lxc.Container, cfg *drivers.TaskConfig) error { - if err := c.SetMemoryLimit(lxc.ByteSize(cfg.Resources.NomadResources.MemoryMB) * lxc.MB); err != nil { + if err := c.SetMemoryLimit(lxc.ByteSize(cfg.Resources.NomadResources.Memory.MemoryMB) * lxc.MB); err != nil { return fmt.Errorf("unable to set memory limits: %v", err) } diff --git a/drivers/lxc/lxc_test.go b/drivers/lxc/lxc_test.go index 99f4d2ac6..2aed490a7 100644 --- a/drivers/lxc/lxc_test.go +++ b/drivers/lxc/lxc_test.go @@ -19,9 +19,13 @@ func TestLXCDriver_Mounts(t *testing.T) { ID: uuid.Generate(), Name: "test", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - CPU: 1, - MemoryMB: 2, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 2, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 1024, + }, }, LinuxResources: &drivers.LinuxResources{ CPUShares: 1024, diff --git a/drivers/qemu/driver.go b/drivers/qemu/driver.go index 8b07ce298..17ccf7f11 100644 --- a/drivers/qemu/driver.go +++ b/drivers/qemu/driver.go @@ -318,10 +318,11 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *cstru accelerator = driverConfig.Accelerator } - if cfg.Resources.NomadResources.MemoryMB < 128 || cfg.Resources.NomadResources.MemoryMB > 4000000 { + mb := cfg.Resources.NomadResources.Memory.MemoryMB + if mb < 128 || mb > 4000000 { return nil, nil, fmt.Errorf("Qemu memory assignment out of bounds") } - mem := fmt.Sprintf("%dM", cfg.Resources.NomadResources.MemoryMB) + mem := fmt.Sprintf("%dM", mb) absPath, err := GetAbsolutePath("qemu-system-x86_64") if err != nil { diff --git a/drivers/qemu/driver_test.go b/drivers/qemu/driver_test.go index 545fa43e8..53901f0b7 100644 --- a/drivers/qemu/driver_test.go +++ b/drivers/qemu/driver_test.go @@ -1,24 +1,22 @@ package qemu import ( + "context" + "fmt" "io" "os" "path/filepath" "strings" "testing" - - "context" - "fmt" "time" - dtestutil "github.com/hashicorp/nomad/plugins/drivers/testutils" - "github.com/hashicorp/hcl2/hcl" ctestutil "github.com/hashicorp/nomad/client/testutil" "github.com/hashicorp/nomad/helper/testlog" "github.com/hashicorp/nomad/helper/uuid" "github.com/hashicorp/nomad/nomad/structs" "github.com/hashicorp/nomad/plugins/drivers" + dtestutil "github.com/hashicorp/nomad/plugins/drivers/testutils" "github.com/hashicorp/nomad/plugins/shared" "github.com/hashicorp/nomad/plugins/shared/hclspec" pstructs "github.com/hashicorp/nomad/plugins/shared/structs" @@ -44,9 +42,13 @@ func TestQemuDriver_Start_Wait_Stop(t *testing.T) { ID: uuid.Generate(), Name: "linux", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 512, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 512, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, Networks: []*structs.NetworkResource{ { ReservedPorts: []structs.Port{{Label: "main", Value: 22000}, {Label: "web", Value: 80}}, @@ -102,9 +104,13 @@ func TestQemuDriver_GetMonitorPathOldQemu(t *testing.T) { ID: uuid.Generate(), Name: "linux", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 512, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 512, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, Networks: []*structs.NetworkResource{ { ReservedPorts: []structs.Port{{Label: "main", Value: 22000}, {Label: "web", Value: 80}}, @@ -153,9 +159,13 @@ func TestQemuDriver_GetMonitorPathNewQemu(t *testing.T) { ID: uuid.Generate(), Name: "linux", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 512, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 512, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, Networks: []*structs.NetworkResource{ { ReservedPorts: []structs.Port{{Label: "main", Value: 22000}, {Label: "web", Value: 80}}, @@ -243,9 +253,13 @@ func TestQemuDriver_User(t *testing.T) { Name: "linux", User: "alice", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 512, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 512, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, Networks: []*structs.NetworkResource{ { ReservedPorts: []structs.Port{{Label: "main", Value: 22000}, {Label: "web", Value: 80}}, @@ -295,9 +309,13 @@ func TestQemuDriver_Stats(t *testing.T) { ID: uuid.Generate(), Name: "linux", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 512, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 512, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, Networks: []*structs.NetworkResource{ { ReservedPorts: []structs.Port{{Label: "main", Value: 22000}, {Label: "web", Value: 80}}, diff --git a/drivers/rkt/driver_test.go b/drivers/rkt/driver_test.go index b58eb3ddf..9ac402dd7 100644 --- a/drivers/rkt/driver_test.go +++ b/drivers/rkt/driver_test.go @@ -13,9 +13,6 @@ import ( "testing" "time" - dtestutil "github.com/hashicorp/nomad/plugins/drivers/testutils" - "golang.org/x/sys/unix" - "github.com/hashicorp/hcl2/hcl" ctestutil "github.com/hashicorp/nomad/client/testutil" "github.com/hashicorp/nomad/helper/testlog" @@ -24,10 +21,12 @@ import ( "github.com/hashicorp/nomad/nomad/structs" basePlug "github.com/hashicorp/nomad/plugins/base" "github.com/hashicorp/nomad/plugins/drivers" + dtestutil "github.com/hashicorp/nomad/plugins/drivers/testutils" "github.com/hashicorp/nomad/plugins/shared" "github.com/hashicorp/nomad/plugins/shared/hclspec" "github.com/hashicorp/nomad/testutil" "github.com/stretchr/testify/require" + "golang.org/x/sys/unix" ) var _ drivers.DriverPlugin = (*Driver)(nil) @@ -93,9 +92,13 @@ func TestRktDriver_Start_Wait_Stop_DNS(t *testing.T) { AllocID: uuid.Generate(), Name: "etcd", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, @@ -173,9 +176,13 @@ func TestRktDriver_Start_Wait_Stop(t *testing.T) { AllocID: uuid.Generate(), Name: "etcd", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, @@ -228,9 +235,13 @@ func TestRktDriver_Start_Wait_Skip_Trust(t *testing.T) { AllocID: uuid.Generate(), Name: "etcd", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, @@ -283,9 +294,13 @@ func TestRktDriver_InvalidTrustPrefix(t *testing.T) { AllocID: uuid.Generate(), Name: "etcd", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, @@ -334,9 +349,13 @@ func TestRktDriver_StartWaitRecoverWaitStop(t *testing.T) { AllocID: uuid.Generate(), Name: "etcd", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, @@ -434,9 +453,13 @@ func TestRktDriver_Start_Wait_Volume(t *testing.T) { AllocID: uuid.Generate(), Name: "rkttest_alpine", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, @@ -518,9 +541,13 @@ func TestRktDriver_Start_Wait_TaskMounts(t *testing.T) { AllocID: uuid.Generate(), Name: "rkttest_alpine", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, @@ -586,9 +613,13 @@ func TestRktDriver_PortMapping(t *testing.T) { AllocID: uuid.Generate(), Name: "redis", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, Networks: []*structs.NetworkResource{ { IP: "127.0.0.1", @@ -640,9 +671,13 @@ func TestRktDriver_UserGroup(t *testing.T) { User: "nobody", Name: "rkttest_alpine", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, @@ -702,9 +737,13 @@ func TestRktDriver_Exec(t *testing.T) { AllocID: uuid.Generate(), Name: "etcd", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, @@ -780,9 +819,13 @@ func TestRktDriver_Stats(t *testing.T) { AllocID: uuid.Generate(), Name: "etcd", Resources: &drivers.Resources{ - NomadResources: &structs.Resources{ - MemoryMB: 128, - CPU: 100, + NomadResources: &structs.AllocatedTaskResources{ + Memory: structs.AllocatedMemoryResources{ + MemoryMB: 128, + }, + Cpu: structs.AllocatedCpuResources{ + CpuShares: 100, + }, }, LinuxResources: &drivers.LinuxResources{ MemoryLimitBytes: 134217728, diff --git a/drivers/shared/executor/executor_linux.go b/drivers/shared/executor/executor_linux.go index 07197c1f4..83f405f8e 100644 --- a/drivers/shared/executor/executor_linux.go +++ b/drivers/shared/executor/executor_linux.go @@ -105,7 +105,7 @@ func (l *LibcontainerExecutor) Launch(command *ExecCommand) (*ProcessState, erro if command.Resources == nil { command.Resources = &drivers.Resources{ - NomadResources: &structs.Resources{}, + NomadResources: &structs.AllocatedTaskResources{}, } } @@ -578,20 +578,21 @@ func configureCgroups(cfg *lconfigs.Config, command *ExecCommand) error { return nil } - if command.Resources.NomadResources.MemoryMB > 0 { + if mb := command.Resources.NomadResources.Memory.MemoryMB; mb > 0 { // Total amount of memory allowed to consume - cfg.Cgroups.Resources.Memory = int64(command.Resources.NomadResources.MemoryMB * 1024 * 1024) + cfg.Cgroups.Resources.Memory = int64(mb * 1024 * 1024) // Disable swap to avoid issues on the machine var memSwappiness uint64 cfg.Cgroups.Resources.MemorySwappiness = &memSwappiness } - if command.Resources.NomadResources.CPU < 2 { - return fmt.Errorf("resources.CPU must be equal to or greater than 2: %v", command.Resources.NomadResources.CPU) + cpuShares := command.Resources.NomadResources.Cpu.CpuShares + if cpuShares < 2 { + return fmt.Errorf("resources.Cpu.CpuShares must be equal to or greater than 2: %v", cpuShares) } // Set the relative CPU shares for this cgroup. - cfg.Cgroups.Resources.CpuShares = uint64(command.Resources.NomadResources.CPU) + cfg.Cgroups.Resources.CpuShares = uint64(cpuShares) return nil } diff --git a/drivers/shared/executor/executor_linux_test.go b/drivers/shared/executor/executor_linux_test.go index f3ee4b596..7da6d6838 100644 --- a/drivers/shared/executor/executor_linux_test.go +++ b/drivers/shared/executor/executor_linux_test.go @@ -69,7 +69,7 @@ func testExecutorCommandWithChroot(t *testing.T) (*ExecCommand, *allocdir.AllocD Env: taskEnv.List(), TaskDir: td.Dir, Resources: &drivers.Resources{ - NomadResources: task.Resources, + NomadResources: alloc.AllocatedResources.Tasks[task.Name], }, } configureTLogging(cmd) @@ -109,7 +109,7 @@ func TestExecutor_IsolationAndConstraints(t *testing.T) { data, err := ioutil.ReadFile(memLimits) require.NoError(err) - expectedMemLim := strconv.Itoa(execCmd.Resources.NomadResources.MemoryMB * 1024 * 1024) + expectedMemLim := strconv.Itoa(int(execCmd.Resources.NomadResources.Memory.MemoryMB * 1024 * 1024)) actualMemLim := strings.TrimSpace(string(data)) require.Equal(actualMemLim, expectedMemLim) require.NoError(executor.Shutdown("", 0)) diff --git a/drivers/shared/executor/executor_test.go b/drivers/shared/executor/executor_test.go index 273fa2bfc..f5794b75c 100644 --- a/drivers/shared/executor/executor_test.go +++ b/drivers/shared/executor/executor_test.go @@ -13,15 +13,14 @@ import ( "testing" "time" - "github.com/hashicorp/nomad/plugins/drivers" - tu "github.com/hashicorp/nomad/testutil" - hclog "github.com/hashicorp/go-hclog" "github.com/hashicorp/nomad/client/allocdir" cstructs "github.com/hashicorp/nomad/client/structs" "github.com/hashicorp/nomad/client/taskenv" "github.com/hashicorp/nomad/helper/testlog" "github.com/hashicorp/nomad/nomad/mock" + "github.com/hashicorp/nomad/plugins/drivers" + tu "github.com/hashicorp/nomad/testutil" "github.com/stretchr/testify/require" ) @@ -55,7 +54,7 @@ func testExecutorCommand(t *testing.T) (*ExecCommand, *allocdir.AllocDir) { Env: taskEnv.List(), TaskDir: td.Dir, Resources: &drivers.Resources{ - NomadResources: task.Resources, + NomadResources: alloc.AllocatedResources.Tasks[task.Name], }, }