mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Add a verbosity option to exec
Exec is a utility function but, if you call it and are already planning to either suppress or print the exec command before hand, its ability to log can be redundant or a hinderance on test readability
This commit is contained in:
parent
7e1f4a9fa3
commit
38e49e0e0f
@ -43,14 +43,16 @@ type ExecOptions struct {
|
|||||||
CaptureStderr bool
|
CaptureStderr bool
|
||||||
// If false, whitespace in std{err,out} will be removed.
|
// If false, whitespace in std{err,out} will be removed.
|
||||||
PreserveWhitespace bool
|
PreserveWhitespace bool
|
||||||
|
Quiet bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecWithOptions executes a command in the specified container,
|
// ExecWithOptions executes a command in the specified container,
|
||||||
// returning stdout, stderr and error. `options` allowed for
|
// returning stdout, stderr and error. `options` allowed for
|
||||||
// additional parameters to be passed.
|
// additional parameters to be passed.
|
||||||
func (f *Framework) ExecWithOptions(options ExecOptions) (string, string, error) {
|
func (f *Framework) ExecWithOptions(options ExecOptions) (string, string, error) {
|
||||||
|
if !options.Quiet {
|
||||||
Logf("ExecWithOptions %+v", options)
|
Logf("ExecWithOptions %+v", options)
|
||||||
|
}
|
||||||
config, err := LoadConfig()
|
config, err := LoadConfig()
|
||||||
ExpectNoError(err, "failed to load restclient config")
|
ExpectNoError(err, "failed to load restclient config")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user