Skip to content

Commit

Permalink
Fix panic in test setup when task does not have resources
Browse files Browse the repository at this point in the history
This affects exec/rawexec drivers
  • Loading branch information
Preetha Appan committed Nov 27, 2018
1 parent 22ac049 commit 0af9e85
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/drivers/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ func (h *DriverHarness) MkAllocDir(t *TaskConfig, enableLogs bool) func() {
require.NoError(h.t, taskDir.Build(false, entries, fsi))

task := &structs.Task{
Name: t.Name,
Env: t.Env,
Resources: t.Resources.NomadResources,
Name: t.Name,
Env: t.Env,
}
if t.Resources != nil {
task.Resources = t.Resources.NomadResources
}
taskBuilder := env.NewBuilder(mock.Node(), mock.Alloc(), task, "global")
utils.SetEnvvars(taskBuilder, fsi, taskDir, config.DefaultConfig())
Expand Down

0 comments on commit 0af9e85

Please sign in to comment.