MCPcopy Create free account
hub / github.com/docker/secrets-engine / execute

Function execute

plugins/pass/commands/command_test.go:226–229  ·  view source on GitHub ↗

execute runs cmd as if it were the root command: it attaches mock to the command context so RunE bodies can pull it via StoreFrom, captures stdout and stderr into one buffer (mirroring how cobra collapses both onto the user's terminal), and silences usage so error output stays minimal. Pass mock ==

(t *testing.T, cmd *cobra.Command, mock store.Store, args ...string)

Source from the content-addressed store, hash-verified

224//
225// Pass mock == nil for commands that do not consult the store.
226func execute(t *testing.T, cmd *cobra.Command, mock store.Store, args ...string) (string, error) {
227 t.Helper()
228 return runCobra(t, cmd, mock, nil, args)
229}
230
231func executeWithStdin(t *testing.T, cmd *cobra.Command, mock store.Store, stdin string, args ...string) (string, error) {
232 t.Helper()

Callers 5

Test_VersionCommandFunction · 0.85
Test_SetCommandFunction · 0.85
Test_ListCommandFunction · 0.85
Test_RmCommandFunction · 0.85
Test_GetCommandFunction · 0.85

Calls 1

runCobraFunction · 0.85

Tested by

no test coverage detected