mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #79814 from k-toyoda-pi/e2e_add_kubectl_describe_cronjob
Add e2e test for kubectl describe cronjob
This commit is contained in:
commit
b622b15ad4
@ -1098,6 +1098,42 @@ metadata:
|
||||
|
||||
// Quota and limitrange are skipped for now.
|
||||
})
|
||||
|
||||
ginkgo.It("should check if kubectl describe prints relevant information for cronjob", func() {
|
||||
ginkgo.By("creating a cronjob")
|
||||
nsFlag := fmt.Sprintf("--namespace=%v", ns)
|
||||
cronjobYaml := commonutils.SubstituteImageName(string(readTestFileOrDie("busybox-cronjob.yaml")))
|
||||
framework.RunKubectlOrDieInput(cronjobYaml, "create", "-f", "-", nsFlag)
|
||||
|
||||
ginkgo.By("waiting for cronjob to start.")
|
||||
err := wait.PollImmediate(time.Second, time.Minute, func() (bool, error) {
|
||||
cj, err := c.BatchV1beta1().CronJobs(ns).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("Failed getting CronJob %s: %v", ns, err)
|
||||
}
|
||||
return len(cj.Items) > 0, nil
|
||||
})
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
ginkgo.By("verifying kubectl describe prints")
|
||||
output := framework.RunKubectlOrDie("describe", "cronjob", "cronjob-test", nsFlag)
|
||||
requiredStrings := [][]string{
|
||||
{"Name:", "cronjob-test"},
|
||||
{"Namespace:", ns},
|
||||
{"Labels:"},
|
||||
{"Annotations:"},
|
||||
{"Schedule:", "*/1 * * * *"},
|
||||
{"Concurrency Policy:", "Allow"},
|
||||
{"Suspend:", "False"},
|
||||
{"Successful Job History Limit:", "3"},
|
||||
{"Failed Job History Limit:", "1"},
|
||||
{"Starting Deadline Seconds:", "30s"},
|
||||
{"Selector:"},
|
||||
{"Parallelism:"},
|
||||
{"Completions:"},
|
||||
}
|
||||
checkOutput(output, requiredStrings)
|
||||
})
|
||||
})
|
||||
|
||||
ginkgo.Describe("Kubectl expose", func() {
|
||||
|
21
test/e2e/testing-manifests/kubectl/busybox-cronjob.yaml
Normal file
21
test/e2e/testing-manifests/kubectl/busybox-cronjob.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
apiVersion: batch/v1beta1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: cronjob-test
|
||||
spec:
|
||||
schedule: "*/1 * * * *"
|
||||
concurrencyPolicy: Allow
|
||||
suspend: false
|
||||
startingDeadlineSeconds: 30
|
||||
successfulJobsHistoryLimit: 3
|
||||
failedJobsHistoryLimit: 1
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: test
|
||||
image: busybox
|
||||
args:
|
||||
- "/bin/true"
|
||||
restartPolicy: OnFailure
|
Loading…
Reference in New Issue
Block a user