github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/tests/system/scalability/trash.rb (about)

     1  require_relative '../boot'
     2  
     3  stack_port = 8080
     4  domain = 'trash.test.localhost:8080'
     5  email = 'me@localhost'
     6  
     7  stack = Stack.get stack_port
     8  inst = Instance.new stack, domain: domain, email: email
     9  
    10  stack.create_instance inst
    11  
    12  (0...100).map do |i|
    13    Thread.new do
    14      folder = Folder.create inst, name: "foo-#{i}"
    15      100.times do |j|
    16        CozyFile.create inst, name: "bar-#{j}", dir_id: folder.couch_id
    17      end
    18      folder.remove inst
    19    end
    20  end.map(&:value)
    21  
    22  before = Time.now
    23  Folder.clear_trash inst
    24  after = Time.now
    25  ap "Clearing the trash took #{after - before}s"
    26  
    27  ap "Don't forget to destroy the instance"
    28  ap "cozy-stack instances rm #{domain}"