MCPcopy
hub / github.com/grafana/tempo / runCobra

Function runCobra

tools/chloggen/cmd/cmd_test.go:151–164  ·  view source on GitHub ↗
(t *testing.T, args ...string)

Source from the content-addressed store, hash-verified

149}
150
151func runCobra(t *testing.T, args ...string) (string, error) {
152 cmd := rootCmd()
153
154 outBytes := bytes.NewBufferString("")
155 cmd.SetOut(outBytes)
156
157 cmd.SetArgs(args)
158 err := cmd.Execute()
159
160 out, ioErr := io.ReadAll(outBytes)
161 require.NoError(t, ioErr, "read stdout")
162
163 return string(out), err
164}
165
166func readBytes(path string) ([]byte, error) {
167 file, err := os.Open(filepath.Clean(path))

Callers 11

TestNewErrFunction · 0.85
TestNewFunction · 0.85
TestUpdateErrFunction · 0.85
TestUpdateFunction · 0.85
TestRootFunction · 0.85
TestValidateErrFunction · 0.85
TestValidateFunction · 0.85

Calls 2

rootCmdFunction · 0.85
ReadAllMethod · 0.65

Tested by

no test coverage detected