feat: sync langpack and auth updates
Sync telesrv commits 49f9bab and 04d9563 into the public mirror. Exclude private docs and runtime key material per sync rules.
This commit is contained in:
parent
6af61f26ba
commit
1292540350
244 changed files with 1552172 additions and 27668 deletions
35
internal/app/langpack/cache_test.go
Normal file
35
internal/app/langpack/cache_test.go
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package langpack
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"telesrv/internal/domain"
|
||||
)
|
||||
|
||||
func TestLangPackCachesRejectLoadsAcrossFlush(t *testing.T) {
|
||||
packCache := newLangPackCache(1<<20, 8)
|
||||
key := langPackCacheKey{pack: "tdesktop", code: "en", kind: langPackCacheRaw}
|
||||
packEpoch := packCache.loadEpoch()
|
||||
packCache.flush()
|
||||
if packCache.putIfEpoch(key, domain.LangPack{
|
||||
LangPack: "tdesktop",
|
||||
LangCode: "en",
|
||||
Version: 1,
|
||||
Strings: []domain.LangPackString{{Key: "key", Value: "stale"}},
|
||||
}, packEpoch) {
|
||||
t.Fatal("pre-flush pack load was accepted")
|
||||
}
|
||||
if _, ok := packCache.get(key); ok {
|
||||
t.Fatal("pre-flush pack load became visible")
|
||||
}
|
||||
|
||||
languageCache := newLanguageListCache(8)
|
||||
languageEpoch := languageCache.loadEpoch()
|
||||
languageCache.flush()
|
||||
if languageCache.putIfEpoch("tdesktop", []domain.LangPackLanguage{{LangCode: "en"}}, languageEpoch) {
|
||||
t.Fatal("pre-flush language-list load was accepted")
|
||||
}
|
||||
if _, ok := languageCache.get("tdesktop"); ok {
|
||||
t.Fatal("pre-flush language-list load became visible")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue