Sha256: 783a388c71535b4dd49772afd9ac521010d6d5914cc82af5d1064e41d5a9fa59

Contents?: true

Size: 764 Bytes

Versions: 2

Compression:

Stored size: 764 Bytes

Contents

# coding: utf-8
# 下载集成测试

require 'minitest/autorun'
require 'benchmark'
require 'memory_profiler'

$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))

require 'cos'

class DownloadTest < Minitest::Test

  def setup
    @bucket     = COS.client(config: '~/.cos.yml').bucket
    @file_store = '~/Desktop/download_test/1.5GB.bin'
  end

  def test_download_big_file
    skip

    memory_profiler do

      Benchmark.bm(32) do |bm|
        bm.report('Slice Download 1.5GB File') do
          @bucket.download('test/1.5GB.bin', @file_store)
        end
      end

    end
  end

  private

  def memory_profiler
    report = MemoryProfiler.report do
      yield if block_given?
    end

    # 打印内存信息
    report.pretty_print
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cos-0.1.2 test/download_test.rb
cos-0.1.1 test/download_test.rb