Skip to content

Commit d341f7f

Browse files
committed
Revert SearchProcessTests to Ollama-gated behavior
Restore the original OLLAMA_AVAILABLE gating and remove the unrequested FTS-only config change.
1 parent 0525b91 commit d341f7f

1 file changed

Lines changed: 12 additions & 37 deletions

File tree

tests/Main.Tests/Integration/SearchProcessTests.cs

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,9 @@ private async Task<string> ExecuteKmAsync(string args)
8686
return output.Trim();
8787
}
8888

89-
[Fact]
89+
[OllamaFact]
9090
public async Task Process_PutThenSearch_FindsContent()
9191
{
92-
this.WriteFtsOnlyConfig();
93-
9492
// Act: Insert content
9593
var putOutput = await this.ExecuteKmAsync($"put \"ciao mondo\" --config {this._configPath}").ConfigureAwait(false);
9694
var putResult = JsonSerializer.Deserialize<JsonElement>(putOutput);
@@ -110,40 +108,6 @@ public async Task Process_PutThenSearch_FindsContent()
110108
Assert.Contains("ciao", results[0].GetProperty("content").GetString()!, StringComparison.OrdinalIgnoreCase);
111109
}
112110

113-
private void WriteFtsOnlyConfig()
114-
{
115-
var personalNodeDir = Path.Combine(this._tempDir, "nodes", "personal");
116-
Directory.CreateDirectory(personalNodeDir);
117-
118-
var contentDbPath = Path.Combine(personalNodeDir, "content.db");
119-
var ftsDbPath = Path.Combine(personalNodeDir, "fts.db");
120-
121-
var json = $$"""
122-
{
123-
"nodes": {
124-
"personal": {
125-
"id": "personal",
126-
"contentIndex": {
127-
"type": "sqlite",
128-
"path": {{JsonSerializer.Serialize(contentDbPath)}}
129-
},
130-
"searchIndexes": [
131-
{
132-
"type": "sqliteFTS",
133-
"id": "sqlite-fts",
134-
"path": {{JsonSerializer.Serialize(ftsDbPath)}},
135-
"enableStemming": true,
136-
"required": true
137-
}
138-
]
139-
}
140-
}
141-
}
142-
""";
143-
144-
File.WriteAllText(this._configPath, json);
145-
}
146-
147111
[Fact]
148112
public async Task Process_BooleanAnd_FindsOnlyMatchingBoth()
149113
{
@@ -245,4 +209,15 @@ await this.ExecuteKmAsync($"put \"docker helm charts\" --config {this._configPat
245209
Assert.Contains(id1, ids);
246210
Assert.Contains(id2, ids);
247211
}
212+
213+
private sealed class OllamaFactAttribute : FactAttribute
214+
{
215+
public OllamaFactAttribute()
216+
{
217+
if (string.Equals(Environment.GetEnvironmentVariable("OLLAMA_AVAILABLE"), "false", StringComparison.OrdinalIgnoreCase))
218+
{
219+
this.Skip = "Skipping because OLLAMA_AVAILABLE=false (vector embeddings unavailable).";
220+
}
221+
}
222+
}
248223
}

0 commit comments

Comments
 (0)