MCPcopy
hub / github.com/docker/compose / TestHandleHook_LogsCommand

Function TestHandleHook_LogsCommand

cmd/compose/hooks_test.go:71–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

69}
70
71func TestHandleHook_LogsCommand(t *testing.T) {
72 tests := []struct {
73 rootCmd string
74 wantHint func(appID string) string
75 }{
76 {rootCmd: "compose logs", wantHint: composeLogsHint},
77 {rootCmd: "logs", wantHint: dockerLogsHint},
78 }
79 for _, tt := range tests {
80 t.Run(tt.rootCmd, func(t *testing.T) {
81 data := marshalHookData(t, hooks.Request{
82 RootCmd: tt.rootCmd,
83 })
84 var buf bytes.Buffer
85 err := handleHook(t.Context(), []string{data}, &buf)
86 assert.NilError(t, err)
87
88 msg := unmarshalResponse(t, buf.Bytes())
89 assert.Equal(t, msg.Type, hooks.NextSteps)
90 assert.Equal(t, msg.Template, tt.wantHint(""))
91 })
92 }
93}
94
95func TestHandleHook_ComposeUpDetached(t *testing.T) {
96 tests := []struct {

Callers

nothing calls this directly

Calls 4

marshalHookDataFunction · 0.85
handleHookFunction · 0.85
unmarshalResponseFunction · 0.85
BytesMethod · 0.80

Tested by

no test coverage detected