MCPcopy
hub / github.com/kopia/kopia / RunAndExpectFailure

Method RunAndExpectFailure

tests/testenv/cli_test_env.go:261–270  ·  view source on GitHub ↗

RunAndExpectFailure runs the given command, expects it to fail and returns its output lines.

(tb testing.TB, args ...string)

Source from the content-addressed store, hash-verified

259
260// RunAndExpectFailure runs the given command, expects it to fail and returns its output lines.
261func (e *CLITest) RunAndExpectFailure(tb testing.TB, args ...string) (stdout, stderr []string) {
262 tb.Helper()
263
264 var err error
265
266 stdout, stderr, err = e.Run(tb, true, args...)
267 require.Error(tb, err, "'kopia %v' succeeded, but expected failure", strings.Join(args, " "))
268
269 return stdout, stderr
270}
271
272// RunAndVerifyOutputLineCount runs the given command and asserts it returns the given number of output lines, then returns them.
273func (e *CLITest) RunAndVerifyOutputLineCount(tb testing.TB, wantLines int, args ...string) []string {

Callers 15

TestRepoThrottleFunction · 0.95
TestNotificationProfileFunction · 0.95
TestSnapshotVerifyFunction · 0.95
TestSetSplitterPolicyFunction · 0.95
TestSnapshotPinFunction · 0.95
TestCacheSetFunction · 0.95
TestBlobShardsModifyFunction · 0.95

Calls 3

RunMethod · 0.95
HelperMethod · 0.80
ErrorMethod · 0.65

Tested by 15

TestRepoThrottleFunction · 0.76
TestNotificationProfileFunction · 0.76
TestSnapshotVerifyFunction · 0.76
TestSetSplitterPolicyFunction · 0.76
TestSnapshotPinFunction · 0.76
TestCacheSetFunction · 0.76
TestBlobShardsModifyFunction · 0.76