-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
node_placement e2e test: make sure all virt-hanlers are working
Signed-off-by: Nahshon Unna-Tsameret <[email protected]>
- Loading branch information
Showing
1 changed file
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,28 +36,30 @@ var _ = Describe("[rfe_id:4356][crit:medium][vendor:[email protected]][level:sys | |
originalWorkloadSpec hcov1beta1.HyperConvergedConfig | ||
cli client.Client | ||
cliSet *kubernetes.Clientset | ||
workerNodes *v1.NodeList | ||
) | ||
|
||
BeforeAll(func(ctx context.Context) { | ||
cli = tests.GetControllerRuntimeClient() | ||
cliSet = tests.GetK8sClientSet() | ||
|
||
nodes := listNodesByLabels(ctx, cliSet, "node-role.kubernetes.io/control-plane!=") | ||
tests.FailIfSingleNode(len(nodes.Items) < 2) | ||
workerNodes = listNodesByLabels(ctx, cliSet, "node-role.kubernetes.io/worker") | ||
//workerNodes = listNodesByLabels(ctx, cliSet, "node-role.kubernetes.io/control-plane!=") | ||
tests.FailIfSingleNode(len(workerNodes.Items) < 2) | ||
|
||
// Label all but first node with "node.kubernetes.io/hco-test-node-type=infra" | ||
// We are doing this to remove dependency of this Describe block on a shell script that | ||
// labels the nodes this way | ||
Eventually(func(g Gomega, ctx context.Context) { | ||
for _, node := range nodes.Items[:len(nodes.Items)-1] { | ||
for _, node := range workerNodes.Items[:len(workerNodes.Items)-1] { | ||
done, err := setHcoNodeTypeLabel(ctx, cliSet, &node, infra) | ||
g.Expect(err).ToNot(HaveOccurred()) | ||
g.Expect(done).To(BeTrue()) | ||
} | ||
}).WithTimeout(5 * time.Minute).WithPolling(10 * time.Second).WithContext(ctx).Should(Succeed()) | ||
// Label the last node with "node.kubernetes.io/hco-test-node-type=workloads" | ||
Eventually(func(g Gomega, ctx context.Context) { | ||
done, err := setHcoNodeTypeLabel(ctx, cliSet, &nodes.Items[len(nodes.Items)-1], workloads) | ||
done, err := setHcoNodeTypeLabel(ctx, cliSet, &workerNodes.Items[len(workerNodes.Items)-1], workloads) | ||
g.Expect(err).ToNot(HaveOccurred()) | ||
g.Expect(done).To(BeTrue()) | ||
}).WithTimeout(5 * time.Minute).WithPolling(10 * time.Second).WithContext(ctx).Should(Succeed()) | ||
|
@@ -85,7 +87,8 @@ var _ = Describe("[rfe_id:4356][crit:medium][vendor:[email protected]][level:sys | |
|
||
tests.UpdateHCORetry(ctx, cli, hco) | ||
|
||
workloadsNodes := listNodesByLabels(ctx, cliSet, "node.kubernetes.io/hco-test-node-type==workloads") | ||
const hcoSelector = hcoLabel + "==workloads" | ||
workloadsNodes := listNodesByLabels(ctx, cliSet, hcoSelector) | ||
Expect(workloadsNodes.Items).To(HaveLen(1)) | ||
|
||
workloadsNode = &workloadsNodes.Items[0] | ||
|
@@ -121,6 +124,26 @@ var _ = Describe("[rfe_id:4356][crit:medium][vendor:[email protected]][level:sys | |
g.Expect(err).ToNot(HaveOccurred()) | ||
} | ||
}).WithTimeout(5 * time.Minute).WithPolling(10 * time.Second).WithContext(ctx).Should(Succeed()) | ||
|
||
Eventually(func(g Gomega, ctx context.Context) { | ||
labelSelector := "kubevirt.io=virt-handler" | ||
pods, err := cliSet.CoreV1().Pods(tests.InstallNamespace).List(ctx, k8smetav1.ListOptions{LabelSelector: labelSelector}) | ||
g.Expect(err).ToNot(HaveOccurred()) | ||
g.Expect(pods.Items).To(HaveLen(len(workerNodes.Items))) | ||
|
||
for _, pod := range pods.Items { | ||
podReady := false | ||
for _, cond := range pod.Status.Conditions { | ||
if cond.Type == v1.PodReady { | ||
g.Expect(cond.Status).To(Equal(v1.ConditionTrue)) | ||
podReady = true | ||
break | ||
} | ||
} | ||
|
||
g.Expect(podReady).To(BeTrue()) | ||
} | ||
}).WithTimeout(5 * time.Minute).WithPolling(10 * time.Second).WithContext(ctx).Should(Succeed()) | ||
}) | ||
|
||
BeforeEach(func(ctx context.Context) { | ||
|