Files
nomad/plugins/drivers/testutils/testing_linux.go
Seth Hoenig a4cc76bd3e numa: enable numa topology detection (#18146)
* 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
2023-08-10 17:05:30 -05:00

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()
})
}