Sha256: 134a52adc6dbdf99b833cbc6a134c36db2d1533f91594099d80f8bed4ff83dc7
Contents?: true
Size: 925 Bytes
Versions: 2
Compression:
Stored size: 925 Bytes
Contents
# coding: utf-8 # 上传集成测试 require 'minitest/autorun' require 'benchmark' require 'memory_profiler' $LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__)) require 'cos' class UploadTest < Minitest::Test def setup @bucket = COS.client(config: '~/.cos.yml').bucket @file_src = '~/Desktop/upload_test/1.5GB.bin' end def test_upload_big_file skip memory_profiler do Benchmark.bm(32) do |bm| bm.report('Slice Upload 1.5GB File') do # 修改文件防止秒传命中 `echo 1 >> #{@file_src}` # 删除文件 @bucket.delete!('test/1.5GB.bin') @bucket.upload('test/', '1.5GB.bin', @file_src, auto_create_folder: true) 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/upload_test.rb |
cos-0.1.1 | test/upload_test.rb |