49 lines
1.4 KiB
Go
49 lines
1.4 KiB
Go
//go:build integration
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
// A node's own set failing to compose, and the mesh being unable to answer at all, are different
|
|
// things, and only the first may be passed over when something is gathered across every machine
|
|
// (novox/hq 04-ISSUES/152). These pin that distinction where the gatherers rely on it.
|
|
|
|
func TestASetThatDoesNotComposeIsMarkedAsTheNodesOwnProblem(t *testing.T) {
|
|
open := aMesh(t)
|
|
one, two := rivals()
|
|
register(t, open, one)
|
|
register(t, open, two)
|
|
for _, m := range []string{one.Module, two.Module} {
|
|
if _, err := open.inventory.Assign(t.Context(), "laptop", m); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
_, _, err := planFor(t.Context(), open, "laptop")
|
|
if err == nil {
|
|
t.Fatal("two modules claiming one seat composed anyway")
|
|
}
|
|
if !unresolvable(err) {
|
|
t.Fatalf("a set that cannot compose was not marked as the node's own problem: %v", err)
|
|
}
|
|
}
|
|
|
|
func TestAStoreThatCannotBeReadIsNotANodeThatDoesNotCompose(t *testing.T) {
|
|
open := aMesh(t)
|
|
|
|
// Nothing is wrong with anchor. The question simply cannot be asked.
|
|
stopped, cancel := context.WithCancel(t.Context())
|
|
cancel()
|
|
|
|
_, _, err := planFor(stopped, open, "anchor")
|
|
if err == nil {
|
|
t.Fatal("a plan composed against a store that could not be read")
|
|
}
|
|
if unresolvable(err) {
|
|
t.Fatalf("a question the mesh could not answer was read as a node that runs nothing: %v", err)
|
|
}
|
|
}
|