Now test the upload being not cancelled by another upload being added
(t *testing.T)
| 391 | |
| 392 | // Now test the upload being not cancelled by another upload being added |
| 393 | func TestWriteBackAddUpdateNotModified(t *testing.T) { |
| 394 | wb, cancel := newTestWriteBack(t) |
| 395 | defer cancel() |
| 396 | |
| 397 | pi := newPutItem(t) |
| 398 | |
| 399 | id := wb.Add(0, "one", 10, false, pi.put) |
| 400 | wbItem := wb.lookup[id] |
| 401 | checkOnHeap(t, wb, wbItem) |
| 402 | checkInLookup(t, wb, wbItem) |
| 403 | assert.Equal(t, "one", wb.string(t)) |
| 404 | |
| 405 | <-pi.started |
| 406 | checkNotOnHeap(t, wb, wbItem) |
| 407 | checkInLookup(t, wb, wbItem) |
| 408 | |
| 409 | // Now the upload has started add another one |
| 410 | |
| 411 | pi2 := newPutItem(t) |
| 412 | id2 := wb.Add(id, "one", 10, false, pi2.put) |
| 413 | assert.Equal(t, id, id2) |
| 414 | checkNotOnHeap(t, wb, wbItem) // object still being transferred |
| 415 | checkInLookup(t, wb, wbItem) |
| 416 | |
| 417 | // Because modified was false above this should not cancel the |
| 418 | // transfer |
| 419 | assert.False(t, pi.cancelled) |
| 420 | |
| 421 | // wait for original transfer to finish |
| 422 | pi.finish(nil) |
| 423 | waitUntilNoTransfers(t, wb) |
| 424 | checkNotOnHeap(t, wb, wbItem) |
| 425 | checkNotInLookup(t, wb, wbItem) |
| 426 | |
| 427 | assert.False(t, pi2.called) |
| 428 | } |
| 429 | |
| 430 | // Now test the upload being not cancelled by another upload being |
| 431 | // added because the upload hasn't started yet |
nothing calls this directly
no test coverage detected
searching dependent graphs…