MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / Unchecked

Function Unchecked

tests/utils/run/run.go:38–55  ·  view source on GitHub ↗

Unchecked executes a command and process the information

(command string)

Source from the content-addressed store, hash-verified

36
37// Unchecked executes a command and process the information
38func Unchecked(command string) (stdout string, stderr string, err error) {
39 tokens, err := shlex.Split(command)
40 if err != nil {
41 ginkgo.GinkgoWriter.Printf("Error parsing command `%v`: %v\n", command, err)
42 return "", "", err
43 }
44
45 var outBuffer, errBuffer bytes.Buffer
46 cmd := exec.Command(tokens[0], tokens[1:]...) // #nosec G204
47 cmd.Stdout, cmd.Stderr = &outBuffer, &errBuffer
48 err = cmd.Run()
49 stdout = outBuffer.String()
50 stderr = errBuffer.String()
51 if err != nil {
52 err = fmt.Errorf("%w - %v", err, stderr)
53 }
54 return stdout, stderr, err
55}
56
57// UncheckedRetry executes a command and process the information with retry
58func UncheckedRetry(command string) (stdout string, stderr string, err error) {

Callers 15

TestFileExistFunction · 0.92
TestDirectoryEmptyFunction · 0.92
VersionFunction · 0.92
ArchitecturesFunction · 0.92
InstallLatestFunction · 0.92
DrainPrimaryFunction · 0.92
ExecuteFunction · 0.92
CountFilesFunction · 0.92
ListFilesFunction · 0.92

Calls 2

RunMethod · 0.45
StringMethod · 0.45

Tested by 5

TestFileExistFunction · 0.74
TestDirectoryEmptyFunction · 0.74
TestBarmanConnectivityFunction · 0.74
OnlineResizePVCFunction · 0.74
OfflineResizePVCFunction · 0.74