Skip to content

Commit

Permalink
Improve daemonset isReady (#1045)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebrandon1 authored Jan 13, 2025
1 parent f505244 commit 1fa4742
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
7 changes: 6 additions & 1 deletion tests/globalhelper/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ func isDaemonSetReady(client *egiClients.Settings, namespace string, name string

// Get number of nodes and compare with the number of scheduled pods
numNodes := GetNumberOfNodes(client.CoreV1Interface)

if daemonset.Object.Status.DesiredNumberScheduled == int32(numNodes) &&
daemonset.Object.Status.NumberReady == daemonset.Object.Status.DesiredNumberScheduled {
daemonset.Object.Status.NumberReady == daemonset.Object.Status.DesiredNumberScheduled &&
daemonset.Object.Status.NumberAvailable == daemonset.Object.Status.DesiredNumberScheduled &&
daemonset.Object.Status.CurrentNumberScheduled == daemonset.Object.Status.DesiredNumberScheduled &&
daemonset.Object.Status.NumberUnavailable == 0 &&
daemonset.Object.Status.NumberReady > 0 {
return true, nil
}

Expand Down
7 changes: 3 additions & 4 deletions tests/globalhelper/daemonset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func TestIsDaemonsetReady(t *testing.T) {
DesiredNumberScheduled: int32(numScheduled),
NumberUnavailable: int32(numUnavailable),
NumberReady: int32(numReady),
CurrentNumberScheduled: int32(numScheduled),
},
}
}
Expand Down Expand Up @@ -128,10 +129,8 @@ func TestIsDaemonsetReady(t *testing.T) {
testCase.numScheduled, testCase.numUnavailable, testCase.numReady))
runtimeObjects = append(runtimeObjects, &corev1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "test-node",
Labels: map[string]string{
"node-role.kubernetes.io/worker-cnf": "",
},
Name: "test-node",
Labels: map[string]string{},
},
})

Expand Down
4 changes: 1 addition & 3 deletions tests/globalhelper/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ func GetNumberOfNodes(client corev1Typed.CoreV1Interface) int {
}

func getNumberOfNodes(client corev1Typed.CoreV1Interface) int {
nodes, err := client.Nodes().List(context.TODO(), metav1.ListOptions{
LabelSelector: "node-role.kubernetes.io/worker-cnf",
})
nodes, err := client.Nodes().List(context.TODO(), metav1.ListOptions{})

if err != nil {
return 0
Expand Down
4 changes: 3 additions & 1 deletion tests/observability/tests/container_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ var _ = Describe(tsparams.CertsuiteContainerLoggingTcName, func() {

By("Start Certsuite " + tsparams.CertsuiteContainerLoggingTcName + " test case")
err = globalhelper.LaunchTests(tsparams.CertsuiteContainerLoggingTcName,
globalhelper.ConvertSpecNameToFileName(CurrentSpecReport().FullText()), randomReportDir, randomCertsuiteConfigDir)
globalhelper.ConvertSpecNameToFileName(CurrentSpecReport().FullText()),
randomReportDir,
randomCertsuiteConfigDir)
Expect(err).ToNot(HaveOccurred())

By("Verify test case status in Claim report")
Expand Down

0 comments on commit 1fa4742

Please sign in to comment.