-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add health tests for batch/cronjob
Signed-off-by: Ali Ghotbizadeh <[email protected]>
- Loading branch information
Showing
6 changed files
with
129 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
tests: | ||
- healthStatus: | ||
status: Healthy | ||
message: CronJob has never run | ||
inputPath: testdata/notScheduled.yaml | ||
- healthStatus: | ||
status: Healthy | ||
message: CronJob has run successfully | ||
inputPath: testdata/successfullyRun.yaml | ||
- healthStatus: | ||
status: Progressing | ||
message: CronJob has active jobs | ||
inputPath: testdata/activeJobs.yaml | ||
- healthStatus: | ||
status: Degraded | ||
message: CronJob has not run successfully | ||
inputPath: testdata/oldLastSuccessfulRun.yaml | ||
- healthStatus: | ||
status: Degraded | ||
message: CronJob has not run successfully | ||
inputPath: testdata/noLastSuccessfulRun.yaml |
26 changes: 26 additions & 0 deletions
26
resource_customizations/batch/CronJob/testdata/activeJobs.yaml
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
name: activeJobsCronJob | ||
namespace: default | ||
spec: | ||
schedule: "*/1 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: activeJobsCronJob | ||
image: busybox | ||
command: | ||
- /bin/sh | ||
- -c | ||
- date; echo Hello from the Kubernetes cluster | ||
restartPolicy: OnFailure | ||
status: | ||
active: | ||
- apiVersion: batch/v1 | ||
kind: Job | ||
name: activeJobsCronJob-1597969200 | ||
namespace: default | ||
uid: 0a0a0a0a-0a0a-0a0a-0a0a-0a0a0a0a0a0a | ||
lastScheduleTime: "2020-08-20T18:00:00Z" |
20 changes: 20 additions & 0 deletions
20
resource_customizations/batch/CronJob/testdata/noLastSuccessfulRun.yaml
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
name: noLastSuccessfulRunCronJob | ||
namespace: default | ||
spec: | ||
schedule: "*/1 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: noLastSuccessfulRunCronJob | ||
image: busybox | ||
command: | ||
- /bin/sh | ||
- -c | ||
- date; echo Hello from the Kubernetes cluster | ||
restartPolicy: OnFailure | ||
status: | ||
lastScheduleTime: "2020-08-20T18:00:00Z" |
20 changes: 20 additions & 0 deletions
20
resource_customizations/batch/CronJob/testdata/notScheduled.yaml
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
name: notScheduledCronJob | ||
namespace: default | ||
spec: | ||
schedule: "*/1 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: notScheduledCronJob | ||
image: busybox | ||
command: | ||
- /bin/sh | ||
- -c | ||
- date; echo Hello from the Kubernetes cluster | ||
restartPolicy: OnFailure | ||
status: | ||
lastScheduleTime: null |
21 changes: 21 additions & 0 deletions
21
resource_customizations/batch/CronJob/testdata/oldLastSuccessfulRun.yaml
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
name: oldLastSuccessfulRunCronJob | ||
namespace: default | ||
spec: | ||
schedule: "*/1 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: oldLastSuccessfulRunCronJob | ||
image: busybox | ||
command: | ||
- /bin/sh | ||
- -c | ||
- date; echo Hello from the Kubernetes cluster | ||
restartPolicy: OnFailure | ||
status: | ||
lastScheduleTime: "2020-08-20T18:00:00Z" | ||
lastSuccessfulTime: "2020-08-20T15:00:00Z" |
21 changes: 21 additions & 0 deletions
21
resource_customizations/batch/CronJob/testdata/successfullyRun.yaml
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
name: successfullyRunCronJob | ||
namespace: default | ||
spec: | ||
schedule: "*/1 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: successfullyRunCronJob | ||
image: busybox | ||
command: | ||
- /bin/sh | ||
- -c | ||
- date; echo Hello from the Kubernetes cluster | ||
restartPolicy: OnFailure | ||
status: | ||
lastScheduleTime: "2020-08-20T18:00:00Z" | ||
lastSuccessfulTime: "2020-08-20T18:05:00Z" |