MCPcopy
hub / github.com/weaviate/weaviate / Test_AddObjectWithUUIDProps

Function Test_AddObjectWithUUIDProps

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

Source from the content-addressed store, hash-verified

518}
519
520func Test_AddObjectWithUUIDProps(t *testing.T) {
521 var (
522 vectorRepo *fakeVectorRepo
523 modulesProvider *fakeModulesProvider
524 manager *Manager
525 )
526 schema := schema.Schema{
527 Objects: &models.Schema{
528 Classes: []*models.Class{
529 {
530 Class: "TestClass",
531 VectorIndexConfig: hnsw.UserConfig{},
532
533 Properties: []*models.Property{
534 {
535 Name: "my_id",
536 DataType: []string{"uuid"},
537 },
538 {
539 Name: "my_idz",
540 DataType: []string{"uuid[]"},
541 },
542 },
543 },
544 },
545 },
546 }
547 reset := func() {
548 vectorRepo = &fakeVectorRepo{}
549 vectorRepo.On("PutObject", mock.Anything, mock.Anything).Return(nil).Once()
550 schemaManager := &fakeSchemaManager{
551 GetSchemaResponse: schema,
552 }
553 cfg := &config.WeaviateConfig{}
554 authorizer := mocks.NewMockAuthorizer()
555 logger, _ := test.NewNullLogger()
556 modulesProvider = getFakeModulesProvider()
557 metrics := &fakeMetrics{}
558 manager = NewManager(schemaManager, cfg, logger,
559 authorizer, vectorRepo, modulesProvider, metrics, nil,
560 NewAutoSchemaManager(schemaManager, vectorRepo, cfg, logger, prometheus.NewPedanticRegistry()),
561 )
562 }
563 reset()
564 ctx := context.Background()
565 object := &models.Object{
566 Class: "TestClass",
567 Vector: []float32{9, 9, 9},
568 Properties: map[string]interface{}{
569 "my_id": "28bafa1e-7956-4c58-8a02-4499a9d15253",
570 "my_idz": []any{"28bafa1e-7956-4c58-8a02-4499a9d15253"},
571 },
572 }
573 modulesProvider.On("UpdateVector", mock.Anything, mock.AnythingOfType(FindObjectFn)).
574 Return(nil, nil)
575 addedObject, err := manager.AddObject(ctx, nil, object, nil)
576 require.Nil(t, err)
577 require.NotNil(t, addedObject.Properties)

Callers

nothing calls this directly

Calls 7

NewMockAuthorizerFunction · 0.92
NewAutoSchemaManagerFunction · 0.85
EqualMethod · 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…