MCPcopy
hub / github.com/weaviate/weaviate / TestController_RemoveEntity

Function TestController_RemoveEntity

usecases/namespaces/controller_test.go:208–235  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

206}
207
208func TestController_RemoveEntity(t *testing.T) {
209 tests := []struct {
210 name string
211 seedState cmd.NamespaceState // empty = no namespace exists
212 wantErr error
213 }{
214 {name: "deleting namespace is removed", seedState: cmd.NamespaceStateDeleting},
215 {name: "active namespace returns ErrInvalidState", seedState: cmd.NamespaceStateActive, wantErr: ErrInvalidState},
216 {name: "missing namespace returns ErrNotFound", wantErr: ErrNotFound},
217 }
218
219 for _, tc := range tests {
220 t.Run(tc.name, func(t *testing.T) {
221 c := newTestController(t)
222 seedNamespace(t, c, "customer1", tc.seedState)
223
224 err := c.RemoveEntity("customer1")
225 if tc.wantErr != nil {
226 require.Error(t, err)
227 assert.ErrorIs(t, err, tc.wantErr)
228 assert.Equal(t, tc.seedState != "", c.Exists("customer1"))
229 return
230 }
231 require.NoError(t, err)
232 assert.False(t, c.Exists("customer1"))
233 })
234 }
235}
236
237func TestController_Update(t *testing.T) {
238 tests := []struct {

Callers

nothing calls this directly

Calls 7

newTestControllerFunction · 0.85
EqualMethod · 0.80
seedNamespaceFunction · 0.70
ExistsMethod · 0.65
RunMethod · 0.45
RemoveEntityMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…