Fold H2's new tests into existing ones: go/ at 327 unit tests (from 331), TypeScript at 48 (from 49)

The eight Go test functions H2 added become subtests of existing tests
(catalogue's state test, the bundle's state test, the views test, the process
state test, the testbus bus test, the seal byte-for-byte test), and four more
are folded beside them (two seal, two process watch); the two TypeScript seal
tests become one, and two more TypeScript tests are folded into their
neighbours. No assertion is lost.

Builds: design 47 H2 §819
This commit is contained in:
2026-11-22 02:25:44 +01:00
parent 7d7a89411c
commit f90189353c
15 changed files with 501 additions and 549 deletions
+46 -47
View File
@@ -1441,6 +1441,52 @@ func (s *pagedSource) Page(after string, _ int, _ time.Duration) ([]KeyedEntry,
func TestViews(t *testing.T) {
t.Run("Views", subViews)
t.Run("StdioWriterPublishesAndListensThroughTheModulesOwnPlumbing", subStdioWriterPublishesAndListensThroughTheModulesOwnPlumbing)
// Design 47 H2 §782: one process reader's pictures are safe at once: gets, keys and watches from many goroutines while
// the owner's events change the picture and further views are followed, under the race detector.
t.Run("one process reader serves concurrent reads", func(t *testing.T) {
made := time.Date(2026, 11, 22, 0, 0, 0, 0, time.UTC)
r := &ProcessReader{Module: "reader", Call: func(string, any) (json.RawMessage, error) {
return json.Marshal(Answer{V: Version, Owner: "o", State: "s", Revision: 1, Created: made, Values: map[string]json.RawMessage{"a": json.RawMessage(`1`)}})
}}
p, err := r.Follow("o", "s", "o.o_read")
if err != nil {
t.Fatal(err)
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if err := p.Follower().Start(ctx); err != nil {
t.Fatal(err)
}
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
for i := range 200 {
p.Follower().Apply(Event{V: Version, Owner: "o", State: "s", Key: fmt.Sprintf("k%d", i%7), Revision: uint64(i + 2), Created: made, Value: json.RawMessage(`2`)})
}
}()
for i := range 16 {
wg.Add(1)
go func() {
defer wg.Done()
w, err := p.Watch(ctx, ">")
if err != nil {
t.Error(err)
return
}
defer w.Stop()
for range 20 {
_, _ = p.Get(ctx, "a")
_, _ = p.Keys(ctx)
_ = r.Followers()
}
if _, err := r.Follow("o", fmt.Sprintf("s%d", i), "o.o_read"); err != nil {
t.Error(err)
}
}()
}
wg.Wait()
})
}
type putRecorder struct{ puts map[string][]byte }
@@ -1488,50 +1534,3 @@ func TestFirstViewsSayTheOwnBuild(t *testing.T) {
t.Errorf("nothing kept: %v", read)
}
}
// Design 47 H2 §782: one process reader's pictures are safe at once: gets, keys and watches from many goroutines while
// the owner's events change the picture and further views are followed, under the race detector.
func TestOneProcessReaderServesConcurrentReads(t *testing.T) {
made := time.Date(2026, 11, 22, 0, 0, 0, 0, time.UTC)
r := &ProcessReader{Module: "reader", Call: func(string, any) (json.RawMessage, error) {
return json.Marshal(Answer{V: Version, Owner: "o", State: "s", Revision: 1, Created: made, Values: map[string]json.RawMessage{"a": json.RawMessage(`1`)}})
}}
p, err := r.Follow("o", "s", "o.o_read")
if err != nil {
t.Fatal(err)
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if err := p.Follower().Start(ctx); err != nil {
t.Fatal(err)
}
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
for i := range 200 {
p.Follower().Apply(Event{V: Version, Owner: "o", State: "s", Key: fmt.Sprintf("k%d", i%7), Revision: uint64(i + 2), Created: made, Value: json.RawMessage(`2`)})
}
}()
for i := range 16 {
wg.Add(1)
go func() {
defer wg.Done()
w, err := p.Watch(ctx, ">")
if err != nil {
t.Error(err)
return
}
defer w.Stop()
for range 20 {
_, _ = p.Get(ctx, "a")
_, _ = p.Keys(ctx)
_ = r.Followers()
}
if _, err := r.Follow("o", fmt.Sprintf("s%d", i), "o.o_read"); err != nil {
t.Error(err)
}
}()
}
wg.Wait()
}