Release v1.4.6
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package remote
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestExtractBaseURLFromEndpointLog(t *testing.T) {
|
||||
got := extractBaseURLFromText(`2026-04-10 INFO Update endpoint success. endpoint config: https://ai-lingma-cmb01-cn-beijing.rdc.aliyuncs.com`)
|
||||
@@ -31,3 +35,35 @@ func TestExtractMachineIDFromTextJSON(t *testing.T) {
|
||||
t.Fatalf("machine id = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCandidateLingmaCacheDirsIncludesVSCodeSharedClientCache(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
t.Setenv("HOME", home)
|
||||
t.Setenv("USERPROFILE", home)
|
||||
t.Setenv("LINGMA_CACHE_DIR", "")
|
||||
dirs := candidateLingmaCacheDirs()
|
||||
want := filepath.Join(home, ".lingma", "vscode", "sharedClientCache")
|
||||
for _, dir := range dirs {
|
||||
if dir == want {
|
||||
return
|
||||
}
|
||||
}
|
||||
t.Fatalf("missing vscode shared client cache %q in %#v", want, dirs)
|
||||
}
|
||||
|
||||
func TestLoadMachineIDReadsVSCodeSharedClientCacheID(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
if err := os.MkdirAll(filepath.Join(dir, "cache"), 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(dir, "cache", "id"), []byte("abcdefghijklmnop1234"), 0644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got, err := loadMachineID(dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got != "abcdefghijklmnop1234" {
|
||||
t.Fatalf("machine id = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ func candidateLingmaCacheDirs() []string {
|
||||
if home, err := os.UserHomeDir(); err == nil && strings.TrimSpace(home) != "" {
|
||||
dirs = append(dirs,
|
||||
filepath.Join(home, ".lingma"),
|
||||
filepath.Join(home, ".lingma", "vscode", "sharedClientCache"),
|
||||
filepath.Join(home, ".config", "Lingma"),
|
||||
filepath.Join(home, ".local", "share", "Lingma"),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user