memory manager: provide memory manager static policy unittests

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
This commit is contained in:
Artyom Lukianov 2020-10-11 12:10:01 +03:00
parent d7175a831c
commit f7845ed4e9
2 changed files with 2360 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@ limitations under the License.
package topologymanager
import (
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
"k8s.io/kubernetes/pkg/kubelet/util/format"
@ -56,3 +56,21 @@ func (m *fakeManager) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAd
Admit: true,
}
}
type fakeManagerWithHint struct {
fakeManager
hint *TopologyHint
}
// NewFakeManagerWithHint returns an instance of FakeManager with specified topology hints
func NewFakeManagerWithHint(hint *TopologyHint) Manager {
return &fakeManagerWithHint{
fakeManager: fakeManager{},
hint: hint,
}
}
func (m *fakeManagerWithHint) GetAffinity(podUID string, containerName string) TopologyHint {
klog.Infof("[fake topologymanager] GetAffinity podUID: %v container name: %v", podUID, containerName)
return *m.hint
}