MCPcopy
hub / github.com/kptdev/kpt / TestCmd_fail

Function TestCmd_fail

internal/cmdget/cmdget_test.go:156–166  ·  view source on GitHub ↗

TestCmd_fail verifies that that command returns an error rather than exiting the process

(t *testing.T)

Source from the content-addressed store, hash-verified

154
155// TestCmd_fail verifies that that command returns an error rather than exiting the process
156func TestCmd_fail(t *testing.T) {
157 r := cmdget.NewRunner("kpt")
158 r.Command.SilenceErrors = true
159 r.Command.SilenceUsage = true
160 r.Command.SetArgs([]string{"file://" + filepath.Join("not", "real", "dir") + ".git/@master", "./"})
161 err := r.Command.Execute()
162 if !assert.Error(t, err) {
163 return
164 }
165 assert.Contains(t, err.Error(), "failed to lookup master(or main) branch")
166}
167
168// TestCmd_git tests that if a package path contains .git, it is still parsed correctly
169func TestCmd_git(t *testing.T) {

Callers

nothing calls this directly

Calls 2

NewRunnerFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected