test: update tests to properly use AllocDir

Also use t.TempDir when possible.
This commit is contained in:
Michael Schurter
2021-10-18 10:32:41 -07:00
parent f41b625532
commit eeb1da8a2e
10 changed files with 45 additions and 42 deletions

View File

@@ -83,10 +83,12 @@ func (h *DriverHarness) Kill() {
func (h *DriverHarness) MkAllocDir(t *drivers.TaskConfig, enableLogs bool) func() {
dir, err := ioutil.TempDir("", "nomad_driver_harness-")
require.NoError(h.t, err)
t.AllocDir = dir
allocDir := allocdir.NewAllocDir(h.logger, dir, t.AllocID)
require.NoError(h.t, allocDir.Build())
t.AllocDir = allocDir.AllocDir
taskDir := allocDir.NewTaskDir(t.Name)
caps, err := h.Capabilities()