mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
libct/intelrdt: remove newManager
It is not doing anything, and tests can just instantiate the &Manager{}.
Suggested-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -180,12 +180,6 @@ func NewManager(config *configs.Config, id, path string) *Manager {
|
||||
}
|
||||
}
|
||||
|
||||
return newManager(config, id, path)
|
||||
}
|
||||
|
||||
// newManager is the same as NewManager, except it does not check if the feature
|
||||
// is actually available. Used by unit tests that mock intelrdt paths.
|
||||
func newManager(config *configs.Config, id, path string) *Manager {
|
||||
return &Manager{
|
||||
config: config,
|
||||
id: id,
|
||||
|
||||
@@ -108,7 +108,10 @@ func TestIntelRdtSet(t *testing.T) {
|
||||
helper := NewIntelRdtTestUtil(t)
|
||||
helper.config.IntelRdt = tc.config
|
||||
|
||||
intelrdt := newManager(helper.config, "", helper.IntelRdtPath)
|
||||
intelrdt := &Manager{
|
||||
config: helper.config,
|
||||
path: helper.IntelRdtPath,
|
||||
}
|
||||
if err := intelrdt.Set(helper.config); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -195,7 +198,11 @@ func TestApply(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
m := newManager(&configs.Config{IntelRdt: &tt.config}, id, closPath)
|
||||
m := &Manager{
|
||||
config: &configs.Config{IntelRdt: &tt.config},
|
||||
id: id,
|
||||
path: closPath,
|
||||
}
|
||||
err := m.Apply(pid)
|
||||
if tt.isError && err == nil {
|
||||
t.Fatal("expected error, got nil")
|
||||
@@ -292,7 +299,11 @@ func TestDestroy(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
m := newManager(&configs.Config{IntelRdt: &tt.config}, id, closPath)
|
||||
m := &Manager{
|
||||
config: &configs.Config{IntelRdt: &tt.config},
|
||||
id: id,
|
||||
path: closPath,
|
||||
}
|
||||
if err := m.Apply(1234); err != nil {
|
||||
t.Fatalf("Apply() failed: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user