From 213a6edc579c058ffdc625e1c0f2270776e5c944 Mon Sep 17 00:00:00 2001 From: Swati Sehgal Date: Tue, 13 Dec 2022 14:54:48 +0000 Subject: [PATCH] node: e2e: Add descriptive messages for operation/error checks Signed-off-by: Swati Sehgal --- test/e2e_node/container_log_rotation_test.go | 4 ++-- test/e2e_node/device_plugin_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/e2e_node/container_log_rotation_test.go b/test/e2e_node/container_log_rotation_test.go index f281a156405..aadd300d7d9 100644 --- a/test/e2e_node/container_log_rotation_test.go +++ b/test/e2e_node/container_log_rotation_test.go @@ -80,10 +80,10 @@ var _ = SIGDescribe("ContainerLogRotation [Slow] [Serial] [Disruptive]", func() ginkgo.It("should be rotated and limited to a fixed amount of files", func(ctx context.Context) { ginkgo.By("get container log path") - framework.ExpectEqual(len(logRotationPod.Status.ContainerStatuses), 1) + framework.ExpectEqual(len(logRotationPod.Status.ContainerStatuses), 1, "log rotation pod should have one container") id := kubecontainer.ParseContainerID(logRotationPod.Status.ContainerStatuses[0].ContainerID).ID r, _, err := getCRIClient() - framework.ExpectNoError(err) + framework.ExpectNoError(err, "should connect to CRI and obtain runtime service clients and image service client") resp, err := r.ContainerStatus(context.Background(), id, false) framework.ExpectNoError(err) logPath := resp.GetStatus().GetLogPath() diff --git a/test/e2e_node/device_plugin_test.go b/test/e2e_node/device_plugin_test.go index deedc654a66..84568950dad 100644 --- a/test/e2e_node/device_plugin_test.go +++ b/test/e2e_node/device_plugin_test.go @@ -106,16 +106,16 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) { }, time.Minute, time.Second).Should(gomega.BeTrue()) v1alphaPodResources, err = getV1alpha1NodeDevices() - framework.ExpectNoError(err) + framework.ExpectNoError(err, "should get node local podresources by accessing the (v1alpha) podresources API endpoint") v1PodResources, err = getV1NodeDevices() - framework.ExpectNoError(err) + framework.ExpectNoError(err, "should get node local podresources by accessing the (v1) podresources API endpoint") // Before we run the device plugin test, we need to ensure // that the cluster is in a clean state and there are no // pods running on this node. - framework.ExpectEqual(len(v1alphaPodResources.PodResources), 0) - framework.ExpectEqual(len(v1PodResources.PodResources), 0) + gomega.Expect(v1alphaPodResources.PodResources).To(gomega.BeEmpty(), "should have no pod resources") + gomega.Expect(v1PodResources.PodResources).To(gomega.BeEmpty(), "should have no pod resources") ginkgo.By("Scheduling a sample device plugin pod") data, err := e2etestfiles.Read(SampleDevicePluginDSYAML)