github.com/weaviate/weaviate@v1.24.6/adapters/repos/db/vector/noop/index_test.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package noop 13 14 import ( 15 "testing" 16 17 "github.com/stretchr/testify/assert" 18 "github.com/stretchr/testify/require" 19 "github.com/weaviate/weaviate/entities/vectorindex/hnsw" 20 ) 21 22 func Test_UpdateConfig(t *testing.T) { 23 t.Run("hnsw: with skip==true", func(t *testing.T) { 24 // the param we care about was not changed, do not error 25 26 ind := NewIndex() 27 err := ind.UpdateUserConfig(hnsw.UserConfig{ 28 Skip: true, 29 }, func() {}) 30 31 assert.Nil(t, err) 32 }) 33 34 t.Run("hnsw: with skip==false", func(t *testing.T) { 35 ind := NewIndex() 36 err := ind.UpdateUserConfig(hnsw.UserConfig{ 37 Skip: false, 38 }, func() {}) 39 40 require.NotNil(t, err) 41 assert.Contains(t, err.Error(), "Delete and re-create") 42 }) 43 44 t.Run("with unrecognized vector index config", func(t *testing.T) { 45 ind := NewIndex() 46 err := ind.UpdateUserConfig(nil, func() {}) 47 48 require.NotNil(t, err) 49 assert.Contains(t, err.Error(), "unrecognized vector index config") 50 }) 51 }