announcetest.Check starts the module against a bus of the test's own and holds its announcement equal to what its code declares; testbus leaves internal/ so a module's own integration tests can start it.
30 lines
862 B
Go
30 lines
862 B
Go
//go:build integration
|
|
|
|
package announcetest
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/announce"
|
|
"git.novox.be/novox/mesh-sdk/go/process"
|
|
)
|
|
|
|
// 1790/S11: a module started against the test bus announces through process.Conn.Keeps, and Check reads that
|
|
// announcement back against what the code declares.
|
|
func TestCheckReadsTheModulesAnnouncementOffARealBus(t *testing.T) {
|
|
declared := []announce.State{{Name: "accounts", Readable: true}, {Name: "drafts"}}
|
|
got := Check(t, "mesh-mail", declared, func(url string) func() {
|
|
conn, err := process.Connect(process.Account{URL: url, Module: "mesh-mail", Node: "novox", User: "u", Password: "p"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := conn.Keeps(declared...); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
return conn.Close
|
|
})
|
|
if got.Node != "novox" {
|
|
t.Fatalf("announced from %q", got.Node)
|
|
}
|
|
}
|