OllamaLiveTests.cscsharp

Documentation

Version 2 design tests

Automated checks for chat, history, and Kokoro TTS (sanitizer + optional live speech).

Quick run

python src/Version2/DesignTests/run-design-tests.py
python src/Version2/DesignTests/run-design-tests.py --live
.\src\Version2\DesignTests\run-design-tests.ps1 -Live

What runs

| Suite | Needs network | Covers | |-------|----------------|--------| | ChatHistoryStoreTests | No | Same as V1 history XML | | OllamaClientHistoryTests | No | Client save/load | | KokoroTtsSanitizerTests | No | Markdown/emoji/URL stripping for speech | | OllamaLiveTests | Yes (--live) | Ollama chat | | KokoroTtsLiveTests | Yes (--live) | Kokoro model load + SpeakAsync |

First Kokoro live run may download ~320MB of model weights.

Console video (testers)

Record Version 2 console sessions (chat + TTS + history):

python src/TestManager/test_manager.py record v2 chat-tts --build

See src/TestManager/README.md.

All versions

python src/run-all-design-tests.py
python src/run-all-design-tests.py --live
using System.Net.Http;using Agent.Core.Logging;using Agent.Core.Ollama;using Xunit;namespace Agent.Core.DesignTests;[Trait("Category", "Integration")]public class OllamaLiveTests{    [Fact]    public async Task Ollama_chat_returns_non_empty_reply()    {        Assert.True(LiveTestsEnabled(), "Set RUN_LIVE_TESTS=1 or pass --live to run-design-tests.py");        Assert.True(await OllamaReachableAsync(), "Ollama must be running at http://localhost:11434");        var logger = new Logger();        var client = new OllamaClient(logger) { Model = "gemma4" };        client.ClearHistory();        client.History.Add("system", "Reply with exactly: design-ok");        string reply = await client.StreamReply("Say the codeword.");        Assert.False(string.IsNullOrWhiteSpace(reply));    }    private static bool LiveTestsEnabled() =>        string.Equals(Environment.GetEnvironmentVariable("RUN_LIVE_TESTS"), "1", StringComparison.Ordinal);    private static async Task<bool> OllamaReachableAsync()    {        try        {            using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(3) };            using var response = await http.GetAsync("http://localhost:11434/api/tags");            return response.IsSuccessStatusCode;        }        catch        {            return false;        }    }}