mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
drivers: use ctx.TaskEnv for mount points
This commit is contained in:
@@ -1618,25 +1618,29 @@ func setupDockerVolumes(t *testing.T, cfg *config.Config, hostpath string) (*str
|
||||
allocDir.Destroy()
|
||||
t.Fatalf("failed to build task dir: %v", err)
|
||||
}
|
||||
copyImage(t, taskDir, "busybox.tar")
|
||||
|
||||
// Setup driver
|
||||
alloc := mock.Alloc()
|
||||
envBuilder := env.NewBuilder(cfg.Node, alloc, task, cfg.Region)
|
||||
execCtx := NewExecContext(taskDir, envBuilder.Build())
|
||||
cleanup := func() {
|
||||
allocDir.Destroy()
|
||||
if filepath.IsAbs(hostpath) {
|
||||
os.RemoveAll(hostpath)
|
||||
}
|
||||
}
|
||||
|
||||
logger := testLogger()
|
||||
emitter := func(m string, args ...interface{}) {
|
||||
logger.Printf("[EVENT] "+m, args...)
|
||||
}
|
||||
driverCtx := NewDriverContext(task.Name, alloc.ID, cfg, cfg.Node, testLogger(), emitter)
|
||||
driver := NewDockerDriver(driverCtx)
|
||||
copyImage(t, taskDir, "busybox.tar")
|
||||
|
||||
// Setup execCtx
|
||||
envBuilder := env.NewBuilder(cfg.Node, alloc, task, cfg.Region)
|
||||
SetEnvvars(envBuilder, driver.FSIsolation(), taskDir, cfg)
|
||||
execCtx := NewExecContext(taskDir, envBuilder.Build())
|
||||
|
||||
// Setup cleanup function
|
||||
cleanup := func() {
|
||||
allocDir.Destroy()
|
||||
if filepath.IsAbs(hostpath) {
|
||||
os.RemoveAll(hostpath)
|
||||
}
|
||||
}
|
||||
return task, driver, execCtx, hostfile, cleanup
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user