diff --git a/go.mod b/go.mod index 284f25ef7fdb..edcac02b98cb 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/openshift/origin -go 1.23.0 +go 1.24.0 -toolchain go1.23.4 +toolchain go1.24.3 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 diff --git a/pkg/clioptions/suiteselection/suite_flags.go b/pkg/clioptions/suiteselection/suite_flags.go index 3b7dc17056ed..be615dc2742b 100644 --- a/pkg/clioptions/suiteselection/suite_flags.go +++ b/pkg/clioptions/suiteselection/suite_flags.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "fmt" + "io" "io/ioutil" "os" "path/filepath" @@ -80,7 +81,7 @@ func (f *TestSuiteSelectionFlags) SelectSuite( } } if suite == nil && len(args) == 0 { - fmt.Fprintf(f.ErrOut, SuitesString(suites, "Select a test suite to run against the server:\n\n")) + PrintSuitesString(f.ErrOut, suites, "Select a test suite to run against the server:\n\n") return nil, fmt.Errorf("specify a test suite to run, for example: %s run %s", filepath.Base(os.Args[0]), suites[0].Name) } if suite == nil && len(args) > 0 { @@ -92,7 +93,7 @@ func (f *TestSuiteSelectionFlags) SelectSuite( } } if suite == nil { - fmt.Fprintf(f.ErrOut, SuitesString(suites, "Select a test suite to run against the server:\n\n")) + PrintSuitesString(f.ErrOut, suites, "Select a test suite to run against the server:\n\n") return nil, fmt.Errorf("suite %q does not exist", args[0]) } @@ -203,13 +204,13 @@ func (f *TestSuiteSelectionFlags) testFileMatchFunc() (testginkgo.TestMatchFunc, } // TODO re-collapse -// SuitesString returns a string with the provided suites formatted. Prefix is +// PrintSuitesString returns a string with the provided suites formatted. Prefix is // printed at the beginning of the output. -func SuitesString(suites []*testginkgo.TestSuite, prefix string) string { +func PrintSuitesString(w io.Writer, suites []*testginkgo.TestSuite, prefix string) { buf := &bytes.Buffer{} - fmt.Fprintf(buf, prefix) + fmt.Fprintf(buf, "%s", prefix) for _, suite := range suites { fmt.Fprintf(buf, "%s\n %s\n\n", suite.Name, suite.Description) } - return buf.String() + io.Copy(w, buf) } diff --git a/pkg/disruption/backend/shutdown/handler.go b/pkg/disruption/backend/shutdown/handler.go index b4e9b4f87d2a..d96ae504c1ef 100644 --- a/pkg/disruption/backend/shutdown/handler.go +++ b/pkg/disruption/backend/shutdown/handler.go @@ -60,7 +60,7 @@ func (h *ciShutdownIntervalHandler) Handle(shutdown *shutdownInterval) { message = fmt.Sprintf("%s: load balancer took new(%s) reused(%s) to switch to a new host", message, shutdown.MaxElapsedWithNewConnection.Round(time.Second), shutdown.MaxElapsedWithConnectionReuse.Round(time.Second)) message = fmt.Sprintf("reason/%s locator/%s %s: %s", reason, h.descriptor.ShutdownLocator(), message, shutdown.String()) - framework.Logf(message) + framework.Logf("%s", message) if level == monitorapi.Error { h.eventRecorder.Eventf( diff --git a/pkg/monitor/backenddisruption/disruption_backend_sampler.go b/pkg/monitor/backenddisruption/disruption_backend_sampler.go index dee0286ab9aa..6cd480a8e5a6 100644 --- a/pkg/monitor/backenddisruption/disruption_backend_sampler.go +++ b/pkg/monitor/backenddisruption/disruption_backend_sampler.go @@ -622,7 +622,7 @@ func (b *disruptionSampler) consumeSamples(ctx context.Context, consumerDoneCh c // start a new interval with the new error message, eventReason, level := DisruptionBegan(b.backendSampler.GetLocator().OldLocator(), b.backendSampler.GetConnectionType(), currentError, currSample.getRequestAuditID()) - framework.Logf(message.BuildString()) + framework.Logf("%s", message.BuildString()) eventRecorder.Eventf( &v1.ObjectReference{Kind: "OpenShiftTest", Namespace: "kube-system", Name: b.backendSampler.GetDisruptionBackendName()}, nil, v1.EventTypeWarning, string(eventReason), "detected", message.BuildString()) @@ -654,7 +654,7 @@ func (b *disruptionSampler) consumeSamples(ctx context.Context, consumerDoneCh c } message, eventReason, level := DisruptionBegan(b.backendSampler.GetLocator().OldLocator(), b.backendSampler.GetConnectionType(), currentError, currSample.getRequestAuditID()) - framework.Logf(message.BuildString()) + framework.Logf("%s", message.BuildString()) eventRecorder.Eventf( &v1.ObjectReference{Kind: "OpenShiftTest", Namespace: "kube-system", Name: b.backendSampler.GetDisruptionBackendName()}, nil, v1.EventTypeWarning, string(eventReason), "detected", message.BuildString()) diff --git a/pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_events_test.go b/pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_events_test.go index f185751c2278..fec0ae14d12b 100644 --- a/pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_events_test.go +++ b/pkg/monitortestlibrary/pathologicaleventlibrary/duplicated_events_test.go @@ -407,7 +407,7 @@ func TestPathologicalEventsWithNamespaces(t *testing.T) { assert.Equal(t, test.expectedMessage, junit.FailureOutput.Output) } else { if !assert.Nil(t, junit.FailureOutput, "expected success but got failure output") { - t.Logf(junit.FailureOutput.Output) + t.Logf("%s", junit.FailureOutput.Output) } } } @@ -658,7 +658,7 @@ func TestPathologicalEventsTopologyAwareHintsDisabled(t *testing.T) { assert.Equal(t, test.expectedMessage, junit.FailureOutput.Output) } else { if !assert.Nil(t, junit.FailureOutput, "expected success but got failure output for junit: %s", junit.Name) { - t.Logf(junit.FailureOutput.Output) + t.Logf("%s", junit.FailureOutput.Output) } } } diff --git a/pkg/monitortests/network/disruptionpodnetwork/monitortest.go b/pkg/monitortests/network/disruptionpodnetwork/monitortest.go index 1d6aa014c783..ce810a8df176 100644 --- a/pkg/monitortests/network/disruptionpodnetwork/monitortest.go +++ b/pkg/monitortests/network/disruptionpodnetwork/monitortest.go @@ -212,7 +212,7 @@ func (pna *podNetworkAvalibility) serviceHasEndpoints(ctx context.Context) (bool } endpointSlices, err := pna.kubeClient.DiscoveryV1().EndpointSlices(pna.targetService.Namespace).List(ctx, listOptions) if err != nil { - klog.Errorf(err.Error()) + klog.Errorf("%s", err.Error()) return false, nil } diff --git a/pkg/riskanalysis/cmd.go b/pkg/riskanalysis/cmd.go index a1d2899a3183..0e918109acd3 100644 --- a/pkg/riskanalysis/cmd.go +++ b/pkg/riskanalysis/cmd.go @@ -5,7 +5,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/openshift/origin/pkg/dataloader" "io" "net/http" "os" @@ -14,6 +13,8 @@ import ( "strconv" "time" + "github.com/openshift/origin/pkg/dataloader" + "github.com/openshift/origin/pkg/monitortestlibrary/allowedbackenddisruption" "github.com/openshift/origin/pkg/monitortestlibrary/historicaldata" "github.com/openshift/origin/pkg/monitortestlibrary/platformidentification" @@ -216,7 +217,7 @@ func (opt *Options) requestRiskAnalysis(inputBytes []byte, client *http.Client, failure := "unable to obtain risk analysis from sippy after retries" logrus.WithError(err).Error(failure) if err == nil { // no error, but no success either - err = fmt.Errorf(failure) + err = fmt.Errorf("%s", failure) } return nil, err } diff --git a/pkg/testsuites/filters.go b/pkg/testsuites/filters.go index 10a33ff8998e..f8947134f983 100644 --- a/pkg/testsuites/filters.go +++ b/pkg/testsuites/filters.go @@ -14,7 +14,7 @@ import ( // printed at the beginning of the output. func SuitesString(suites []*ginkgo.TestSuite, prefix string) string { buf := &bytes.Buffer{} - fmt.Fprintf(buf, prefix) + buf.WriteString(prefix) for _, suite := range suites { fmt.Fprintf(buf, "%s\n %s\n\n", suite.Name, suite.Description) } diff --git a/test/e2e/upgrade/monitor.go b/test/e2e/upgrade/monitor.go index f53e675cb1a3..63102f8e75c3 100644 --- a/test/e2e/upgrade/monitor.go +++ b/test/e2e/upgrade/monitor.go @@ -34,7 +34,7 @@ func (m *versionMonitor) Check(initialGeneration int64, desired configv1.Update) cv, err := m.client.ConfigV1().ClusterVersions().Get(context.Background(), "version", metav1.GetOptions{}) if err != nil { msg := fmt.Sprintf("unable to retrieve cluster version during upgrade: %v", err) - framework.Logf(msg) + framework.Logf("%s", msg) return nil, msg, nil } m.lastCV = cv diff --git a/test/e2e/upgrade/upgrade.go b/test/e2e/upgrade/upgrade.go index 26baf1d7db70..b71fe9b0b233 100644 --- a/test/e2e/upgrade/upgrade.go +++ b/test/e2e/upgrade/upgrade.go @@ -162,7 +162,7 @@ var _ = g.Describe("[sig-arch][Feature:ClusterUpgrade]", func() { } if len(errMsgs) > 0 { - combinedErr := fmt.Errorf(strings.Join(errMsgs, "; ")) + combinedErr := fmt.Errorf("%s", strings.Join(errMsgs, "; ")) o.Expect(combinedErr).NotTo(o.HaveOccurred()) } }) diff --git a/test/extended/apiserver/api_requests.go b/test/extended/apiserver/api_requests.go index 5c8aed4d9ced..9bcb5a364535 100644 --- a/test/extended/apiserver/api_requests.go +++ b/test/extended/apiserver/api_requests.go @@ -117,7 +117,7 @@ var _ = g.Describe("[sig-arch][Late]", func() { for resource, requestCount := range resourceToRequestCount { details := fmt.Sprintf("user/%v accessed %v %d times", user, resource, requestCount.count) failureOutput = append(failureOutput, details) - framework.Logf(details) + framework.Logf("%s", details) } } @@ -126,10 +126,10 @@ var _ = g.Describe("[sig-arch][Late]", func() { if len(failureOutput) > 0 { if cluster414OrNewer { // for clusters 4.14+ this job needs to pass - framework.Failf(strings.Join(failureOutput, "\n")) + framework.Failf("%s", strings.Join(failureOutput, "\n")) } else { // for olders - only flake - result.Flakef(strings.Join(failureOutput, "\n")) + result.Flakef("%s", strings.Join(failureOutput, "\n")) } } }) diff --git a/test/extended/apiserver/kubeconfigs.go b/test/extended/apiserver/kubeconfigs.go index 7bde363d0482..2172fc8962d7 100644 --- a/test/extended/apiserver/kubeconfigs.go +++ b/test/extended/apiserver/kubeconfigs.go @@ -98,9 +98,9 @@ func testNode(oc *exutil.CLI, kubeconfig, masterName string) error { framework.Logf("Verifying kubeconfig %q on master %q", kubeconfig, masterName) out, err := oc.AsAdmin().Run("debug").Args("node/"+masterName, "--", "chroot", "/host", "/bin/bash", "-euxo", "pipefail", "-c", fmt.Sprintf(`oc --kubeconfig "%s" get namespace kube-system`, kubeconfigPath)).Output() - framework.Logf(out) + framework.Logf("%s", out) if err != nil { - return fmt.Errorf(out) + return fmt.Errorf("%s", out) } return nil } @@ -115,17 +115,17 @@ func testKubeApiserverContainer(oc *exutil.CLI, kubeconfig, masterName string) e framework.Logf("Copying oc binary from host to kube-apiserver container in master %q", masterName) out, err := oc.AsAdmin().Run("debug").Args("node/"+masterName, "--", "chroot", "/host", "/bin/bash", "-euxo", "pipefail", "-c", fmt.Sprintf(`oc --kubeconfig /etc/kubernetes/static-pod-resources/kube-apiserver-certs/secrets/node-kubeconfigs/localhost.kubeconfig -n openshift-kube-apiserver cp /usr/bin/oc kube-apiserver-%s:/tmp`, masterName)).Output() - framework.Logf(out) + framework.Logf("%s", out) if err != nil { - return fmt.Errorf(out) + return fmt.Errorf("%s", out) } framework.Logf("Verifying kubeconfig %q in kube-apiserver container in master %q", kubeconfig, masterName) out, err = oc.AsAdmin().Run("exec").Args("-n", "openshift-kube-apiserver", "kube-apiserver-"+masterName, "--", "/bin/bash", "-euxo", "pipefail", "-c", fmt.Sprintf(`/tmp/oc --kubeconfig "%s" get nodes`, kubeconfigPath)).Output() - framework.Logf(out) + framework.Logf("%s", out) if err != nil { - return fmt.Errorf(out) + return fmt.Errorf("%s", out) } return nil } diff --git a/test/extended/authorization/authorization.go b/test/extended/authorization/authorization.go index c1a143ff1e2a..eeba2f5271c6 100644 --- a/test/extended/authorization/authorization.go +++ b/test/extended/authorization/authorization.go @@ -204,7 +204,7 @@ func prettyPrintReviewResponse(resp *authorizationv1.ResourceAccessReviewRespons groupsStr = fmt.Sprintf(" groups:\n%s", strings.Join(groupStrList, "")) } - return fmt.Sprintf(nsStr + usersStr + groupsStr) + return nsStr + usersStr + groupsStr } // This list includes the admins from above, plus users or groups known to have global view access diff --git a/test/extended/authorization/rolebinding_restrictions.go b/test/extended/authorization/rolebinding_restrictions.go index 98ee0b2c4205..5b94e073a383 100644 --- a/test/extended/authorization/rolebinding_restrictions.go +++ b/test/extended/authorization/rolebinding_restrictions.go @@ -127,7 +127,7 @@ var _ = g.Describe("[sig-auth][Feature:RoleBindingRestrictions] RoleBindingRestr func generateAllowUserRolebindingRestriction(ns string, users []string) *authorizationv1.RoleBindingRestriction { var userstr string for _, s := range users { - userstr = fmt.Sprintf(userstr + strings.Replace(s, ":", "", -1)) + userstr += strings.Replace(s, ":", "", -1) } return &authorizationv1.RoleBindingRestriction{ ObjectMeta: metav1.ObjectMeta{ diff --git a/test/extended/ci/job_names.go b/test/extended/ci/job_names.go index 8a91fef3ea33..14ce1acb845b 100644 --- a/test/extended/ci/job_names.go +++ b/test/extended/ci/job_names.go @@ -111,7 +111,7 @@ var _ = g.Describe("[sig-ci] [Early] prow job name", func() { if isPeriodic { e2e.Fail(failMessage) } else { - result.Flakef(failMessage) + result.Flakef("%s", failMessage) } } case "OVNKubernetes": @@ -122,7 +122,7 @@ var _ = g.Describe("[sig-ci] [Early] prow job name", func() { if isPeriodic { e2e.Fail(failMessage) } else { - result.Flakef(failMessage) + result.Flakef("%s", failMessage) } } default: diff --git a/test/extended/etcd/etcd_storage_path.go b/test/extended/etcd/etcd_storage_path.go index b9dea9885e83..b64c6479cfac 100644 --- a/test/extended/etcd/etcd_storage_path.go +++ b/test/extended/etcd/etcd_storage_path.go @@ -435,7 +435,7 @@ func testEtcd3StoragePath(t g.GinkgoTInterface, oc *exutil.CLI, etcdClient3Fn fu } output, err = getFromEtcd(etcdClient3, testData.ExpectedEtcdPath) if err != nil { - framework.Logf(err.Error()) + framework.Logf("%s", err.Error()) lastErr = err continue } diff --git a/test/extended/image_ecosystem/sample_repos.go b/test/extended/image_ecosystem/sample_repos.go index befee8acea66..f72407f17a16 100644 --- a/test/extended/image_ecosystem/sample_repos.go +++ b/test/extended/image_ecosystem/sample_repos.go @@ -53,10 +53,10 @@ func NewSampleRepoTest(c sampleRepoConfig) func() { }) g.Describe("Building "+c.repoName+" app from new-app", func() { - g.It(fmt.Sprintf("should build a "+c.repoName+" image and run it in a pod [apigroup:build.openshift.io]"), func() { + g.It(fmt.Sprintf("should build a %s image and run it in a pod [apigroup:build.openshift.io]", c.repoName), func() { err := exutil.WaitForOpenShiftNamespaceImageStreams(oc) o.Expect(err).NotTo(o.HaveOccurred()) - g.By(fmt.Sprintf("calling oc new-app with the " + c.repoName + " example template")) + g.By(fmt.Sprintf("calling oc new-app with the %s example template", c.repoName)) newAppArgs := []string{c.templateURL} if len(c.newAppParams) > 0 { newAppArgs = append(newAppArgs, "-p") diff --git a/test/extended/images/oc_copy.go b/test/extended/images/oc_copy.go index 8c8d265d30dd..2d57626515d8 100644 --- a/test/extended/images/oc_copy.go +++ b/test/extended/images/oc_copy.go @@ -328,7 +328,7 @@ func (e *hookExecutor) executeExecNewPod(hook *appsv1.LifecycleHook, rc *corev1. wg.Wait() if updatedPod.Status.Phase == corev1.PodFailed { fmt.Fprintf(e.out, "--> %s: Failed\n", label) - return fmt.Errorf(updatedPod.Status.Message) + return fmt.Errorf("%s", updatedPod.Status.Message) } // Only show this message if we created the pod ourselves, or we saw // the pod in a running or pending state. diff --git a/test/extended/images/signatures.go b/test/extended/images/signatures.go index 3a233a696d86..bb386b0d95e7 100644 --- a/test/extended/images/signatures.go +++ b/test/extended/images/signatures.go @@ -118,7 +118,7 @@ var _ = g.Describe("[sig-imageregistry][Serial] Image signature workflow", func( g.By("expecting the image to have unverified signature") out, err = oc.Run("describe").Args("istag", "signed:latest").Output() o.Expect(err).NotTo(o.HaveOccurred()) - e2e.Logf(out) + e2e.Logf("%s", out) o.Expect(out).To(o.ContainSubstring("Unverified")) out, err = pod.Exec(strings.Join([]string{ diff --git a/test/extended/networking/cnimigration.go b/test/extended/networking/cnimigration.go index adc3903ffeb3..bd4f078d511a 100644 --- a/test/extended/networking/cnimigration.go +++ b/test/extended/networking/cnimigration.go @@ -293,7 +293,7 @@ var _ = g.Describe("[sig-network][Feature:CNIMigration]", g.Ordered, func() { } } if len(errMsgs) > 0 { - combinedErr := fmt.Errorf(strings.Join(errMsgs, "; ")) + combinedErr := fmt.Errorf("%s", strings.Join(errMsgs, "; ")) framework.ExpectNoError(combinedErr) } }) diff --git a/test/extended/networking/egressip.go b/test/extended/networking/egressip.go index 96cc22a6a6d6..79bad1cff725 100644 --- a/test/extended/networking/egressip.go +++ b/test/extended/networking/egressip.go @@ -744,7 +744,7 @@ func applyEgressIPObject(oc *exutil.CLI, cloudNetworkClientset cloudnetwork.Inte o.Expect(err).NotTo(o.HaveOccurred()) if cloudNetworkClientset != nil { - framework.Logf(fmt.Sprintf("Waiting for CloudPrivateIPConfig creation for a maximum of %d seconds", timeout)) + framework.Logf("Waiting for CloudPrivateIPConfig creation for a maximum of %d seconds", timeout) var exists bool var isAssigned bool o.Eventually(func() bool { @@ -765,7 +765,7 @@ func applyEgressIPObject(oc *exutil.CLI, cloudNetworkClientset cloudnetwork.Inte }, time.Duration(timeout)*time.Second, 5*time.Second).Should(o.BeTrue()) } - framework.Logf(fmt.Sprintf("Waiting for EgressIP addresses inside status of EgressIP CR %s for a maximum of %d seconds", egressIPObjectName, timeout)) + framework.Logf("Waiting for EgressIP addresses inside status of EgressIP CR %s for a maximum of %d seconds", egressIPObjectName, timeout) var hasIP bool var nodeName string o.Eventually(func() bool { @@ -816,7 +816,7 @@ func openshiftSDNAssignEgressIPsManually(oc *exutil.CLI, cloudNetworkClientset c o.Expect(err).NotTo(o.HaveOccurred()) } - framework.Logf(fmt.Sprintf("Waiting for CloudPrivateIPConfig creation for a maximum of %d seconds", timeout)) + framework.Logf("Waiting for CloudPrivateIPConfig creation for a maximum of %d seconds", timeout) var exists bool var isAssigned bool o.Eventually(func() bool { diff --git a/test/extended/networking/egressip_helpers.go b/test/extended/networking/egressip_helpers.go index 07acc389a33d..e0696edc64fe 100644 --- a/test/extended/networking/egressip_helpers.go +++ b/test/extended/networking/egressip_helpers.go @@ -1289,7 +1289,7 @@ func sendProbesToHostPort(oc *exutil.CLI, proberPod *v1.Pod, url, targetProtocol for e := range errChan { errList = fmt.Sprintf("%s {%s}", errList, e.Error()) } - return "", fmt.Errorf(errList) + return "", fmt.Errorf("%s", errList) } return randomID.String(), nil diff --git a/test/extended/networking/ipsec.go b/test/extended/networking/ipsec.go index 29194e8f0833..e71d21638d33 100644 --- a/test/extended/networking/ipsec.go +++ b/test/extended/networking/ipsec.go @@ -827,5 +827,5 @@ func dumpPodCommand(namespace, name, cmd string) { g.GinkgoHelper() stdout, err := e2eoutput.RunHostCmdWithRetries(namespace, name, cmd, statefulset.StatefulSetPoll, statefulset.StatefulPodTimeout) o.Expect(err).NotTo(o.HaveOccurred()) - framework.Logf(name + ": " + strings.Join(strings.Split(stdout, "\n"), fmt.Sprintf("\n%s: ", name))) + framework.Logf("%s: %s", name, strings.Join(strings.Split(stdout, "\n"), fmt.Sprintf("\n%s: ", name))) } diff --git a/test/extended/olm/olm.go b/test/extended/olm/olm.go index 18cfe761c9a7..62241c45950b 100644 --- a/test/extended/olm/olm.go +++ b/test/extended/olm/olm.go @@ -169,7 +169,7 @@ var _ = g.Describe("[sig-arch] ocp payload should be based on existing source", gitCommitID := strings.TrimSpace(idSlice[len(idSlice)-1]) e2e.Logf("olm source git commit ID:%s", gitCommitID) if len(gitCommitID) != 40 { - e2e.Failf(fmt.Sprintf("the length of the git commit id is %d, != 40", len(gitCommitID))) + e2e.Failf("the length of the git commit id is %d, != 40", len(gitCommitID)) } if sameCommit == "" { diff --git a/test/extended/operators/certs.go b/test/extended/operators/certs.go index 53f93025a853..58124e991bc2 100644 --- a/test/extended/operators/certs.go +++ b/test/extended/operators/certs.go @@ -269,7 +269,7 @@ var _ = g.Describe(fmt.Sprintf("[sig-arch][Late][Jira:%q]", "kube-apiserver"), g } // TODO: uncomment when test no longer fails and enhancement is merged //g.Fail(fmt.Sprintf("Unregistered TLS certificates:\n%s", registryString)) - testresult.Flakef(fmt.Sprintf("Unregistered TLS certificates found:\n%s\nSee tls/ownership/README.md in origin repo", registryString)) + testresult.Flakef("Unregistered TLS certificates found:\n%s\nSee tls/ownership/README.md in origin repo", registryString) } }) @@ -281,7 +281,7 @@ var _ = g.Describe(fmt.Sprintf("[sig-arch][Late][Jira:%q]", "kube-apiserver"), g if len(messages) > 0 { // TODO: uncomment when test no longer fails and enhancement is merged //g.Fail(strings.Join(messages, "\n")) - testresult.Flakef(strings.Join(messages, "\n")) + testresult.Flakef("%s", strings.Join(messages, "\n")) } }) diff --git a/test/extended/pods/systemd.go b/test/extended/pods/systemd.go index 786b12bdb9c9..f7d452583560 100644 --- a/test/extended/pods/systemd.go +++ b/test/extended/pods/systemd.go @@ -33,6 +33,6 @@ var _ = g.Describe("[sig-node][Late]", func() { timeoutString := fmt.Sprintf("systemd timed out for pod %v/%v", event.InvolvedObject.Namespace, event.InvolvedObject.Name) timeoutStrings = append(timeoutStrings, timeoutString) } - result.Flakef(strings.Join(timeoutStrings, "\n")) + result.Flakef("%s", strings.Join(timeoutStrings, "\n")) }) }) diff --git a/test/extended/prometheus/prometheus.go b/test/extended/prometheus/prometheus.go index 1608edd3932f..2b29b684825c 100644 --- a/test/extended/prometheus/prometheus.go +++ b/test/extended/prometheus/prometheus.go @@ -283,7 +283,7 @@ var _ = g.Describe("[sig-instrumentation][Late] OpenShift alerting rules [apigro return nil }) if err != nil { - e2e.Failf(err.Error()) + e2e.Failf("%s", err.Error()) } }) @@ -313,7 +313,7 @@ var _ = g.Describe("[sig-instrumentation][Late] OpenShift alerting rules [apigro return violations }) if err != nil { - e2e.Failf(err.Error()) + e2e.Failf("%s", err.Error()) } }) @@ -336,7 +336,7 @@ var _ = g.Describe("[sig-instrumentation][Late] OpenShift alerting rules [apigro return violations }) if err != nil { - e2e.Failf(err.Error()) + e2e.Failf("%s", err.Error()) } }) @@ -357,7 +357,7 @@ var _ = g.Describe("[sig-instrumentation][Late] OpenShift alerting rules [apigro return violations }) if err != nil { - e2e.Failf(err.Error()) + e2e.Failf("%s", err.Error()) } }) @@ -381,7 +381,7 @@ var _ = g.Describe("[sig-instrumentation][Late] OpenShift alerting rules [apigro if err != nil { // We can't fail the test because the runbook URLs might be temporarily unavailable. // At least we can manually check the CI logs to identify buggy URLs. - testresult.Flakef(err.Error()) + testresult.Flakef("%s", err.Error()) } }) }) @@ -507,7 +507,7 @@ var _ = g.Describe("[sig-instrumentation] Prometheus [apigroup:image.openshift.i if err != nil { // Making the test flaky until monitoring team fixes the rate limit issue. - testresult.Flakef(err.Error()) + testresult.Flakef("%s", err.Error()) } }) diff --git a/test/extended/router/h2spec.go b/test/extended/router/h2spec.go index c471ccb97a11..d8af2b42654d 100644 --- a/test/extended/router/h2spec.go +++ b/test/extended/router/h2spec.go @@ -623,7 +623,7 @@ func runConformanceTestsAndLogAggregateFailures(oc *exutil.CLI, host, podName st for i := 1; i <= iterations; i++ { testResults, err := runConformanceTests(oc, host, podName, 10*time.Minute) if err != nil { - e2e.Logf(err.Error()) + e2e.Logf("%s", err.Error()) continue } failures := failingTests(testResults) diff --git a/test/extended/router/stress.go b/test/extended/router/stress.go index f32476c6f73e..660b7c89fb4e 100644 --- a/test/extended/router/stress.go +++ b/test/extended/router/stress.go @@ -670,7 +670,7 @@ func verifyCommandEquivalent(c clientset.Interface, rs *appsv1.ReplicaSet, cmd s }) for name, stdout := range values { stdout = strings.TrimSuffix(stdout, "\n") - e2e.Logf(name + ": " + strings.Join(strings.Split(stdout, "\n"), fmt.Sprintf("\n%s: ", name))) + e2e.Logf("%s: %s", name, strings.Join(strings.Split(stdout, "\n"), fmt.Sprintf("\n%s: ", name))) } o.Expect(err).NotTo(o.HaveOccurred()) } diff --git a/test/extended/util/framework.go b/test/extended/util/framework.go index 886b06e4ed93..3dcdbd1f0fb8 100644 --- a/test/extended/util/framework.go +++ b/test/extended/util/framework.go @@ -235,8 +235,8 @@ func WaitForInternalRegistryHostname(oc *CLI) (string, error) { } func processScanError(log string) error { - e2e.Logf(log) - return fmt.Errorf(log) + e2e.Logf("%s", log) + return fmt.Errorf("%s", log) } // getImageStreamObj returns the updated spec for imageStream object @@ -394,7 +394,7 @@ func WaitForSamplesImagestream(ctx context.Context, oc *CLI, imagestream string, strbuf.WriteString(" - check status at https://status.redhat.com (catalog.redhat.com) for reported outages\n") strbuf.WriteString(" - if no outages are reported there, email Terms-Based-Registry-Team@redhat.com with a report of the error\n") strbuf.WriteString(" and prepare to work with the test platform team to get the current set of tokens for CI\n") - e2e.Logf(strbuf.String()) + e2e.Logf("%s", strbuf.String()) } return pollErr } @@ -585,7 +585,7 @@ func DumpPodStates(oc *CLI) { e2e.Logf("Error dumping pod states: %v", err) return } - e2e.Logf(out) + e2e.Logf("%s", out) } // DumpPodStatesInNamespace dumps the state of all pods in the provided namespace. @@ -596,7 +596,7 @@ func DumpPodStatesInNamespace(namespace string, oc *CLI) { e2e.Logf("Error dumping pod states: %v", err) return } - e2e.Logf(out) + e2e.Logf("%s", out) } // DumpPodLogsStartingWith will dump any pod starting with the name prefix provided @@ -680,7 +680,7 @@ func DumpPodsCommand(c kubernetes.Interface, ns string, selector labels.Selector } for name, stdout := range values { stdout = strings.TrimSuffix(stdout, "\n") - e2e.Logf(name + ": " + strings.Join(strings.Split(stdout, "\n"), fmt.Sprintf("\n%s: ", name))) + e2e.Logf("%s: %s", name, strings.Join(strings.Split(stdout, "\n"), fmt.Sprintf("\n%s: ", name))) } } @@ -692,7 +692,7 @@ func DumpConfigMapStates(oc *CLI) { e2e.Logf("Error dumping configMap states: %v", err) return } - e2e.Logf(out) + e2e.Logf("%s", out) } // GetMasterThreadDump will get a golang thread stack dump @@ -2190,7 +2190,7 @@ func SkipIfExternalControlplaneTopology(oc *CLI, reason string) { controlPlaneTopology, err := GetControlPlaneTopology(oc) o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred()) if *controlPlaneTopology == configv1.ExternalTopologyMode { - skipper.Skipf(reason) + skipper.Skipf("%s", reason) } } diff --git a/test/extended/util/jenkins/ref.go b/test/extended/util/jenkins/ref.go index 7ee1775bfb0e..ee3cca5bbbc9 100644 --- a/test/extended/util/jenkins/ref.go +++ b/test/extended/util/jenkins/ref.go @@ -326,7 +326,7 @@ func (j *JenkinsRef) GetJobConsoleLogsAndMatchViaBuildResult(br *exutil.BuildRes return "", err } bldURI = strings.Trim(url.Path, "/") - return j.WaitForContent(match, 200, 10*time.Minute, bldURI) + return j.WaitForContent(match, 200, 10*time.Minute, "%s", bldURI) } return "", fmt.Errorf("build %#v is missing the build uri annontation", br.Build) } @@ -374,7 +374,7 @@ func DumpLogs(oc *exutil.CLI, t *exutil.BuildResult) (string, error) { return "", err } jenkinsRef := NewRef(oc) - log, _, err := jenkinsRef.GetResource(jenkinsLogURL.Path) + log, _, err := jenkinsRef.GetResource("%s", jenkinsLogURL.Path) if err != nil { return "", fmt.Errorf("cannot get jenkins log: %v", err) } diff --git a/test/extended/util/nfs.go b/test/extended/util/nfs.go index 6c4cb5e5ae5a..6bfc4982a606 100644 --- a/test/extended/util/nfs.go +++ b/test/extended/util/nfs.go @@ -24,7 +24,7 @@ func SetupK8SNFSServerAndVolume(oc *CLI, count int) (*kapiv1.Pod, []*kapiv1.Pers return nil, nil, err } - e2e.Logf(fmt.Sprintf("Creating NFS server")) + e2e.Logf("Creating NFS server") config := volume.TestConfig{ Namespace: oc.Namespace(), Prefix: "nfs", @@ -52,7 +52,7 @@ func SetupK8SNFSServerAndVolume(oc *CLI, count int) (*kapiv1.Pod, []*kapiv1.Pers pvs := []*kapiv1.PersistentVolume{} volLabel := labels.Set{e2epv.VolumeSelectorKey: oc.Namespace()} for i := 0; i < count; i++ { - e2e.Logf(fmt.Sprintf("Creating persistent volume %d", i)) + e2e.Logf("Creating persistent volume %d", i) pvConfig := e2epv.PersistentVolumeConfig{ NamePrefix: "nfs-", Labels: volLabel, diff --git a/test/extended/util/prometheus/helpers.go b/test/extended/util/prometheus/helpers.go index 211fd0fce34e..5cc91c64bb43 100644 --- a/test/extended/util/prometheus/helpers.go +++ b/test/extended/util/prometheus/helpers.go @@ -220,7 +220,7 @@ func RunQueries(ctx context.Context, prometheusClient prometheusv1.API, promQuer if prev, ok := queryErrors[query]; ok && prev.Error() != msg { framework.Logf("%s", prev.Error()) } - queryErrors[query] = fmt.Errorf(msg) + queryErrors[query] = fmt.Errorf("%s", msg) continue } @@ -357,12 +357,10 @@ func ValidateURL(rawURL string) error { } if u.Scheme != "http" && u.Scheme != "https" { - errstr := fmt.Sprintf("%q: URL scheme is invalid, it should be 'http' or 'https'", rawURL) - return fmt.Errorf(errstr) + return fmt.Errorf("%q: URL scheme is invalid, it should be 'http' or 'https'", rawURL) } if u.Host == "" { - errstr := fmt.Sprintf("%q: host should not be empty", rawURL) - return fmt.Errorf(errstr) + return fmt.Errorf("%q: host should not be empty", rawURL) } return nil } diff --git a/test/extended/util/volumes.go b/test/extended/util/volumes.go index 8c27f723b60d..8d36fe4c33e7 100644 --- a/test/extended/util/volumes.go +++ b/test/extended/util/volumes.go @@ -40,7 +40,7 @@ func DumpPersistentVolumeInfo(oc *CLI) { e2e.Logf("Error dumping persistent volume info: %v", err) return } - e2e.Logf(out) + e2e.Logf("%s", out) out, err = oc.AsAdmin().Run("get").Args("pvc", "-n", oc.Namespace()).Output() if err != nil { e2e.Logf("Error dumping persistent volume claim info: %v", err) @@ -52,6 +52,6 @@ func DumpPersistentVolumeInfo(oc *CLI) { e2e.Logf("Error dumping persistent volume claim info: %v", err) return } - e2e.Logf(out) + e2e.Logf("%s", out) } diff --git a/tools/gotest2junit/gotest2junit.go b/tools/gotest2junit/gotest2junit.go index dea31e7d102a..88860e3e90aa 100644 --- a/tools/gotest2junit/gotest2junit.go +++ b/tools/gotest2junit/gotest2junit.go @@ -196,7 +196,7 @@ func stream(r io.Reader, summarize, verbose bool) (map[string]*testSuite, error) defaultTest.SystemOut += line defaultTest.SystemOut += out defaultTest.FailureOutput = &api.FailureOutput{} - fmt.Fprintf(os.Stderr, out) + fmt.Fprintf(os.Stderr, "%s", out) } }