37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
//go:build integration
|
|
|
|
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/novox/mesh-controller/internal/catalogue"
|
|
)
|
|
|
|
func TestAnAssignmentSaysOnlyWhatItChangedOnItsOwnNode(t *testing.T) {
|
|
open := aMesh(t)
|
|
ctx := t.Context()
|
|
register(t, open, aContainer("web"))
|
|
register(t, open, aContainer("db"))
|
|
// anchor already lacks a runtime for db: true, and not this act's to say.
|
|
if _, err := open.inventory.Assign(ctx, "anchor", "db"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, err := open.inventory.Assign(ctx, "laptop", "db"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
said, err := assign(ctx, open, "laptop", "web")
|
|
if err != nil {
|
|
t.Fatalf("%v\n%s", err, said)
|
|
}
|
|
if !strings.Contains(said, "web on laptop depends on "+catalogue.ContainerRuntimeSeat) {
|
|
t.Errorf("the assignment does not say what the module it assigned depends on:\n%s", said)
|
|
}
|
|
for _, not := range []string{"db on laptop", "db on anchor", "anchor:"} {
|
|
if strings.Contains(said, not) {
|
|
t.Errorf("the assignment says %q, which it did not change:\n%s", not, said)
|
|
}
|
|
}
|
|
}
|