From 65c792410849e891bb9b42872e335df6564e5b1c Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 31 Oct 2026 00:53:27 +0800 Subject: [PATCH] cli: TestProviderAddressMovesALocalServer adds LM Studio in a folder of its own The test added lmstudio in the package's shared config folder, so a second run (-count=2 and up) found it there, added "LM Studio 2" instead, and read the old provider back at localhost:1234: red on origin/main 380032cda at -count=3, runs 2 and 3. It now gets its own HOME, USERPROFILE, XDG_CONFIG_HOME and XDG_CACHE_HOME, as the other provider tests in the package do. HOME alone was tried first and stays red: the config folder comes from XDG_CONFIG_HOME, which testenv sets for the whole package. Run at this head, on mote: go test ./internal/cli -count=2 ok (53.8s); -run TestProviderAddressMovesALocalServer -count=5 ok; gofmt -l clean. --- internal/cli/provider_address_cli_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/cli/provider_address_cli_test.go b/internal/cli/provider_address_cli_test.go index 274641aa2..235a4e661 100644 --- a/internal/cli/provider_address_cli_test.go +++ b/internal/cli/provider_address_cli_test.go @@ -14,6 +14,11 @@ import ( // address= puts the preset's provider there, its models listed from that // server, and address= alone puts it back at the preset's port. func TestProviderAddressMovesALocalServer(t *testing.T) { + home := t.TempDir() + t.Setenv("HOME", home) + t.Setenv("USERPROFILE", home) + t.Setenv("XDG_CONFIG_HOME", t.TempDir()) + t.Setenv("XDG_CACHE_HOME", t.TempDir()) var mu sync.Mutex var asked []string srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {