Files
mesh-catalog/modules/disk-load/cmd/disk-load/packages_test.go
T

39 lines
1.0 KiB
Go

package main
import (
"encoding/json"
"os"
"slices"
"testing"
)
// The readings' layout is disk-load'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 {
Reads []string `json:"reads"`
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)
}
// The node-engine's data state is read under the one name of its holder this module keeps.
if !slices.Contains(m.Reads, engineDataRead) {
t.Errorf("reads %v do not name %s", m.Reads, engineDataRead)
}
for _, a := range m.Build.Artifacts {
if a.Name == "diskreadings" && a.Kind == "package" && a.Series == "0.1" && len(a.Paths) == 1 && a.Paths[0] == "diskreadings" {
return
}
}
t.Errorf("no package artifact diskreadings of series 0.1 in %s", raw)
}