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:
Kubernetes Prow Robot 2019-09-26 13:02:34 -07:00 committed by GitHub
commit b622b15ad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 0 deletions

View File

@ -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() {

View 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