feat(retriever): activate OpenSearch k-NN driver (PR 3 of 3)
Phase 3 (#1440) gate flip. PR 1 (#1445) + PR 2a (#1481) + PR 2b (#1482) laid the type prep + driver skeleton + read/write paths as gated dead code; this PR wires every activation surface so opensearch becomes a registerable VectorStore engine. Activation wiring - internal/types: validEngineTypes / GetVectorStoreTypes (with HNSW bounds + knn_engine enum + Immutable hints) / retrieverEngineMapping / buildEnvStoreForDriver — every gated surface now recognises "opensearch". IndexConfig grows four omitempty HNSW fields (HNSWM / HNSWEFConstruction / HNSWEFSearch / KNNEngine), keeping other engines' serialised config byte-identical. - internal/container: createOpenSearchEngine + the switch case in createEngineServiceFromStore; the RETRIEVE_DRIVER=opensearch env path in initRetrieveEngineRegistry; NewEngineFactory now closes over the AuditLogService (the EngineFactory type itself is unchanged). - internal/application/service/vectorstore_healthcheck.go: a testOpenSearchConnection case so CreateStore's connectivity probe accepts opensearch instead of returning 400. - internal/application/repository/retriever/opensearch/transport.go: NewOpenSearchClient is exported so the factory and env path can build the TLS-hardened client; healthcheck.go reuses the unexported probeVersion / probeKNNPlugin for the service-layer probe. Service-layer validation - validateOpenSearchIndexConfig validates the HNSW caps (m 2-100, ef_construction 2-4096, ef_search 1-10000, knn_engine ∈ lucene|faiss). Shards/replicas continue to be enforced by the flat ValidateIndexConfig. Create-only: UpdateStore mutates the name only. - validateConnectionConfig requires addr for opensearch. Sync implementations (stubs.go shrinks) - CopyIndices (copy.go) mirrors the Elasticsearch / Qdrant pattern — search → BatchSave with the source_id remap for generated questions — so dim/keyword routing and the source_id contract come from BatchSave for free. embeddingMap is keyed by the *target* SourceID because OpenSearch's BatchSave looks up embeddings by SourceID (lookupEmbedding), not by chunk_id (the ES driver's convention). Pagination is from/size; copies larger than max_result_window (default 10000) need the scroll-based async path that lands later. - BatchUpdateChunkEnabledStatus / BatchUpdateChunkTagID (bulk_update.go) group the input by target value and issue one _update_by_query per group over the cross-dim <base>_* pattern. Caller values flow through bound script params only — never string-interpolated into the Painless source — closing the script-injection surface. - inspectByQueryResponse (byquery.go) mirrors inspectBulkResponse: the full failure reason goes to the debug log only; the returned error carries the bounded id + type. - UpdateByQueryParams.Refresh is *bool in opensearch-go v4.6.0 (the same shape as DeleteByQuery's quirk), so refresh=wait_for is not expressible; we use refresh=true. Driver-owned audit (DIP) - A new opensearch.AuditSink interface (with nopSink + WithAuditSink functional option) lets the driver emit opensearch.index_created and opensearch.reindex_executed events without importing any service package — the service layer implements the interface. NewRepository takes opts, so existing 4-arg test call sites keep compiling unchanged. - internal/container/audit_sink.go bridges AuditSink to AuditLogService. When the context carries no tenant (the env-path registration ctx during boot, for example) the adapter skips the emit with a warning rather than silently writing tenant_id=0, which would collide with the system-scope sentinel. Frontend + polish - FieldSchema (frontend/src/api/vector-store.ts) gains min/max/enum/ immutable. VectorStoreSettings.vue is now schema-driven: a closed `enum` renders a t-select; number inputs use the schema's `:min`/`:max` and fall back to the legacy replica-vs-shard heuristic only when the schema does not pin them; a danger-coloured warning fires when insecure_skip_verify is toggled on (the switch and warning are wrapped in a vertical stack so the warning sits on its own row below the switch). - i18n: labels for hnsw_m / hnsw_ef_construction / hnsw_ef_search / knn_engine / insecure_skip_verify plus the warning copy in en-US, ko-KR, zh-CN, ru-RU. - docker-compose.dev.yml: an opensearch profile (single-node 3.3.2 with security plugin disabled for dev only). OpenSearch Dashboards lives in a separate, opt-in opensearch-ui profile so the heavy UI container is not forced up alongside the cluster (the driver e2e is fully curl-verifiable against :9200). The new docs/dev/opensearch-integration-test.md covers the end-to-end exercise and the single-node guidance (set replicas=0 to keep the cluster Green). Gating-guard tests flipped - The "OpenSearch is NOT in validEngineTypes / mapping / types list / env builder / stubs" guard tests from PR 1 / PR 2 are replaced by their positive counterparts in this PR. The test suite was the activation checklist; the activation flip is its diff. Backward compatibility - Additive everywhere. IndexConfig's new HNSW fields are omitempty so other engines' serialised config is byte-identical. Existing Elasticsearch / Qdrant / Milvus / Weaviate / Doris / TencentVectorDB stores are untouched. No migrations. Test plan - go build ./... clean - go vet ./... clean - gofmt -l clean on touched files - go test ./... — only TestOssEnsureBucket_CreateFails (Aliyun OSS endpoint), the docreader gRPC tests, and the doris SQL-shape tests fail; all three are pre-existing on upstream/main and untouched by this PR. - New tests across internal/types, opensearch, service and container — including a full end-to-end env-path test that exercises initRetrieveEngineRegistry with RETRIEVE_DRIVER=opensearch against an httptest cluster.
This commit is contained in:
@@ -50,6 +50,10 @@ var retrieverEngineMapping = map[string][]RetrieverEngineParams{
|
||||
{RetrieverType: KeywordsRetrieverType, RetrieverEngineType: TencentVectorDBRetrieverEngineType},
|
||||
{RetrieverType: VectorRetrieverType, RetrieverEngineType: TencentVectorDBRetrieverEngineType},
|
||||
},
|
||||
"opensearch": {
|
||||
{RetrieverType: KeywordsRetrieverType, RetrieverEngineType: OpenSearchRetrieverEngineType},
|
||||
{RetrieverType: VectorRetrieverType, RetrieverEngineType: OpenSearchRetrieverEngineType},
|
||||
},
|
||||
}
|
||||
|
||||
// GetRetrieverEngineMapping returns the retriever engine mapping
|
||||
|
||||
@@ -86,6 +86,7 @@ var validEngineTypes = map[RetrieverEngineType]bool{
|
||||
WeaviateRetrieverEngineType: true,
|
||||
DorisRetrieverEngineType: true,
|
||||
TencentVectorDBRetrieverEngineType: true,
|
||||
OpenSearchRetrieverEngineType: true,
|
||||
}
|
||||
|
||||
// IsValidEngineType checks whether the given engine type is valid for VectorStore.
|
||||
@@ -250,6 +251,14 @@ type IndexConfig struct {
|
||||
DesiredShardCount int `yaml:"desired_shard_count" json:"desired_shard_count,omitempty"` // Weaviate: number of shards per collection
|
||||
BucketsNum int `yaml:"buckets_num" json:"buckets_num,omitempty"` // Doris: number of buckets per table (DISTRIBUTED BY HASH ... BUCKETS N)
|
||||
ReplicationNum int `yaml:"replication_num" json:"replication_num,omitempty"` // Doris: replication_num PROPERTIES
|
||||
|
||||
// --- OpenSearch k-NN HNSW fields ---
|
||||
// All omitempty so other engines' serialized IndexConfig is unchanged.
|
||||
// Zero / empty values fall back to the driver defaults in buildInternalCfg.
|
||||
HNSWM int `yaml:"hnsw_m" json:"hnsw_m,omitempty"` // OpenSearch: HNSW graph degree (M)
|
||||
HNSWEFConstruction int `yaml:"hnsw_ef_construction" json:"hnsw_ef_construction,omitempty"` // OpenSearch: HNSW index-build candidate list size
|
||||
HNSWEFSearch int `yaml:"hnsw_ef_search" json:"hnsw_ef_search,omitempty"` // OpenSearch: HNSW search candidate list size (faiss; lucene reads at query time)
|
||||
KNNEngine string `yaml:"knn_engine" json:"knn_engine,omitempty"` // OpenSearch: k-NN backend ("lucene" | "faiss")
|
||||
}
|
||||
|
||||
// Value implements the driver.Valuer interface.
|
||||
@@ -727,9 +736,32 @@ func GetVectorStoreTypes() []VectorStoreTypeInfo {
|
||||
{Name: "replication_num", Type: "number", Required: false, Description: "Replication Num", Default: 1},
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: "opensearch",
|
||||
DisplayName: "OpenSearch",
|
||||
ConnectionFields: []VectorStoreFieldInfo{
|
||||
{Name: "addr", Type: "string", Required: true, Description: "URL", Default: "https://localhost:9200"},
|
||||
{Name: "username", Type: "string", Required: false, Description: "Username", Default: "admin"},
|
||||
{Name: "password", Type: "string", Required: false, Sensitive: true, Description: "Password"},
|
||||
{Name: "insecure_skip_verify", Type: "boolean", Required: false, Default: false,
|
||||
Description: "Skip TLS certificate verification. For self-signed dev clusters only — never enable in production."},
|
||||
},
|
||||
IndexFields: []VectorStoreFieldInfo{
|
||||
{Name: "index_name", Type: "string", Required: false, Description: "Index Name", Default: "weknora"},
|
||||
{Name: "number_of_shards", Type: "number", Required: false, Description: "Shards", Default: 4, Min: floatPtr(1), Max: floatPtr(64)},
|
||||
{Name: "number_of_replicas", Type: "number", Required: false, Description: "Replicas", Default: 1, Min: floatPtr(0), Max: floatPtr(10)},
|
||||
{Name: "hnsw_m", Type: "number", Required: false, Description: "HNSW graph degree (M). Immutable after index creation.", Default: 16, Min: floatPtr(2), Max: floatPtr(100), Immutable: true},
|
||||
{Name: "hnsw_ef_construction", Type: "number", Required: false, Description: "HNSW build candidate list. Higher (e.g. 200-512) improves recall at the cost of build time. Immutable after creation.", Default: 100, Min: floatPtr(2), Max: floatPtr(4096), Immutable: true},
|
||||
{Name: "hnsw_ef_search", Type: "number", Required: false, Description: "HNSW search candidate list. Effective on the faiss engine; the lucene engine reads it at query time. Immutable (no settings-update path).", Default: 100, Min: floatPtr(1), Max: floatPtr(10000), Immutable: true},
|
||||
{Name: "knn_engine", Type: "string", Required: false, Description: "k-NN backend.", Default: "lucene", Enum: []string{"lucene", "faiss"}, Immutable: true},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// floatPtr returns a pointer to v, for setting VectorStoreFieldInfo Min/Max.
|
||||
func floatPtr(v float64) *float64 { return &v }
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// BuildEnvVectorStores — virtual stores from RETRIEVE_DRIVER env var
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -821,6 +853,21 @@ func buildEnvStoreForDriver(driver string, envLookup EnvLookupFunc) *VectorStore
|
||||
IndexName: envLookup("ELASTICSEARCH_INDEX"),
|
||||
},
|
||||
}
|
||||
case "opensearch":
|
||||
return &VectorStore{
|
||||
ID: "__env_opensearch__",
|
||||
Name: "OpenSearch",
|
||||
EngineType: OpenSearchRetrieverEngineType,
|
||||
ConnectionConfig: ConnectionConfig{
|
||||
Addr: envLookup("OPENSEARCH_ADDR"),
|
||||
Username: envLookup("OPENSEARCH_USERNAME"),
|
||||
Password: envLookup("OPENSEARCH_PASSWORD"),
|
||||
InsecureSkipVerify: strings.EqualFold(envLookup("OPENSEARCH_INSECURE_SKIP_VERIFY"), "true"),
|
||||
},
|
||||
IndexConfig: IndexConfig{
|
||||
IndexName: envLookup("OPENSEARCH_INDEX"),
|
||||
},
|
||||
}
|
||||
case "qdrant":
|
||||
return &VectorStore{
|
||||
ID: "__env_qdrant__",
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// findVSType returns the VectorStoreTypeInfo with the given Type, or fails.
|
||||
func findVSType(t *testing.T, typeName string) VectorStoreTypeInfo {
|
||||
t.Helper()
|
||||
for _, vt := range GetVectorStoreTypes() {
|
||||
if vt.Type == typeName {
|
||||
return vt
|
||||
}
|
||||
}
|
||||
t.Fatalf("GetVectorStoreTypes() has no entry for %q", typeName)
|
||||
return VectorStoreTypeInfo{}
|
||||
}
|
||||
|
||||
// findField returns the field with the given Name from a slice, or fails.
|
||||
func findField(t *testing.T, fields []VectorStoreFieldInfo, name string) VectorStoreFieldInfo {
|
||||
t.Helper()
|
||||
for _, f := range fields {
|
||||
if f.Name == name {
|
||||
return f
|
||||
}
|
||||
}
|
||||
t.Fatalf("no field named %q", name)
|
||||
return VectorStoreFieldInfo{}
|
||||
}
|
||||
|
||||
// TestIndexConfig_OpenSearchFieldsOmittedForOtherEngines verifies the new HNSW
|
||||
// fields are omitempty so other engines' serialized IndexConfig is unchanged.
|
||||
func TestIndexConfig_OpenSearchFieldsOmittedForOtherEngines(t *testing.T) {
|
||||
t.Run("omitted when unset", func(t *testing.T) {
|
||||
b, err := json.Marshal(IndexConfig{IndexName: "weknora", NumberOfShards: 4})
|
||||
require.NoError(t, err)
|
||||
s := string(b)
|
||||
assert.NotContains(t, s, "hnsw_m")
|
||||
assert.NotContains(t, s, "hnsw_ef_construction")
|
||||
assert.NotContains(t, s, "hnsw_ef_search")
|
||||
assert.NotContains(t, s, "knn_engine")
|
||||
})
|
||||
|
||||
t.Run("present when set", func(t *testing.T) {
|
||||
b, err := json.Marshal(IndexConfig{
|
||||
HNSWM: 24,
|
||||
HNSWEFConstruction: 200,
|
||||
HNSWEFSearch: 128,
|
||||
KNNEngine: "faiss",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
s := string(b)
|
||||
assert.Contains(t, s, `"hnsw_m":24`)
|
||||
assert.Contains(t, s, `"hnsw_ef_construction":200`)
|
||||
assert.Contains(t, s, `"hnsw_ef_search":128`)
|
||||
assert.Contains(t, s, `"knn_engine":"faiss"`)
|
||||
})
|
||||
}
|
||||
|
||||
// TestIsValidEngineType_OpenSearch verifies OpenSearch is now a valid DB-store engine.
|
||||
func TestIsValidEngineType_OpenSearch(t *testing.T) {
|
||||
assert.True(t, IsValidEngineType(OpenSearchRetrieverEngineType))
|
||||
}
|
||||
|
||||
// TestGetVectorStoreTypes_OpenSearchEntry verifies the OpenSearch metadata entry
|
||||
// exposes the connection + HNSW index fields with the right bounds/enum/immutable.
|
||||
func TestGetVectorStoreTypes_OpenSearchEntry(t *testing.T) {
|
||||
vt := findVSType(t, "opensearch")
|
||||
assert.Equal(t, "OpenSearch", vt.DisplayName)
|
||||
|
||||
// Connection fields
|
||||
insecure := findField(t, vt.ConnectionFields, "insecure_skip_verify")
|
||||
assert.Equal(t, "boolean", insecure.Type)
|
||||
assert.Equal(t, false, insecure.Default) // never default-true
|
||||
pw := findField(t, vt.ConnectionFields, "password")
|
||||
assert.True(t, pw.Sensitive)
|
||||
|
||||
// HNSW index fields: bounds match the flat-validator-aligned caps (14-D)
|
||||
m := findField(t, vt.IndexFields, "hnsw_m")
|
||||
require.NotNil(t, m.Min)
|
||||
require.NotNil(t, m.Max)
|
||||
assert.Equal(t, 2.0, *m.Min)
|
||||
assert.Equal(t, 100.0, *m.Max)
|
||||
assert.True(t, m.Immutable)
|
||||
|
||||
shards := findField(t, vt.IndexFields, "number_of_shards")
|
||||
require.NotNil(t, shards.Max)
|
||||
assert.Equal(t, 64.0, *shards.Max) // flat ValidateIndexConfig maxShards
|
||||
|
||||
replicas := findField(t, vt.IndexFields, "number_of_replicas")
|
||||
require.NotNil(t, replicas.Max)
|
||||
assert.Equal(t, 10.0, *replicas.Max) // flat maxReplicas
|
||||
|
||||
eng := findField(t, vt.IndexFields, "knn_engine")
|
||||
assert.ElementsMatch(t, []string{"lucene", "faiss"}, eng.Enum)
|
||||
assert.True(t, eng.Immutable)
|
||||
|
||||
efs := findField(t, vt.IndexFields, "hnsw_ef_search")
|
||||
assert.True(t, efs.Immutable) // no PutSettings path → immutable
|
||||
}
|
||||
|
||||
// TestBuildEnvVectorStores_OpenSearch verifies the env-store builder case.
|
||||
func TestBuildEnvVectorStores_OpenSearch(t *testing.T) {
|
||||
lookup := mockEnvLookup(map[string]string{
|
||||
"OPENSEARCH_ADDR": "https://os:9200",
|
||||
"OPENSEARCH_USERNAME": "admin",
|
||||
"OPENSEARCH_PASSWORD": "secret",
|
||||
"OPENSEARCH_INDEX": "weknora",
|
||||
"OPENSEARCH_INSECURE_SKIP_VERIFY": "true",
|
||||
})
|
||||
stores := BuildEnvVectorStores("opensearch", lookup)
|
||||
require.Len(t, stores, 1)
|
||||
s := stores[0]
|
||||
assert.Equal(t, "__env_opensearch__", s.ID)
|
||||
assert.Equal(t, OpenSearchRetrieverEngineType, s.EngineType)
|
||||
assert.Equal(t, "https://os:9200", s.ConnectionConfig.Addr)
|
||||
assert.Equal(t, "admin", s.ConnectionConfig.Username)
|
||||
assert.Equal(t, "secret", s.ConnectionConfig.Password)
|
||||
assert.True(t, s.ConnectionConfig.InsecureSkipVerify)
|
||||
assert.Equal(t, "weknora", s.IndexConfig.IndexName)
|
||||
}
|
||||
|
||||
// TestBuildEnvVectorStores_OpenSearch_InsecureDefaultsFalse verifies the TLS
|
||||
// skip flag is false unless the env var is explicitly "true".
|
||||
func TestBuildEnvVectorStores_OpenSearch_InsecureDefaultsFalse(t *testing.T) {
|
||||
lookup := mockEnvLookup(map[string]string{"OPENSEARCH_ADDR": "https://os:9200"})
|
||||
stores := BuildEnvVectorStores("opensearch", lookup)
|
||||
require.Len(t, stores, 1)
|
||||
assert.False(t, stores[0].ConnectionConfig.InsecureSkipVerify)
|
||||
}
|
||||
|
||||
// TestRetrieverEngineMapping_OpenSearch verifies the RETRIEVE_DRIVER mapping.
|
||||
func TestRetrieverEngineMapping_OpenSearch(t *testing.T) {
|
||||
m := GetRetrieverEngineMapping()
|
||||
params, ok := m["opensearch"]
|
||||
require.True(t, ok, `retrieverEngineMapping missing "opensearch"`)
|
||||
require.Len(t, params, 2)
|
||||
|
||||
var hasKeywords, hasVector bool
|
||||
for _, p := range params {
|
||||
assert.Equal(t, OpenSearchRetrieverEngineType, p.RetrieverEngineType)
|
||||
switch p.RetrieverType {
|
||||
case KeywordsRetrieverType:
|
||||
hasKeywords = true
|
||||
case VectorRetrieverType:
|
||||
hasVector = true
|
||||
}
|
||||
}
|
||||
assert.True(t, hasKeywords && hasVector, "expected both Keywords and Vector retriever types")
|
||||
}
|
||||
@@ -246,7 +246,7 @@ func TestGetVectorStoreTypes(t *testing.T) {
|
||||
types := GetVectorStoreTypes()
|
||||
|
||||
t.Run("returns supported external engine types (excludes postgres and sqlite)", func(t *testing.T) {
|
||||
assert.Len(t, types, 6)
|
||||
assert.Len(t, types, 7)
|
||||
})
|
||||
|
||||
t.Run("type names match engine constants", func(t *testing.T) {
|
||||
@@ -260,6 +260,7 @@ func TestGetVectorStoreTypes(t *testing.T) {
|
||||
assert.Contains(t, typeNames, "tencent_vectordb")
|
||||
assert.Contains(t, typeNames, "weaviate")
|
||||
assert.Contains(t, typeNames, "doris")
|
||||
assert.Contains(t, typeNames, "opensearch")
|
||||
assert.NotContains(t, typeNames, "postgres")
|
||||
assert.NotContains(t, typeNames, "sqlite")
|
||||
})
|
||||
@@ -399,9 +400,10 @@ func TestIsValidEngineType(t *testing.T) {
|
||||
// GetVectorStoreTypes does not list them, Validate rejects them, and
|
||||
// env stores reach the engine registry through BuildEnvVectorStores
|
||||
// instead of through CreateStore.
|
||||
// Note: opensearch is now a VALID DB-store engine (activated in this PR);
|
||||
// see TestIsValidEngineType_OpenSearch in vectorstore_opensearch_test.go.
|
||||
invalidTypes := []RetrieverEngineType{
|
||||
"unknown",
|
||||
"opensearch",
|
||||
"",
|
||||
PostgresRetrieverEngineType,
|
||||
SQLiteRetrieverEngineType,
|
||||
@@ -1350,64 +1352,3 @@ func TestOpenSearchRetrieverEngineType_DistinctFromExisting(t *testing.T) {
|
||||
"OpenSearch wire value must not collide with %s", e)
|
||||
}
|
||||
}
|
||||
|
||||
// TestOpenSearchRetrieverEngineType_NotInValidEngineTypes verifies
|
||||
// that PR 1 does NOT add the new engine type to validEngineTypes —
|
||||
// this is the gate that keeps OpenSearch VectorStore registration
|
||||
// rejected until activation lands in a later PR.
|
||||
func TestOpenSearchRetrieverEngineType_NotInValidEngineTypes(t *testing.T) {
|
||||
assert.False(t, IsValidEngineType(OpenSearchRetrieverEngineType),
|
||||
"OpenSearch must remain invalid for VectorStore registration "+
|
||||
"until activation lands in a later PR (gated activation)")
|
||||
}
|
||||
|
||||
// The next three tests are defense-in-depth companions to
|
||||
// TestOpenSearchRetrieverEngineType_NotInValidEngineTypes. Each pins
|
||||
// a separate activation surface that must remain closed in PR 1 (and
|
||||
// in PR 2). Activation lands together with a coordinated flip in
|
||||
// PR 3, at which point each of these `assert.False` / `assert.NotContains`
|
||||
// / `assert.Nil` lines flips to its positive counterpart in the same
|
||||
// diff — the test suite becomes the activation checklist.
|
||||
|
||||
// TestRetrieverEngineMapping_OpenSearchNotRegistered pins that
|
||||
// `retrieverEngineMapping` does not have an `"opensearch"` key. Without
|
||||
// this entry, setting `RETRIEVE_DRIVER=opensearch` is a silent no-op
|
||||
// (GetDefaultRetrieverEngines drops the unknown driver from its loop
|
||||
// at tenant.go).
|
||||
func TestRetrieverEngineMapping_OpenSearchNotRegistered(t *testing.T) {
|
||||
mapping := GetRetrieverEngineMapping()
|
||||
_, ok := mapping["opensearch"]
|
||||
assert.False(t, ok,
|
||||
"retrieverEngineMapping must not register opensearch until "+
|
||||
"activation lands in a later PR (gated activation)")
|
||||
}
|
||||
|
||||
// TestGetVectorStoreTypes_OmitsOpenSearch pins that the
|
||||
// /api/v1/vector-stores/types response does NOT list opensearch.
|
||||
// Without this entry, the UI dropdown cannot offer OpenSearch as a
|
||||
// store type even if a frontend renderer accidentally tries.
|
||||
func TestGetVectorStoreTypes_OmitsOpenSearch(t *testing.T) {
|
||||
listed := GetVectorStoreTypes()
|
||||
for _, info := range listed {
|
||||
assert.NotEqual(t, "opensearch", info.Type,
|
||||
"GetVectorStoreTypes must not surface opensearch until "+
|
||||
"activation lands in a later PR (gated activation)")
|
||||
}
|
||||
}
|
||||
|
||||
// TestBuildEnvVectorStores_OpenSearchSkipped pins that
|
||||
// `BuildEnvVectorStores("opensearch", lookup)` returns nil — the
|
||||
// `default:` arm of `buildEnvStoreForDriver`. Without an explicit
|
||||
// `case "opensearch":` arm, container.go cannot synthesize an env
|
||||
// store for the driver, completing the third lock on the activation
|
||||
// chain.
|
||||
func TestBuildEnvVectorStores_OpenSearchSkipped(t *testing.T) {
|
||||
stores := BuildEnvVectorStores("opensearch", mockEnvLookup(map[string]string{
|
||||
"OPENSEARCH_ADDR": "https://os:9200",
|
||||
"OPENSEARCH_USERNAME": "admin",
|
||||
}))
|
||||
assert.Empty(t, stores,
|
||||
"BuildEnvVectorStores must not synthesize an env store for "+
|
||||
"opensearch until activation lands in a later PR (gated "+
|
||||
"activation)")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user