e2e: topomgr: properly clean up after completion

Due to an oversight, the e2e topology manager tests
were leaking a configmap and a serviceaccount.
This patch ensures a proper cleanup

Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
Francesco Romani
2020-02-19 12:23:29 +01:00
parent 7c12251c7a
commit 833519f80b
2 changed files with 85 additions and 65 deletions

View File

@@ -177,18 +177,23 @@ func makeEnvMap(logs string) (map[string]string, error) {
return envMap, nil
}
func containerWantsDevices(cnt *v1.Container, hwinfo testEnvHWInfo) bool {
_, found := cnt.Resources.Requests[v1.ResourceName(hwinfo.sriovResourceName)]
type testEnvInfo struct {
numaNodes int
sriovResourceName string
}
func containerWantsDevices(cnt *v1.Container, envInfo testEnvInfo) bool {
_, found := cnt.Resources.Requests[v1.ResourceName(envInfo.sriovResourceName)]
return found
}
func checkNUMAAlignment(f *framework.Framework, pod *v1.Pod, cnt *v1.Container, logs string, hwinfo testEnvHWInfo) (numaPodResources, error) {
func checkNUMAAlignment(f *framework.Framework, pod *v1.Pod, cnt *v1.Container, logs string, envInfo testEnvInfo) (numaPodResources, error) {
podEnv, err := makeEnvMap(logs)
if err != nil {
return numaPodResources{}, err
}
CPUToNUMANode, err := getCPUToNUMANodeMapFromEnv(f, pod, cnt, podEnv, hwinfo.numaNodes)
CPUToNUMANode, err := getCPUToNUMANodeMapFromEnv(f, pod, cnt, podEnv, envInfo.numaNodes)
if err != nil {
return numaPodResources{}, err
}
@@ -198,7 +203,7 @@ func checkNUMAAlignment(f *framework.Framework, pod *v1.Pod, cnt *v1.Container,
return numaPodResources{}, err
}
if containerWantsDevices(cnt, hwinfo) && len(PCIDevsToNUMANode) == 0 {
if containerWantsDevices(cnt, envInfo) && len(PCIDevsToNUMANode) == 0 {
return numaPodResources{}, fmt.Errorf("no PCI devices found in environ")
}
numaRes := numaPodResources{