29 lines
752 B
Go
29 lines
752 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"slices"
|
|
"testing"
|
|
)
|
|
|
|
// The module holding the seat mesh-provisioner, which this provider reads the plans and provisions of, is the one its manifest's
|
|
// `reads` name: no client names a holder (novox/hq ADR 0625 §4).
|
|
func TestTheProvisionerIsTheManifests(t *testing.T) {
|
|
raw, err := os.ReadFile("../../module.json")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var m struct {
|
|
Reads []string `json:"reads"`
|
|
}
|
|
if err := json.Unmarshal(raw, &m); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, state := range []string{"plans", "provisions"} {
|
|
if !slices.Contains(m.Reads, provisionerModule+"."+state) {
|
|
t.Errorf("the provider reads %s.%s, its manifest's reads are %v", provisionerModule, state, m.Reads)
|
|
}
|
|
}
|
|
}
|