From 773fec26ebc660c963bcb25fc432751f68b46e7c Mon Sep 17 00:00:00 2001 From: xueqzhan Date: Tue, 7 Jul 2026 15:39:18 -0400 Subject: [PATCH 1/2] oc adm inspect test fails due to partial pod log collection errors in openshift-multus namespace --- test/extended/cli/mustgather.go | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/test/extended/cli/mustgather.go b/test/extended/cli/mustgather.go index 362601b39b7e..079b5445c36e 100644 --- a/test/extended/cli/mustgather.go +++ b/test/extended/cli/mustgather.go @@ -464,25 +464,34 @@ var _ = g.Describe("[sig-cli] oc adm must-gather", func() { podname, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", "openshift-multus", "-l", "app=multus", "-o=jsonpath={.items[0].metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "ns", "openshift-multus", "--since-time="+now.Add(time.Minute*-2).Format("2006-01-02T15:04:05Z"), "--dest-dir="+tempDir).Execute()).To(o.Succeed()) + // Use Output() instead of Execute() because oc adm inspect returns non-zero + // for partial pod log collection errors (e.g., terminated init containers, + // transient API timeouts) even when the data was gathered successfully. + inspectOutput, inspectErr := oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "ns", "openshift-multus", "--since-time="+now.Add(time.Minute*-2).Format("2006-01-02T15:04:05Z"), "--dest-dir="+tempDir).Output() + if inspectErr != nil { + // Fail only if the error is about the flag format, not partial collection errors + o.Expect(inspectOutput).NotTo(o.ContainSubstring("since-time only accepts times matching RFC3339"), + "inspect rejected the --since-time flag format") + e2e.Logf("inspect completed with partial errors (expected): %v", inspectErr) + } checkInspectLogTime(tempDir, podname, timeStamp) - g.By("2. Test inspect with wrong since-time format should failed.\n") - _, warningErr, err := oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "ns", "openshift-multus", "--since-time="+now.Format("2006-01-02T15:04:05"), "--dest-dir="+tempDir).Outputs() + g.By("2. Test inspect with wrong since-time format should fail.\n") + _, warningErr, err := oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "clusteroperator/openshift-apiserver", "--since-time="+now.Format("2006-01-02T15:04:05"), "--dest-dir="+tempDir).Outputs() o.Expect(err).To(o.HaveOccurred()) o.Expect(strings.Contains(warningErr, "--since-time only accepts times matching RFC3339")).To(o.BeTrue()) - g.By("3. Test inspect with wrong since-time format should failed.\n") - _, warningErr, err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "ns", "openshift-multus", "--since-time="+now.Format("2006-01-02"), "--dest-dir="+tempDir).Outputs() + g.By("3. Test inspect with wrong since-time format should fail.\n") + _, warningErr, err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "clusteroperator/openshift-apiserver", "--since-time="+now.Format("2006-01-02"), "--dest-dir="+tempDir).Outputs() o.Expect(err).To(o.HaveOccurred()) o.Expect(strings.Contains(warningErr, "--since-time only accepts times matching RFC3339")).To(o.BeTrue()) g.By("4. Test inspect with correct since format should succeed.\n") - o.Expect(oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "ns", "openshift-multus", "--since=1m", "--dest-dir="+tempDir).Execute()).To(o.Succeed()) + o.Expect(oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "clusteroperator/openshift-apiserver", "--since=1m", "--dest-dir="+tempDir).Execute()).To(o.Succeed()) - g.By("5. Test inspect with wrong since format should failed.\n") - _, warningErr, err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "ns", "openshift-multus", "--since=1", "--dest-dir="+tempDir).Outputs() + g.By("5. Test inspect with wrong since format should fail.\n") + _, warningErr, err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "clusteroperator/openshift-apiserver", "--since=1", "--dest-dir="+tempDir).Outputs() o.Expect(err).To(o.HaveOccurred()) o.Expect(strings.Contains(warningErr, "time: missing unit")).To(o.BeTrue()) }) From f10c7fcc846cdcf66d14e09b36ee5f6ca4c363f6 Mon Sep 17 00:00:00 2001 From: xueqzhan Date: Fri, 10 Jul 2026 15:47:51 -0400 Subject: [PATCH 2/2] Use simple resource for since and since-time tests --- test/extended/cli/mustgather.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/extended/cli/mustgather.go b/test/extended/cli/mustgather.go index 079b5445c36e..c34538312098 100644 --- a/test/extended/cli/mustgather.go +++ b/test/extended/cli/mustgather.go @@ -478,20 +478,20 @@ var _ = g.Describe("[sig-cli] oc adm must-gather", func() { checkInspectLogTime(tempDir, podname, timeStamp) g.By("2. Test inspect with wrong since-time format should fail.\n") - _, warningErr, err := oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "clusteroperator/openshift-apiserver", "--since-time="+now.Format("2006-01-02T15:04:05"), "--dest-dir="+tempDir).Outputs() + _, warningErr, err := oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "ns/openshift-console", "--since-time="+now.Format("2006-01-02T15:04:05"), "--dest-dir="+tempDir).Outputs() o.Expect(err).To(o.HaveOccurred()) o.Expect(strings.Contains(warningErr, "--since-time only accepts times matching RFC3339")).To(o.BeTrue()) g.By("3. Test inspect with wrong since-time format should fail.\n") - _, warningErr, err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "clusteroperator/openshift-apiserver", "--since-time="+now.Format("2006-01-02"), "--dest-dir="+tempDir).Outputs() + _, warningErr, err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "ns/openshift-console", "--since-time="+now.Format("2006-01-02"), "--dest-dir="+tempDir).Outputs() o.Expect(err).To(o.HaveOccurred()) o.Expect(strings.Contains(warningErr, "--since-time only accepts times matching RFC3339")).To(o.BeTrue()) g.By("4. Test inspect with correct since format should succeed.\n") - o.Expect(oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "clusteroperator/openshift-apiserver", "--since=1m", "--dest-dir="+tempDir).Execute()).To(o.Succeed()) + o.Expect(oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "ns/openshift-console", "--since=1m", "--dest-dir="+tempDir).Execute()).To(o.Succeed()) g.By("5. Test inspect with wrong since format should fail.\n") - _, warningErr, err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "clusteroperator/openshift-apiserver", "--since=1", "--dest-dir="+tempDir).Outputs() + _, warningErr, err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("inspect", "ns/openshift-console", "--since=1", "--dest-dir="+tempDir).Outputs() o.Expect(err).To(o.HaveOccurred()) o.Expect(strings.Contains(warningErr, "time: missing unit")).To(o.BeTrue()) })