Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 7 additions & 6 deletions pkg/clioptions/suiteselection/suite_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
Expand Down Expand Up @@ -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 {
Expand All @@ -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])
}

Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion pkg/disruption/backend/shutdown/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions pkg/monitor/backenddisruption/disruption_backend_sampler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -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)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/riskanalysis/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/openshift/origin/pkg/dataloader"
"io"
"net/http"
"os"
Expand All @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/testsuites/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/upgrade/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
})
Expand Down
6 changes: 3 additions & 3 deletions test/extended/apiserver/api_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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"))
}
}
})
Expand Down
12 changes: 6 additions & 6 deletions test/extended/apiserver/kubeconfigs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion test/extended/authorization/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/extended/authorization/rolebinding_restrictions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions test/extended/ci/job_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion test/extended/etcd/etcd_storage_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions test/extended/image_ecosystem/sample_repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion test/extended/images/oc_copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test/extended/images/signatures.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion test/extended/networking/cnimigration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
Expand Down
6 changes: 3 additions & 3 deletions test/extended/networking/egressip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion test/extended/networking/egressip_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/extended/networking/ipsec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
2 changes: 1 addition & 1 deletion test/extended/olm/olm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down
4 changes: 2 additions & 2 deletions test/extended/operators/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})

Expand All @@ -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"))
}
})

Expand Down
2 changes: 1 addition & 1 deletion test/extended/pods/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
})
})
Loading