MCPcopy Create free account
hub / github.com/containerd/nerdctl / TestInfo

Function TestInfo

cmd/nerdctl/system/system_info_test.go:46–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func TestInfo(t *testing.T) {
47 testCase := nerdtest.Setup()
48
49 // Note: some functions need to be tested without the automatic --namespace nerdctl-test argument, so we need
50 // to retrieve the binary name.
51 // Note that we know this works already, so no need to assert err.
52 bin, _ := exec.LookPath(testutil.GetTarget())
53
54 testCase.SubTests = []*test.Case{
55 {
56 Description: "info",
57 Command: test.Command("info", "--format", "{{json .}}"),
58 Expected: test.Expects(0, nil, testInfoComparator),
59 },
60 {
61 Description: "info convenience form",
62 Command: test.Command("info", "--format", "json"),
63 Expected: test.Expects(0, nil, testInfoComparator),
64 },
65 {
66 Description: "info with namespace",
67 Require: require.Not(nerdtest.Docker),
68 Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
69 return helpers.Custom(bin, "info")
70 },
71 Expected: test.Expects(0, nil, expect.Contains("Namespace: default")),
72 },
73 {
74 Description: "info with namespace env var",
75 Env: map[string]string{
76 "CONTAINERD_NAMESPACE": "test",
77 },
78 Require: require.Not(nerdtest.Docker),
79 Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
80 return helpers.Custom(bin, "info")
81 },
82 Expected: test.Expects(0, nil, expect.Contains("Namespace: test")),
83 },
84 }
85
86 testCase.Run(t)
87}

Callers

nothing calls this directly

Calls 5

SetupFunction · 0.92
GetTargetFunction · 0.92
CommandMethod · 0.65
CustomMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…