• Patrick Steinhardt's avatar
    Fix specs which test listing of stale branches in projects · 41dadf19
    Patrick Steinhardt authored
    With the preceding commit, the project tests which verify listing of
    active and stale branches works as expected start to fail. This is not a
    bug in the preceding commit, but rather a bug in the tests themselves:
    while we were using `travel_to()` to create stale branches, they were
    created via Gitaly's `UserCommitFiles()` RPE. This RPC doesn't accept
    any timestamp and thus the resulting commits do not carry the timestamp
    set by `travel_to()`. With the preceding commit, this now gets handled
    correctly such that the commits do carry the expected timestamp, which
    uncovers two issues:
    
        1. There is a race between creation of active branches and checking
           for stale branches. The oldest active branch is only a second
           younger than the stale-branch threshold. Thus, if we need longer
           than that second, it will be considered stale, too.
    
        2. We do expect stale branches to be sorted in descending recency
           order, but in fact they're ordered in ascending recency: the
           oldest branch is on top.
    
    Fix the tests by incrementing branch creation times by an hour instead
    of by a second, which extends the race window for the oldest active
    branch to one hour. And second, by correctly sorting expected branches.
    41dadf19
branches_spec.rb 10.1 KB