Welcome to mirror list, hosted at ThFree Co, Russian Federation.

browsing_doc_test.rb « performance « test - github.com/git/git-scm.com.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cda63a9185a8666efe72b686bac22ba9819cd4e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'test_helper'
require 'rails/performance_test_help'
require "database_cleaner"
class BrowsingDocTest < ActionDispatch::PerformanceTest
  self.profile_options = {runs: 10, metrics: [:wall_time, :process_time]}

  def setup
    DatabaseCleaner.strategy = :truncation
    DatabaseCleaner.clean
    100.times do |i|
      tree_sha    = SecureRandom.hex
      commit_sha  = SecureRandom.hex
      ascii_sha   = SecureRandom.hex
      version = Version.create(name: "#{i}.0.0", commit_sha: commit_sha, tree_sha: tree_sha, committed: Time.current)
      doc_file = DocFile.create(name: "git-config")
      doc = Doc.create(blob_sha: ascii_sha, html: "test", plain: "test")
      doc_version = DocVersion.create(version_id: version.id, doc_id: doc.id, doc_file_id: doc_file.id)
    end
  end

  def teardown
    DatabaseCleaner.clean
  end

  test "browsing git-config" do
    get '/docs/git-config'
  end

end