mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-12 01:37:06 +02:00
- module github.com/R0m1k3/Loki, cmd/loki, internal/loki (package loki) - LOKI_HOME, LOKI_MODEL_DIRS, LOKI_SERVICE, LOKI_DL_CONNS ; /etc/loki ; units loki-engine / loki-ui ; binaire et aide CLI - updateRepo pointe sur R0m1k3/Loki (l'auto-update ne tirera plus les binaires AJEAN amont) Conservé à l'identique : le domaine ajean.link (service de tunnel amont), les littéraux de migration 0.7.x (migrate_07.go), RELEASE_NOTES.md et LICENSE (historique et licence de l'amont). go build/vet/test : verts.
42 lines
1.5 KiB
Go
42 lines
1.5 KiB
Go
package loki
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
// La ressource de version Windows (cmd/loki/versioninfo.json) doit suivre la
|
|
// constante Version. Elles ont divergé en 0.8.0 : la constante était à jour, la
|
|
// ressource restait à 0.7.13. Conséquence peu lisible — le binaire installé se
|
|
// DÉCLARAIT 0.7.13 auprès de Windows, si bien que relancer le fichier téléchargé
|
|
// proposait indéfiniment « appliquer la mise à jour ? » sur une version déjà
|
|
// installée. Ce test rend l'oubli impossible.
|
|
func TestVersionInfoWindowsSuitLaVersion(t *testing.T) {
|
|
b, err := os.ReadFile("../../cmd/loki/versioninfo.json")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var vi struct {
|
|
FixedFileInfo struct {
|
|
FileVersion struct{ Major, Minor, Patch int }
|
|
ProductVersion struct{ Major, Minor, Patch int }
|
|
}
|
|
StringFileInfo struct{ ProductVersion string }
|
|
}
|
|
if err := json.Unmarshal(b, &vi); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
f := vi.FixedFileInfo.FileVersion
|
|
for name, got := range map[string]string{
|
|
"FixedFileInfo.FileVersion": fmt.Sprintf("%d.%d.%d", f.Major, f.Minor, f.Patch),
|
|
"FixedFileInfo.ProductVersion": fmt.Sprintf("%d.%d.%d", vi.FixedFileInfo.ProductVersion.Major, vi.FixedFileInfo.ProductVersion.Minor, vi.FixedFileInfo.ProductVersion.Patch),
|
|
"StringFileInfo.ProductVersion": vi.StringFileInfo.ProductVersion,
|
|
} {
|
|
if got != Version {
|
|
t.Errorf("%s = %s, attendu %s — pense à `go generate ./cmd/loki` après un bump", name, got, Version)
|
|
}
|
|
}
|
|
}
|