MCPcopy Index your code
hub / github.com/docker/cli / TestVersionWithoutServer

Function TestVersionWithoutServer

cli/command/system/version_test.go:19–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestVersionWithoutServer(t *testing.T) {
20 cli := test.NewFakeCli(&fakeClient{
21 serverVersion: func(ctx context.Context, options client.ServerVersionOptions) (client.ServerVersionResult, error) {
22 return client.ServerVersionResult{}, errors.New("no server")
23 },
24 })
25 cmd := newVersionCommand(cli)
26 cmd.SetArgs([]string{})
27 cmd.SetOut(cli.Err())
28 cmd.SetErr(io.Discard)
29 assert.ErrorContains(t, cmd.Execute(), "no server")
30 out := cli.OutBuffer().String()
31 // TODO: use an assertion like e2e/image/build_test.go:assertBuildOutput()
32 // instead of contains/not contains
33 assert.Check(t, is.Contains(out, "Client:"))
34 assert.Assert(t, !strings.Contains(out, "Server:"), "actual: %s", out)
35}
36
37func TestVersionFormat(t *testing.T) {
38 vi := versionInfo{

Callers

nothing calls this directly

Calls 8

ErrMethod · 0.95
OutBufferMethod · 0.95
newVersionCommandFunction · 0.85
SetArgsMethod · 0.80
ContainsMethod · 0.80
StringMethod · 0.65
SetOutMethod · 0.45
SetErrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…