MCPcopy Create free account
hub / github.com/docker/cli / TestTlsListAndBatchRemove

Function TestTlsListAndBatchRemove

cli/context/store/tlsstore_test.go:35–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestTlsListAndBatchRemove(t *testing.T) {
36 testee := tlsStore{root: t.TempDir()}
37
38 all := map[string]EndpointFiles{
39 "ep1": {"f1", "f2", "f3"},
40 "ep2": {"f1", "f2", "f3"},
41 "ep3": {"f1", "f2", "f3"},
42 }
43
44 ep1ep2 := map[string]EndpointFiles{
45 "ep1": {"f1", "f2", "f3"},
46 "ep2": {"f1", "f2", "f3"},
47 }
48
49 const contextName = "test-ctx"
50 for name, files := range all {
51 for _, file := range files {
52 err := testee.createOrUpdate(contextName, name, file, []byte("data"))
53 assert.NilError(t, err)
54 }
55 }
56
57 resAll, err := testee.listContextData(contextName)
58 assert.NilError(t, err)
59 assert.DeepEqual(t, resAll, all)
60
61 err = testee.removeEndpoint(contextName, "ep3")
62 assert.NilError(t, err)
63 resEp1ep2, err := testee.listContextData(contextName)
64 assert.NilError(t, err)
65 assert.DeepEqual(t, resEp1ep2, ep1ep2)
66
67 err = testee.remove(contextName)
68 assert.NilError(t, err)
69 resEmpty, err := testee.listContextData(contextName)
70 assert.NilError(t, err)
71 assert.DeepEqual(t, resEmpty, map[string]EndpointFiles{})
72}

Callers

nothing calls this directly

Calls 4

createOrUpdateMethod · 0.95
listContextDataMethod · 0.95
removeEndpointMethod · 0.95
removeMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…