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

Function TestRemove

cli/context/store/store_test.go:92–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestRemove(t *testing.T) {
93 s := New(t.TempDir(), testCfg)
94 err := s.CreateOrUpdate(
95 Metadata{
96 Endpoints: map[string]any{
97 "ep1": endpoint{Foo: "bar"},
98 },
99 Metadata: context{Bar: "baz"},
100 Name: "source",
101 })
102 assert.NilError(t, err)
103 assert.NilError(t, s.ResetEndpointTLSMaterial("source", "ep1", &EndpointTLSData{
104 Files: map[string][]byte{
105 "file1": []byte("test-data"),
106 },
107 }))
108 assert.NilError(t, s.Remove("source"))
109 _, err = s.GetMetadata("source")
110 assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
111 f, err := s.ListTLSFiles("source")
112 assert.NilError(t, err)
113 assert.Equal(t, 0, len(f))
114}
115
116func TestListEmptyStore(t *testing.T) {
117 result, err := New(t.TempDir(), testCfg).List()

Callers

nothing calls this directly

Calls 6

NewFunction · 0.70
CreateOrUpdateMethod · 0.65
RemoveMethod · 0.65
GetMetadataMethod · 0.65
ListTLSFilesMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…