Drive the archive reopen debounce test from a clock (closes #190)
check / check (push) Waiting to run
check / check (push) Waiting to run
The archive writer now reads the time its reopen debounce is measured on from a clock field, time.Now outside tests. The debounce test moves that clock instead of sleeping past a real 2 second window, so a slow host between the two quick writes can no longer turn a correct result red. Model: opus-5-5
This commit is contained in:
@@ -512,6 +512,12 @@ func (e *ExportArchiveWriter) Reopen(
|
||||
return e.w.reopen(expiry)
|
||||
}
|
||||
|
||||
// SetNow replaces the clock the writer measures its reopen
|
||||
// debounce on.
|
||||
func (e *ExportArchiveWriter) SetNow(now func() time.Time) {
|
||||
e.w.now = now
|
||||
}
|
||||
|
||||
// Reopens reports how many times the file has been opened.
|
||||
func (e *ExportArchiveWriter) Reopens() int {
|
||||
return e.w.reopens
|
||||
|
||||
Reference in New Issue
Block a user