mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-15 19:24:23 +08:00
- 将驱动包元数据预热移至后台,避免状态首屏等待网络 - 复用状态快照并合并并发请求,防止重复刷新与过期响应覆盖 - 修正版本重复及历史版本选择,保证展示与安装目标一致 - 重排版本、进度和操作区域,并提升深色主操作对比度 - 补充首屏、并发、布局与性能边界回归测试
49 lines
1.9 KiB
Go
49 lines
1.9 KiB
Go
package app
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestGetDriverStatusListDefersReleaseMetadataWarmup(t *testing.T) {
|
|
source := methodsDriverSource(t)
|
|
statusStart := strings.Index(source, "func (a *App) GetDriverStatusList")
|
|
statusEnd := strings.Index(source, "func (a *App) CheckDriverNetworkStatus")
|
|
if statusStart < 0 || statusEnd <= statusStart {
|
|
t.Fatal("GetDriverStatusList function boundary not found")
|
|
}
|
|
statusBody := source[statusStart:statusEnd]
|
|
if !strings.Contains(statusBody, "packageSizeBytesMap := readCachedOptionalDriverPackageSizes(definitions)") {
|
|
t.Fatal("GetDriverStatusList must only read cached package sizes on the synchronous status path")
|
|
}
|
|
if strings.Contains(statusBody, "packageSizeBytesMap := preloadOptionalDriverPackageSizes(definitions)") {
|
|
t.Fatal("GetDriverStatusList must not synchronously preload release metadata")
|
|
}
|
|
|
|
cacheBody := methodsDriverFunctionSource(t, source, "func readCachedOptionalDriverPackageSizes")
|
|
for _, forbidden := range []string{
|
|
"loadReleaseAssetSizesCached(",
|
|
"fetchReleaseByTag(",
|
|
"fetchLatestReleaseForDriverAssets(",
|
|
} {
|
|
if strings.Contains(cacheBody, forbidden) {
|
|
t.Fatalf("cache-only package-size helper must not call %s", forbidden)
|
|
}
|
|
}
|
|
|
|
warmupStart := strings.Index(source, "func triggerDriverVersionMetadataWarmup")
|
|
warmupEnd := strings.Index(source, "func resolveDriverGoModulePaths")
|
|
if warmupStart < 0 || warmupEnd <= warmupStart {
|
|
t.Fatal("triggerDriverVersionMetadataWarmup function boundary not found")
|
|
}
|
|
warmupBody := source[warmupStart:warmupEnd]
|
|
preloadIndex := strings.Index(warmupBody, "_ = preloadOptionalDriverPackageSizes(warmupDefinitions)")
|
|
if preloadIndex < 0 {
|
|
t.Fatal("background warmup must continue populating package-size metadata")
|
|
}
|
|
goRoutineIndex := strings.Index(warmupBody, "go func(")
|
|
if goRoutineIndex < 0 || preloadIndex <= goRoutineIndex {
|
|
t.Fatal("package-size preload must remain inside the background warmup goroutine")
|
|
}
|
|
}
|