34 lines
1.5 KiB
Go
34 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
snapshot "github.com/novox/mesh-controller/internal/facts"
|
|
"github.com/novox/mesh-controller/internal/link"
|
|
)
|
|
|
|
// Issue 969: the gate composes a machine as the mesh does, so a moved module is handed where the machine takes
|
|
// handed files and composed the old way where it does not.
|
|
func TestIssue969TheGateGivesAMachineItsContractSoItTakesHandedFiles(t *testing.T) {
|
|
taken := time.Date(2026, 10, 16, 12, 0, 0, 0, time.UTC)
|
|
|
|
stated, ok := standInHealth(snapshot.Machine{Name: "f35", Contract: link.HandedContract}, taken)
|
|
if !ok || !takesHanded(stated, ok) {
|
|
t.Fatalf("a machine whose engine takes handed files must be given that in the gate: %+v, %v", stated, ok)
|
|
}
|
|
old, ok := standInHealth(snapshot.Machine{Name: "e12", Contract: link.HandedContract - 1}, taken)
|
|
if !ok || takesHanded(old, ok) {
|
|
t.Fatalf("a machine whose engine is older must not take handed files: %+v, %v", old, ok)
|
|
}
|
|
none, ok := standInHealth(snapshot.Machine{Name: "d01"}, taken)
|
|
if ok || takesHanded(none, ok) {
|
|
t.Fatalf("a snapshot that carries no contract states nothing: %+v, %v", none, ok)
|
|
}
|
|
}
|
|
|
|
// Issue 969, through the store: a machine whose engine stated the handed contract is in the snapshot with it, the
|
|
// gate raises it as taking handed files, and one whose statement is below it is raised as not taking them. Run in
|
|
// the merge check with the other tests that need a store; the composition itself, handed here and refused there, is
|
|
// the catalogue's TestAHandedModuleNamingARunTimeBoundKeyComposesOnlyWhereItIsHanded.
|