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:
Kir Kolyshkin
2026-04-30 16:46:35 -07:00
parent 48c7e83b91
commit 5cd0cb6d51
2 changed files with 14 additions and 9 deletions
-6
View File
@@ -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,
+14 -3
View File
@@ -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)
}