S8 unread-away: Unread of a state and a view, the away answers, the start's phase
Builds: design 47 H2 H-A-708 (1) (2), H-A-717 (DQ-54, DQ-58)
This commit is contained in:
@@ -58,8 +58,35 @@ func subAReaderHearsAnOwnersChangesAsOrdinaryEvents(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// H-A-708 (1), H-A-717 DQ-54: the phase the start is in, set before the state is there, is kept in it once it is, and
|
||||
// ended with null.
|
||||
r.BeginPhase("take-in")
|
||||
r.Start(ctx, js, cred, process.AwaitBucket(ctx, js, nil, "reader_first-views", "", t.Logf))
|
||||
<-r.Ready()
|
||||
phases, err := statusKV.Watch(ctx, views.StartPhaseKey)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
phaseNow := func() string {
|
||||
for e := range phases.Updates() {
|
||||
if e != nil {
|
||||
var p *views.StartPhase
|
||||
_ = json.Unmarshal(e.Value(), &p)
|
||||
if p == nil {
|
||||
return "none"
|
||||
}
|
||||
return p.Name
|
||||
}
|
||||
}
|
||||
return "closed"
|
||||
}
|
||||
if got := phaseNow(); got != "take-in" {
|
||||
t.Fatalf("the start's phase is %s", got)
|
||||
}
|
||||
r.EndPhase()
|
||||
if got := phaseNow(); got != "none" {
|
||||
t.Fatalf("the start's phase after it ended is %s", got)
|
||||
}
|
||||
pic, err := r.KeyValue(ctx, "o_modules")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user