Skip to content

Commit

Permalink
Merge pull request #1164 from Tal-or/check_nrt_for_nodes
Browse files Browse the repository at this point in the history
e2e: check all nodes have NRT object
  • Loading branch information
openshift-merge-bot[bot] authored Jan 26, 2025
2 parents b11e8b5 + e3ab204 commit 5fffeda
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/e2e/serial/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"os"
"strings"

v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
kubeletconfigv1beta1 "k8s.io/kubelet/config/v1beta1"

Expand Down Expand Up @@ -163,6 +164,10 @@ func CheckNodesTopology(ctx context.Context) error {
return fmt.Errorf("Following nodes have incoherent info in KubeletConfig/NRT data:\n%#v\n", errText)
}

if err := checkNRTsArePresentForAllNodes(ctx); err != nil {
return fmt.Errorf("an NRT object must be associated with each node: %v", err)
}

singleNUMANodeNRTs := e2enrt.FilterByTopologyManagerPolicy(nrtList.Items, intnrt.SingleNUMANode)
if len(singleNUMANodeNRTs) < minNumberOfNodesWithSameTopology {
return fmt.Errorf("Not enough nodes with %q topology (found:%d). Need at least %d", intnrt.SingleNUMANode, len(singleNUMANodeNRTs), minNumberOfNodesWithSameTopology)
Expand All @@ -178,3 +183,20 @@ func errorMapToString(errs map[string]error) string {
}
return sb.String()
}

func checkNRTsArePresentForAllNodes(ctx context.Context) error {
nodeList := v1.NodeList{}
if err := e2eclient.Client.List(ctx, &nodeList); err != nil {
return err
}
nrtList := nrtv1alpha2.NodeResourceTopologyList{}
if err := e2eclient.Client.List(ctx, &nrtList); err != nil {
return err
}
for _, node := range nodeList.Items {
if _, err := e2enrt.FindFromList(nrtList.Items, node.Name); err != nil {
return err
}
}
return nil
}

0 comments on commit 5fffeda

Please sign in to comment.