From 03035355068e5bce8fb19a2aad67dad6eb8ace9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arda=20G=C3=BC=C3=A7l=C3=BC?= Date: Mon, 26 Sep 2022 18:10:08 +0300 Subject: [PATCH] Add e2e tests for events command (#111855) * Add e2e tests for events command * Run events tests as normal e2e instead conformance Conformance tests are only for GA features. Since `kubectl events` currently is in alpha stage, e2e tests for this command should be run as standard e2e. --- test/e2e/kubectl/kubectl.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/e2e/kubectl/kubectl.go b/test/e2e/kubectl/kubectl.go index 65a209adc8c..5a6561fb884 100644 --- a/test/e2e/kubectl/kubectl.go +++ b/test/e2e/kubectl/kubectl.go @@ -1939,6 +1939,34 @@ metadata: }) }) + ginkgo.Describe("Kubectl events", func() { + ginkgo.It("should show event when pod is created ", func() { + podName := "e2e-test-httpd-pod" + ginkgo.By("running the image " + httpdImage) + framework.RunKubectlOrDie(ns, "run", podName, "--image="+httpdImage, podRunningTimeoutArg, "--labels=run="+podName) + + ginkgo.By("verifying the pod " + podName + " is running") + label := labels.SelectorFromSet(map[string]string{"run": podName}) + err := testutils.WaitForPodsWithLabelRunning(c, ns, label) + if err != nil { + framework.Failf("Failed getting pod %s: %v", podName, err) + } + + ginkgo.By("show started event for this pod") + events := framework.RunKubectlOrDie(ns, "alpha", "events", "--for=pod/"+podName) + + if !strings.Contains(events, fmt.Sprintf("Normal Scheduled Pod/%s", podName)) { + framework.Failf("failed to list expected event") + } + + ginkgo.By("expect not showing any WARNING message") + events = framework.RunKubectlOrDie(ns, "alpha", "events", "--types=WARNING", "--for=pod/"+podName) + if events != "" { + framework.Failf("unexpected WARNING event fired") + } + }) + }) + ginkgo.Describe("Kubectl create quota", func() { ginkgo.It("should create a quota without scopes", func() { quotaName := "million"