~jtv/gwacl/storage-tool-command-line

« back to all changes in this revision

Viewing changes to storage_test.go

  • Committer: Tarmac
  • Author(s): Julian Edwards
  • Date: 2013-08-05 10:21:26 UTC
  • mfrom: (209.1.1 fix-block-lengths)
  • Revision ID: tarmac-20130805102126-symhczjzlaqmgyz3
[r=rvb][bug=1202316][author=julian-edwards] Ensure consistent block lengths when uploading large files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    // There were two exchanges.
31
31
    c.Assert(transport.ExchangeCount, Equals, 2)
32
32
    // The first request is a Put Block with the block data.
33
 
    assertBlockSent(c, context, data, b64("0"), transport.Exchanges[0])
 
33
    assertBlockSent(c, context, data, b64("000000000000000000000000000000"), transport.Exchanges[0])
34
34
    // The second request is Put Block List to commit the block above.
35
 
    assertBlockListSent(c, context, []string{b64("0")}, transport.Exchanges[1])
 
35
    assertBlockListSent(c, context, []string{b64("000000000000000000000000000000")}, transport.Exchanges[1])
36
36
}
37
37
 
38
38
func (suite *testUploadBlockBlob) TestLargeFile(c *C) {
49
49
    c.Assert(transport.ExchangeCount, Equals, 3)
50
50
    // The first two requests are Put Block with chunks of the block data. The
51
51
    // weird looking block IDs are base64 encodings of the strings "0" and "1".
52
 
    assertBlockSent(c, context, data[:1024*1024], b64("0"), transport.Exchanges[0])
53
 
    assertBlockSent(c, context, data[1024*1024:], b64("1"), transport.Exchanges[1])
 
52
    assertBlockSent(c, context, data[:1024*1024], b64("000000000000000000000000000000"), transport.Exchanges[0])
 
53
    assertBlockSent(c, context, data[1024*1024:], b64("000000000000000000000000000001"), transport.Exchanges[1])
54
54
    // The second request is Put Block List to commit the block above.
55
 
    assertBlockListSent(c, context, []string{b64("0"), b64("1")}, transport.Exchanges[2])
 
55
    assertBlockListSent(c, context, []string{b64("000000000000000000000000000000"), b64("000000000000000000000000000001")}, transport.Exchanges[2])
56
56
}
57
57
 
58
58
func uploadRandomBlob(c *C, context *StorageContext, size int) []byte {