fix: all tests now in sync

This commit is contained in:
Per Stark
2025-11-29 18:59:08 +01:00
parent cb906c5b53
commit 1039ec32a4
19 changed files with 439 additions and 50 deletions

View File

@@ -1,7 +1,6 @@
use super::types::StoredObject;
use crate::{
error::AppError,
storage::{indexes::ensure_runtime_indexes, types::system_settings::SystemSettings},
};
use axum_session::{SessionConfig, SessionError, SessionStore};
use axum_session_surreal::SessionSurrealPool;

View File

@@ -120,7 +120,7 @@ async fn ensure_hnsw_index(
)
.await
}
HnswIndexState::Matches(_) => Ok(()),
HnswIndexState::Matches => Ok(()),
HnswIndexState::Different(existing) => {
info!(
index = spec.index_name,
@@ -182,7 +182,7 @@ async fn hnsw_index_state(
};
if current_dimension == expected_dimension as u64 {
Ok(HnswIndexState::Matches(current_dimension))
Ok(HnswIndexState::Matches)
} else {
Ok(HnswIndexState::Different(current_dimension))
}
@@ -190,7 +190,7 @@ async fn hnsw_index_state(
enum HnswIndexState {
Missing,
Matches(u64),
Matches,
Different(u64),
}

View File

@@ -55,6 +55,7 @@ impl SystemSettings {
mod tests {
use crate::storage::types::{knowledge_entity::KnowledgeEntity, text_chunk::TextChunk};
use async_openai::Client;
use crate::storage::indexes::ensure_runtime_indexes;
use super::*;
use uuid::Uuid;
@@ -325,6 +326,11 @@ mod tests {
.await
.expect("Failed to load current settings");
// Ensure runtime indexes exist with the current embedding dimension so INFO queries succeed.
ensure_runtime_indexes(&db, current_settings.embedding_dimensions as usize)
.await
.expect("failed to build runtime indexes");
let initial_chunk_dimension = get_hnsw_index_dimension(
&db,
"text_chunk_embedding",