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

Function TestJSONFormatWithNoUpdateConfig

cli/command/service/inspect_test.go:169–188  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestJSONFormatWithNoUpdateConfig(t *testing.T) {
170 now := time.Now()
171 // s1: [{"ID":..}]
172 // s2: {"ID":..}
173 s1 := formatServiceInspect(t, newFormat(""), now)
174 s2 := formatServiceInspect(t, newFormat("{{json .}}"), now)
175 var m1Wrap []map[string]any
176 if err := json.Unmarshal([]byte(s1), &m1Wrap); err != nil {
177 t.Fatal(err)
178 }
179 if len(m1Wrap) != 1 {
180 t.Fatalf("strange s1=%s", s1)
181 }
182 m1 := m1Wrap[0]
183 var m2 map[string]any
184 if err := json.Unmarshal([]byte(s2), &m2); err != nil {
185 t.Fatal(err)
186 }
187 assert.Check(t, is.DeepEqual(m1, m2))
188}
189
190func TestPrettyPrintWithConfigsAndSecrets(t *testing.T) {
191 s := formatServiceInspect(t, newFormat("pretty"), time.Now())

Callers

nothing calls this directly

Calls 2

formatServiceInspectFunction · 0.85
newFormatFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…