Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Skip looking for unschedulable pods when running with envtest. #867

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions controllers/suite/clusters/humiocluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,22 +354,24 @@ var _ = Describe("HumioCluster Controller", func() {

ensurePodsGoPending(ctx, controllers.NewHumioNodeManagerFromHumioCluster(&updatedHumioCluster), 2, 1)

Eventually(func() int {
var pendingPodsCount int
updatedClusterPods, _ = kubernetes.ListPods(ctx, k8sClient, updatedHumioCluster.Namespace, controllers.NewHumioNodeManagerFromHumioCluster(&updatedHumioCluster).GetPodLabels())
for _, pod := range updatedClusterPods {
if pod.Status.Phase == corev1.PodPending {
for _, condition := range pod.Status.Conditions {
if condition.Type == corev1.PodScheduled {
if condition.Status == corev1.ConditionFalse && condition.Reason == controllers.PodConditionReasonUnschedulable {
pendingPodsCount++
if !helpers.UseEnvtest() {
Eventually(func() int {
var pendingPodsCount int
updatedClusterPods, _ = kubernetes.ListPods(ctx, k8sClient, updatedHumioCluster.Namespace, controllers.NewHumioNodeManagerFromHumioCluster(&updatedHumioCluster).GetPodLabels())
for _, pod := range updatedClusterPods {
if pod.Status.Phase == corev1.PodPending {
for _, condition := range pod.Status.Conditions {
if condition.Type == corev1.PodScheduled {
if condition.Status == corev1.ConditionFalse && condition.Reason == controllers.PodConditionReasonUnschedulable {
pendingPodsCount++
}
}
}
}
}
}
return pendingPodsCount
}, testTimeout, 250*time.Millisecond).Should(Equal(1))
return pendingPodsCount
}, testTimeout, 250*time.Millisecond).Should(Equal(1))
}

suite.UsingClusterBy(key.Name, "Updating the cluster resources successfully with working affinity")
Eventually(func() error {
Expand Down
Loading