Skip to content

Commit

Permalink
topology-aware: adjust/butcher mocks.
Browse files Browse the repository at this point in the history
Add missing mocked interfaces. Ditch obsolete/outdated test case.

Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub committed Nov 5, 2024
1 parent 81d070e commit 18e400d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
9 changes: 9 additions & 0 deletions cmd/plugins/topology-aware/policy/mocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
resmgr "github.com/containers/nri-plugins/pkg/apis/resmgr/v1alpha1"
"github.com/containers/nri-plugins/pkg/cpuallocator"
"github.com/containers/nri-plugins/pkg/resmgr/cache"
libmem "github.com/containers/nri-plugins/pkg/resmgr/lib/memory"
"github.com/containers/nri-plugins/pkg/sysfs"
system "github.com/containers/nri-plugins/pkg/sysfs"
"github.com/containers/nri-plugins/pkg/topology"
Expand Down Expand Up @@ -186,6 +187,9 @@ func (c *mockCPU) GetCachesByLevel(int) []*sysfs.Cache {
func (c *mockCPU) GetCacheByIndex(int) *sysfs.Cache {
panic("unimplemented")
}
func (c *mockCPU) GetNthLevelCacheCPUSet(n int) cpuset.CPUSet {
panic("unimplemented")
}
func (c *mockCPU) GetLastLevelCaches() []*sysfs.Cache {
panic("unimplemented")
}
Expand Down Expand Up @@ -531,6 +535,9 @@ func (m *mockContainer) PreserveCpuResources() bool {
func (m *mockContainer) PreserveMemoryResources() bool {
return false
}
func (m *mockContainer) MemoryTypes() (libmem.TypeMask, error) {
return libmem.TypeMaskDRAM, nil
}

type mockPod struct {
name string
Expand Down Expand Up @@ -669,6 +676,8 @@ func (m *mockCache) EvaluateAffinity(*cache.Affinity) map[string]int32 {
func (m *mockCache) AddImplicitAffinities(map[string]cache.ImplicitAffinity) error {
return nil
}
func (m *mockCache) DeleteImplicitAffinities(...string) {
}
func (m *mockCache) GetActivePolicy() string {
panic("unimplemented")
}
Expand Down
14 changes: 0 additions & 14 deletions cmd/plugins/topology-aware/policy/pools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,20 +276,6 @@ func TestWorkloadPlacement(t *testing.T) {
expectedRemainingNodes: []int{0, 1, 2, 3, 4, 5, 6},
expectedLeafNode: false,
},
{
path: path.Join(dir, "sysfs", "server", "sys"),
name: "workload placement on a server system root node: memory doesn't fit to leaf",
req: &request{
memReq: 190000000000,
memLim: 190000000000,
memType: memoryUnspec,
isolate: false,
full: 28,
container: &mockContainer{},
},
expectedRemainingNodes: []int{2, 6},
expectedLeafNode: false,
},
}
for _, tc := range tcases {
t.Run(tc.name, func(t *testing.T) {
Expand Down

0 comments on commit 18e400d

Please sign in to comment.