mirror of
https://github.com/kemko/nomad.git
synced 2026-01-02 08:25:43 +03:00
* client: refactor cgroups management in client * client: fingerprint numa topology * client: plumb numa and cgroups changes to drivers * client: cleanup task resource accounting * client: numa client and config plumbing * lib: add a stack implementation * tools: remove ec2info tool * plugins: fixup testing for cgroups / numa changes * build: update makefile and package tests and cl
26 lines
717 B
Go
26 lines
717 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
//go:build linux
|
|
|
|
package testutils
|
|
|
|
import (
|
|
"github.com/hashicorp/nomad/client/lib/cgroupslib"
|
|
"github.com/shoenig/test/must"
|
|
)
|
|
|
|
// MakeTaskCgroup creates the cgroup that the task driver might assume already
|
|
// exists, since Nomad client creates them. Why do we write tests that directly
|
|
// invoke task drivers without any context of the Nomad client? Who knows.
|
|
func (h *DriverHarness) MakeTaskCgroup(allocID, taskName string) {
|
|
f := cgroupslib.Factory(allocID, taskName)
|
|
must.NoError(h.t, f.Setup())
|
|
|
|
// ensure child procs are dead and remove the cgroup when the test is done
|
|
h.t.Cleanup(func() {
|
|
_ = f.Kill()
|
|
_ = f.Teardown()
|
|
})
|
|
}
|