Skip to content
Open
Changes from 1 commit
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
20 changes: 20 additions & 0 deletions pkg/utils/kubeclient/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,26 @@
})
})

Describe("IsFinishedPod", func() {
It("should return false for nil pod", func() {
Expect(IsFinishedPod(nil)).To(BeFalse())
})

DescribeTable("should correctly identify finished pods",
func(phase corev1.PodPhase, want bool) {
pod := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{Name: "testPod", Namespace: "default"},
Spec: corev1.PodSpec{},
Status: corev1.PodStatus{Phase: phase},
}
Expect(IsFinishedPod(pod)).To(Equal(want))
},
Entry("running pod", corev1.PodRunning, false),

Check failure on line 233 in pkg/utils/kubeclient/pod_test.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "running pod" 3 times.

See more on https://sonarcloud.io/project/issues?id=fluid-cloudnative_fluid&issues=AZ1mBe2iRPBJy-7nxH64&open=AZ1mBe2iRPBJy-7nxH64&pullRequest=5770
Entry("succeeded pod", corev1.PodSucceeded, true),
Entry("failed pod", corev1.PodFailed, true),

Check failure on line 235 in pkg/utils/kubeclient/pod_test.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "failed pod" 4 times.

See more on https://sonarcloud.io/project/issues?id=fluid-cloudnative_fluid&issues=AZ1mBe2iRPBJy-7nxH65&open=AZ1mBe2iRPBJy-7nxH65&pullRequest=5770
)
})

Describe("IsSucceededPod", func() {
DescribeTable("should correctly identify succeeded pods",
func(phase corev1.PodPhase, want bool) {
Expand Down
Loading