Split the unit level from the integration level outside cmd, builder, link, catalogue, inventory; merge-check.sh times and bounds the unit level (issue 895)

This commit is contained in:
2026-10-17 20:41:57 +02:00
parent d5d5449835
commit 14fe2ad736
44 changed files with 1113 additions and 826 deletions
@@ -0,0 +1,45 @@
//go:build integration
package testbus
import (
"strings"
"testing"
"github.com/nats-io/nats.go"
)
func TestEveryTestHasABusOfItsOwn(t *testing.T) {
seen := map[string]bool{}
for i := 0; i < 2; i++ {
t.Run("one", func(t *testing.T) {
url := URL(t)
if seen[url] {
t.Fatalf("two tests were handed %s", url)
}
seen[url] = true
conn, err := nats.Connect(url)
if err != nil {
t.Fatal(err)
}
defer conn.Close()
js, err := conn.JetStream()
if err != nil {
t.Fatal(err)
}
if _, err := js.StreamInfo("EVENTS"); err == nil {
t.Fatal("a stream an earlier test made is here")
}
if _, err := js.AddStream(&nats.StreamConfig{Name: "EVENTS", Subjects: []string{"mesh.>"}}); err != nil {
t.Fatal(err)
}
})
}
// Asked twice, one test reaches one bus.
if a, b := URL(t), URL(t); a != b {
t.Errorf("one test was handed two buses: %s and %s", a, b)
}
if v := strings.Count(Version, "."); v != 2 {
t.Errorf("the server's release reads %q", Version)
}
}
-36
View File
@@ -9,8 +9,6 @@ import (
"encoding/json"
"github.com/nats-io/nats.go"
"github.com/novox/mesh-controller/internal/beside"
)
@@ -59,37 +57,3 @@ func TestTheBusTheTestsRunIsTheBusTheMeshRuns(t *testing.T) {
}
// A test's bus is its own: what one test makes, the next never sees.
func TestEveryTestHasABusOfItsOwn(t *testing.T) {
seen := map[string]bool{}
for i := 0; i < 2; i++ {
t.Run("one", func(t *testing.T) {
url := URL(t)
if seen[url] {
t.Fatalf("two tests were handed %s", url)
}
seen[url] = true
conn, err := nats.Connect(url)
if err != nil {
t.Fatal(err)
}
defer conn.Close()
js, err := conn.JetStream()
if err != nil {
t.Fatal(err)
}
if _, err := js.StreamInfo("EVENTS"); err == nil {
t.Fatal("a stream an earlier test made is here")
}
if _, err := js.AddStream(&nats.StreamConfig{Name: "EVENTS", Subjects: []string{"mesh.>"}}); err != nil {
t.Fatal(err)
}
})
}
// Asked twice, one test reaches one bus.
if a, b := URL(t), URL(t); a != b {
t.Errorf("one test was handed two buses: %s and %s", a, b)
}
if v := strings.Count(Version, "."); v != 2 {
t.Errorf("the server's release reads %q", Version)
}
}