MCPcopy
hub / github.com/weaviate/weaviate / Test_AddObjectEmptyProperties

Function Test_AddObjectEmptyProperties

usecases/objects/add_test.go:467–518  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

465}
466
467func Test_AddObjectEmptyProperties(t *testing.T) {
468 var (
469 vectorRepo *fakeVectorRepo
470 modulesProvider *fakeModulesProvider
471 manager *Manager
472 )
473 schema := schema.Schema{
474 Objects: &models.Schema{
475 Classes: []*models.Class{
476 {
477 Class: "TestClass",
478 VectorIndexConfig: hnsw.UserConfig{},
479
480 Properties: []*models.Property{
481 {
482 Name: "strings",
483 DataType: schema.DataTypeTextArray.PropString(),
484 Tokenization: models.PropertyTokenizationWhitespace,
485 },
486 },
487 },
488 },
489 },
490 }
491 reset := func() {
492 vectorRepo = &fakeVectorRepo{}
493 vectorRepo.On("PutObject", mock.Anything, mock.Anything).Return(nil).Once()
494 schemaManager := &fakeSchemaManager{
495 GetSchemaResponse: schema,
496 }
497 cfg := &config.WeaviateConfig{}
498 authorizer := mocks.NewMockAuthorizer()
499 logger, _ := test.NewNullLogger()
500 modulesProvider = getFakeModulesProvider()
501 metrics := &fakeMetrics{}
502 manager = NewManager(schemaManager, cfg, logger,
503 authorizer, vectorRepo, modulesProvider, metrics, nil,
504 NewAutoSchemaManager(schemaManager, vectorRepo, cfg, logger, prometheus.NewPedanticRegistry()))
505 }
506 reset()
507 ctx := context.Background()
508 object := &models.Object{
509 Class: "TestClass",
510 Vector: []float32{9, 9, 9},
511 }
512 assert.Nil(t, object.Properties)
513 modulesProvider.On("UpdateVector", mock.Anything, mock.AnythingOfType(FindObjectFn)).
514 Return(nil, nil)
515 addedObject, err := manager.AddObject(ctx, nil, object, nil)
516 assert.Nil(t, err)
517 assert.NotNil(t, addedObject.Properties)
518}
519
520func Test_AddObjectWithUUIDProps(t *testing.T) {
521 var (

Callers

nothing calls this directly

Calls 7

NewMockAuthorizerFunction · 0.92
NewAutoSchemaManagerFunction · 0.85
PropStringMethod · 0.80
getFakeModulesProviderFunction · 0.70
NewManagerFunction · 0.70
AddObjectMethod · 0.65
ReturnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…