33 lines
812 B
Go
33 lines
812 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
// The readings' layout is restic's own package, published by its series for the readers to take (ADR 0634 §4).
|
|
func TestTheReadingsLayoutIsAPublishedPackageOfThisModule(t *testing.T) {
|
|
raw, err := os.ReadFile("../../module.json")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var m struct {
|
|
Build struct {
|
|
Artifacts []struct {
|
|
Name, Kind, Series string
|
|
Paths []string
|
|
} `json:"artifacts"`
|
|
} `json:"build"`
|
|
}
|
|
if err := json.Unmarshal(raw, &m); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, a := range m.Build.Artifacts {
|
|
if a.Name == "backupgood" && a.Kind == "package" && a.Series == "0.1" && len(a.Paths) == 1 && a.Paths[0] == "backupgood" {
|
|
return
|
|
}
|
|
}
|
|
t.Errorf("no package artifact backupgood of series 0.1 in %s", raw)
|
|
}
|