forked from gitea/gitea
1
0
Fork 0

archiver: tests: amend test to include WaitForCompletion()

This is a trivial one, so go ahead and include it.
This commit is contained in:
Kyle Evans 2020-05-07 18:38:47 -05:00
parent ee6f508799
commit 75261f56bc
1 changed files with 8 additions and 0 deletions

View File

@ -184,7 +184,15 @@ func TestArchive_Basic(t *testing.T) {
assert.Equal(t, 2, len(archiveInProgress)) assert.Equal(t, 2, len(archiveInProgress))
releaseOneEntry(t, inFlight) releaseOneEntry(t, inFlight)
assert.Equal(t, 1, len(archiveInProgress)) assert.Equal(t, 1, len(archiveInProgress))
// Test waiting for completion on one, which should be relatively
// straightforward. We'll hold the queue-lock and release an entry. It will
// wait to acquire the queue lock, which we'll drop when we
// WaitForCompletion(), to be woken up later.
LockQueue()
releaseOneEntry(t, inFlight) releaseOneEntry(t, inFlight)
WaitForCompletion()
UnlockQueue()
assert.Equal(t, 0, len(archiveInProgress)) assert.Equal(t, 0, len(archiveInProgress))
zipReq2 = DeriveRequestFrom(ctx, firstCommit+".zip") zipReq2 = DeriveRequestFrom(ctx, firstCommit+".zip")