MCPcopy
hub / github.com/google/cadvisor / RunStress

Method RunStress

integration/framework/framework.go:444–463  ·  view source on GitHub ↗
(command string, args ...string)

Source from the content-addressed store, hash-verified

442}
443
444func (a shellActions) RunStress(command string, args ...string) (string, string) {
445 var cmd *exec.Cmd
446 if a.fm.Hostname().Host == "localhost" {
447 // Just run locally.
448 cmd = exec.Command(command, args...)
449 } else {
450 // We must SSH to the remote machine and run the command.
451 cmd = a.wrapSSH(command, args...)
452 }
453 var stdout bytes.Buffer
454 var stderr bytes.Buffer
455 cmd.Stdout = &stdout
456 cmd.Stderr = &stderr
457 err := cmd.Run()
458 if err != nil {
459 a.fm.T().Logf("Ran %q %v in %q and received error: %q. Stdout: %q, Stderr: %s", command, args, a.fm.Hostname().Host, err, stdout.String(), stderr.String())
460 return stdout.String(), stderr.String()
461 }
462 return stdout.String(), stderr.String()
463}
464
465// Runs retryFunc until no error is returned. After dur time the last error is returned.
466// Note that the function does not timeout the execution of retryFunc when the limit is reached.

Callers

nothing calls this directly

Calls 5

wrapSSHMethod · 0.95
HostnameMethod · 0.65
RunMethod · 0.65
TMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected