feat(hardlink): unify kiosk payments and finalize legacy cleanup
This commit is contained in:
@@ -303,12 +303,17 @@ func TestForegroundEncoderClearanceCallerDeadline(t *testing.T) {
|
||||
c.deliveryStarted = *now
|
||||
start := *now
|
||||
samples := 0
|
||||
remainingChunks := len(p.chunks)
|
||||
p.afterRead = func() {
|
||||
if len(p.chunks)%2 == 0 { // Only complete frame reads advance the observation clock.
|
||||
if len(p.chunks) == 4 || len(p.chunks) == 2 || len(p.chunks) == 0 {
|
||||
samples++
|
||||
*now = now.Add(time.Second)
|
||||
}
|
||||
// ACK and frame headers can take several reads without consuming a chunk.
|
||||
// Advance once per completed AP frame, not during a partial ACK read.
|
||||
if len(p.chunks) == remainingChunks {
|
||||
return
|
||||
}
|
||||
remainingChunks = len(p.chunks)
|
||||
if remainingChunks%2 == 0 {
|
||||
samples++
|
||||
*now = now.Add(time.Second)
|
||||
}
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 4*time.Second)
|
||||
@@ -326,7 +331,10 @@ func TestForegroundEncoderClearanceCallerDeadline(t *testing.T) {
|
||||
t.Errorf("caller deadline err=%v pending=%t", r.err, c.deliveryPending)
|
||||
}
|
||||
if got := wireCommands(p); !reflect.DeepEqual(got, []string{"AP", "AP", "AP"}) {
|
||||
t.Errorf("caller deadline commands=%v want AP only", got)
|
||||
t.Errorf("caller deadline commands=%v, want three AP observations and no movement", got)
|
||||
}
|
||||
if samples != 3 {
|
||||
t.Errorf("caller deadline completed AP frames=%d, want 3", samples)
|
||||
}
|
||||
if elapsed := now.Sub(start); elapsed != 5*time.Second {
|
||||
t.Errorf("last observation elapsed=%v want 5s", elapsed)
|
||||
|
||||
Reference in New Issue
Block a user