MCPcopy
hub / github.com/weaviate/weaviate / Test_Add_Object_WithNoVectorizerModule

Function Test_Add_Object_WithNoVectorizerModule

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

Source from the content-addressed store, hash-verified

33)
34
35func Test_Add_Object_WithNoVectorizerModule(t *testing.T) {
36 var (
37 vectorRepo *fakeVectorRepo
38 modulesProvider *fakeModulesProvider
39 manager *Manager
40 schemaManager *fakeSchemaManager
41 authorizer *mocks.FakeAuthorizer
42 )
43
44 sch := schema.Schema{
45 Objects: &models.Schema{
46 Classes: []*models.Class{
47 {
48 Class: "Foo",
49 Vectorizer: config.VectorizerModuleNone,
50 VectorIndexConfig: hnsw.UserConfig{},
51 },
52 {
53 Class: "FooSkipped",
54 Vectorizer: config.VectorizerModuleNone,
55 VectorIndexConfig: hnsw.UserConfig{
56 Skip: true,
57 },
58 },
59 },
60 },
61 }
62
63 resetAutoSchema := func(autoSchemaEnabled bool) {
64 vectorRepo = &fakeVectorRepo{}
65 vectorRepo.On("PutObject", mock.Anything, mock.Anything).Return(nil).Once()
66 schemaManager = &fakeSchemaManager{
67 GetSchemaResponse: sch,
68 }
69 cfg := &config.WeaviateConfig{
70 Config: config.Config{
71 AutoSchema: config.AutoSchema{
72 Enabled: runtime.NewDynamicValue(autoSchemaEnabled),
73 DefaultString: schema.DataTypeText.String(),
74 },
75 },
76 }
77 authorizer = mocks.NewMockAuthorizer()
78 logger, _ := test.NewNullLogger()
79
80 modulesProvider = getFakeModulesProvider()
81 metrics := &fakeMetrics{}
82 manager = NewManager(schemaManager, cfg, logger, authorizer,
83 vectorRepo, modulesProvider, metrics, nil,
84 NewAutoSchemaManager(schemaManager, vectorRepo, cfg, logger, prometheus.NewPedanticRegistry()))
85 }
86
87 reset := func() {
88 resetAutoSchema(false)
89 }
90
91 t.Run("without an id set", func(t *testing.T) {
92 reset()

Callers

nothing calls this directly

Calls 15

NewDynamicValueFunction · 0.92
NewMockAuthorizerFunction · 0.92
NewAutoSchemaManagerFunction · 0.85
NewErrInvalidUserInputFunction · 0.85
EqualMethod · 0.80
UUIDMethod · 0.80
CallsMethod · 0.80
getFakeModulesProviderFunction · 0.70
NewManagerFunction · 0.70
StringMethod · 0.65
AddObjectMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…