예제 #1
0
 def test_transferred(self, operations, transferred):
     ticket = Ticket(testutils.create_ticket(ops=["read"]))
     ticket._operations = [
         FakeOperation(offset=offset, done=done)
         for offset, done in operations
     ]
     assert ticket.transferred() == transferred
예제 #2
0
 def test_benchmark_transferred(self, transferred_gb):
     ticket = Ticket(testutils.create_ticket(ops=["read"]))
     operations = transferred_gb * 1024**3 // CHUNK_SIZE
     ticket._operations = [
         FakeOperation(offset=i * CHUNK_SIZE, done=CHUNK_SIZE)
         for i in range(operations)
     ]
     start = time.time()
     assert ticket.transferred() == transferred_gb * 1024**3
     end = time.time()
     print("%dG file (%d operations) in %.6f seconds" %
           (transferred_gb, operations, end - start))
예제 #3
0
 def test_active(self, operations, active):
     ticket = Ticket(testutils.create_ticket())
     ticket._operations = operations
     assert ticket.active() == active