Skip to content
Merged
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
10 changes: 9 additions & 1 deletion test/extended/util/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ type CLI struct {
addEnvVars map[string]string

verbose bool
showInfo bool // control framework.Logf output
withoutNamespace bool
withManagedNamespace bool
kubeFramework *framework.Framework
Expand All @@ -134,6 +135,7 @@ func NewCLIWithFramework(kubeFramework *framework.Framework) *CLI {
execPath: "oc",
adminConfigPath: KubeConfigPath(),
staticConfigManifestDir: StaticConfigManifestDir(),
showInfo: true,
}
// Called only once (assumed the objects will never get modified)
// TODO: run in every BeforeEach
Expand Down Expand Up @@ -178,6 +180,7 @@ func NewCLIWithoutNamespace(project string) *CLI {
execPath: "oc",
adminConfigPath: KubeConfigPath(),
staticConfigManifestDir: StaticConfigManifestDir(),
showInfo: true,
withoutNamespace: true,
}
g.BeforeEach(cli.kubeFramework.BeforeEach)
Expand Down Expand Up @@ -211,6 +214,7 @@ func NewCLIForMonitorTest(project string) *CLI {
execPath: "oc",
adminConfigPath: KubeConfigPath(),
staticConfigManifestDir: StaticConfigManifestDir(),
showInfo: true,
withoutNamespace: true,
}

Expand Down Expand Up @@ -241,6 +245,7 @@ func NewHypershiftManagementCLI(project string) *CLI {
username: "admin",
execPath: "oc",
adminConfigPath: kubeconfig,
showInfo: true,
withoutNamespace: true,
}
}
Expand Down Expand Up @@ -1020,7 +1025,10 @@ func (c *CLI) start(stdOutBuff, stdErrBuff *bytes.Buffer) (*exec.Cmd, error) {
cmd := exec.Command(c.execPath, c.finalArgs...)
cmd.Stdin = c.stdin
// Redact any bearer token information from the log.
framework.Logf("Running '%s %s'", c.execPath, RedactBearerToken(strings.Join(c.finalArgs, " ")))
// Only log if showInfo is enabled (controlled by util_otp)
if c.showInfo {
framework.Logf("Running '%s %s'", c.execPath, RedactBearerToken(strings.Join(c.finalArgs, " ")))
}

cmd.Env = c.env
if len(c.addEnvVars) > 0 {
Expand Down
6 changes: 2 additions & 4 deletions test/extended/util/util_otp.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ import (

// NotShowInfo disables showing info in CLI output
func (c *CLI) NotShowInfo() *CLI {
// OTP tracks this with a showInfo field, but origin doesn't have this field
// For now, this is a no-op in origin
c.showInfo = false
return c
}

// SetShowInfo enables showing info in CLI output
func (c *CLI) SetShowInfo() *CLI {
// OTP tracks this with a showInfo field, but origin doesn't have this field
// For now, this is a no-op in origin
c.showInfo = true
return c
}

Expand Down