Now test the upload being not cancelled by another upload being added because the upload hasn't started yet
(t *testing.T)
| 430 | // Now test the upload being not cancelled by another upload being |
| 431 | // added because the upload hasn't started yet |
| 432 | func TestWriteBackAddUpdateNotStarted(t *testing.T) { |
| 433 | wb, cancel := newTestWriteBack(t) |
| 434 | defer cancel() |
| 435 | |
| 436 | pi := newPutItem(t) |
| 437 | |
| 438 | id := wb.Add(0, "one", 10, true, pi.put) |
| 439 | wbItem := wb.lookup[id] |
| 440 | checkOnHeap(t, wb, wbItem) |
| 441 | checkInLookup(t, wb, wbItem) |
| 442 | assert.Equal(t, "one", wb.string(t)) |
| 443 | |
| 444 | // Immediately add another upload before the first has started |
| 445 | |
| 446 | pi2 := newPutItem(t) |
| 447 | id2 := wb.Add(id, "one", 10, true, pi2.put) |
| 448 | assert.Equal(t, id, id2) |
| 449 | checkOnHeap(t, wb, wbItem) // object still awaiting transfer |
| 450 | checkInLookup(t, wb, wbItem) |
| 451 | |
| 452 | // Wait for the upload to start |
| 453 | <-pi2.started |
| 454 | checkNotOnHeap(t, wb, wbItem) |
| 455 | checkInLookup(t, wb, wbItem) |
| 456 | |
| 457 | // Because modified was false above this should not cancel the |
| 458 | // transfer |
| 459 | assert.False(t, pi.cancelled) |
| 460 | |
| 461 | // wait for new transfer to finish |
| 462 | pi2.finish(nil) |
| 463 | waitUntilNoTransfers(t, wb) |
| 464 | checkNotOnHeap(t, wb, wbItem) |
| 465 | checkNotInLookup(t, wb, wbItem) |
| 466 | |
| 467 | assert.False(t, pi.called) |
| 468 | } |
| 469 | |
| 470 | func TestWriteBackGetStats(t *testing.T) { |
| 471 | wb, cancel := newTestWriteBack(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…