derailed_benchmarks 1.3.5 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6bbf373c25f791478f3890edeab279da2f13d42a9a7261c6e172f07e3e44713
4
- data.tar.gz: fda7f0f615bccaa9409a98dc90f042e794f7fa510c0b64e9e2829843d173f240
3
+ metadata.gz: cc052693e6702c9fae168ebd5af966409edfd862cb10f493eeeef6f2b56c702a
4
+ data.tar.gz: e68aa2d95326f0d462b6f531318277180f2f155098c930fec1f7d9d5055a90c1
5
5
  SHA512:
6
- metadata.gz: 179ff4c0663ecb7960008c81b0e1133cb1b41ed73978c17ca0213612ba39d70312238121c63fc4de669c8f0f4f15a33142dbd778b815b1d6ee2ed184501fc4af
7
- data.tar.gz: 8e222be9b6bb2608a360004ad77bcda16b0839145656401bd1b65816a4c8ef6c63358060f852d1f604f5cbb2ea84c5e1435b445267a81414cca64e9678e1a4b6
6
+ metadata.gz: da2a2ddb042b1d7d50e2d6ef70dc281fbe09bac107b763e64fe26bb47b30a3a0b46580e618f7c97c29c689b3b0981333a902dbb32f3c8df340a6cc2c54db4cf9
7
+ data.tar.gz: 113502784b03d89cafc13ed4856db140352a83ab5e68393e5a09bd9f7942505aa0aec33d8b35858e97d873c2e6435fe1cdb140ae1915dbd60a4d7d2c82129310
@@ -1,36 +1,17 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2
4
- - 2.3
5
- - 2.4.0
3
+ - 2.5.5
4
+ - 2.6.3
6
5
  - ruby-head
6
+
7
7
  gemfile:
8
- - gemfiles/rails_3_2.gemfile
9
- - gemfiles/rails_4_0.gemfile
10
- - gemfiles/rails_4_1.gemfile
11
- - gemfiles/rails_4_2.gemfile
12
- - gemfiles/rails_5_0.gemfile
13
8
  - gemfiles/rails_5_1.gemfile
9
+ - gemfiles/rails_5_2.gemfile
10
+ - gemfiles/rails_6_0.gemfile
14
11
 
15
12
  before_install:
16
13
  - gem install bundler
17
14
 
18
15
  matrix:
19
- # Ruby 2.4 doesn't work with devise + rails 3/4, so just skip the builds to
20
- # avoid travis runs we expect to fail. This is due to the Integer/Fixnum
21
- # change if I am not mistaken.
22
- exclude:
23
- - rvm: 2.4.0
24
- gemfile: gemfiles/rails_3_2.gemfile
25
- - rvm: 2.4.0
26
- gemfile: gemfiles/rails_4_0.gemfile
27
- - rvm: 2.4.0
28
- gemfile: gemfiles/rails_4_1.gemfile
29
- - rvm: ruby-head
30
- gemfile: gemfiles/rails_3_2.gemfile
31
- - rvm: ruby-head
32
- gemfile: gemfiles/rails_4_0.gemfile
33
- - rvm: ruby-head
34
- gemfile: gemfiles/rails_4_1.gemfile
35
16
  allow_failures:
36
17
  - rvm: ruby-head
@@ -1,11 +1,16 @@
1
1
  # A Log of Changes!
2
2
 
3
+ ## 1.3.6
4
+
5
+ - `require_relative` is now measured [commit](https://github.com/schneems/derailed_benchmarks/commit/af11bcc46a4fa24f79e4897a51034927a56e077e)
6
+ - Fix bug preventing a specific Rails 6 file from being loaded (https://github.com/schneems/derailed_benchmarks/pull/134)
7
+ - `exit(1)` is called instead of raise (https://github.com/schneems/derailed_benchmarks/pull/127)
8
+
3
9
  ## [1.3.5]
4
10
 
5
11
  - Output of `test` now emits the word "derailed" for easier grepping.
6
12
  - Fix "already initialized constant" warning
7
13
 
8
-
9
14
  ## [1.3.4]
10
15
 
11
16
  - Allow for "warming up tasks" via WARM_COUNT env var #119
data/README.md CHANGED
@@ -579,7 +579,7 @@ If you're trying to authenticate a non-user model, you'll need to write your own
579
579
 
580
580
  ### Custom Authentication Strategy
581
581
 
582
- To implement your own authentication strategy You will need to create a class that [inherits from auth_helper.rb](lib/derailed_benchmarks/auth_helper.rb). You will need to implement a `setup` and a `call` method. You can see an example of [how the devise auth helper was written](lib/derailed_benchmarks/auth_helpers/devise.rb). You can put this code in your `perf.rake` file.
582
+ To implement your own authentication strategy You will need to create a class that [inherits from auth_helper.rb](lib/derailed_benchmarks/auth_helper.rb). You will need to implement a `setup` and a `call` method. You can see an example of [how the devise auth helper was written](lib/derailed_benchmarks/auth_helpers/devise.rb) and [how it can be done for Clearance](https://gist.github.com/zavan/f4d34dd86bf825db549a0ac28c7e10d5). You can put this code in your `perf.rake` file.
583
583
 
584
584
  ```ruby
585
585
  class MyCustomAuth < DerailedBenchmarks::AuthHelper
@@ -29,7 +29,8 @@ Gem::Specification.new do |gem|
29
29
  gem.add_dependency "thor", "~> 0.19"
30
30
 
31
31
  gem.add_development_dependency "capybara", "~> 2"
32
- gem.add_development_dependency "rails", "> 3", "< 6"
32
+ gem.add_development_dependency "m"
33
+ gem.add_development_dependency "rails", "> 3", "<= 6"
33
34
  gem.add_development_dependency "devise", "> 3", "< 5"
34
35
  gem.add_development_dependency "appraisal", "2.2.0"
35
36
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 3.2.0"
5
+ gem "rails", "~> 5.2.0"
6
6
 
7
7
  group :development, :test do
8
8
  gem "sqlite3", platform: [:ruby, :mswin, :mingw]
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 4.0.0"
5
+ gem "rails", "6.0.0.rc1"
6
6
 
7
7
  group :development, :test do
8
8
  gem "sqlite3", platform: [:ruby, :mswin, :mingw]
@@ -9,6 +9,9 @@ ENV['CUT_OFF'] ||= "0.3"
9
9
  # Monkey patch kernel to ensure that all `require` calls call the same
10
10
  # method
11
11
  module Kernel
12
+
13
+ private
14
+
12
15
  alias :original_require :require
13
16
  REQUIRE_STACK = []
14
17
 
@@ -16,13 +19,14 @@ module Kernel
16
19
  Kernel.require(file)
17
20
  end
18
21
 
19
- # This breaks things, not sure how to fix
20
- # def require_relative(file)
21
- # Kernel.require_relative(file)
22
- # end
22
+ def require_relative(file)
23
+ # Kernel.require_relative(file)
24
+ require File.expand_path("../#{file}", caller_locations(1, 1)[0].absolute_path)
25
+ end
26
+
23
27
  class << self
24
28
  alias :original_require :require
25
- # alias :original_require_relative :require_relative
29
+ alias :original_require_relative :require_relative
26
30
  end
27
31
 
28
32
  # The core extension we use to measure require time of all requires
@@ -60,7 +64,12 @@ TOP_REQUIRE = DerailedBenchmarks::RequireTree.new("TOP")
60
64
  REQUIRE_STACK.push(TOP_REQUIRE)
61
65
 
62
66
  Kernel.define_singleton_method(:require) do |file|
63
- measure_memory_impact(file) { |file| original_require(file) }
67
+ measure_memory_impact(file) do |file|
68
+ # "source_annotation_extractor" is deprecated in Rails 6
69
+ # # if we don't skip the library it leads to a crash
70
+ # next if file == "rails/source_annotation_extractor" && Rails.version >= '6.0'
71
+ original_require(file)
72
+ end
64
73
  end
65
74
 
66
75
  # Don't forget to assign a cost to the top level
@@ -69,4 +78,4 @@ TOP_REQUIRE.cost = cost_before_requiring_anything
69
78
  def TOP_REQUIRE.print_sorted_children(*args)
70
79
  self.cost = GetProcessMem.new.mb - self.cost
71
80
  super
72
- end
81
+ end
@@ -5,7 +5,7 @@ module DerailedBenchmarks
5
5
  REQUIRED_BY = {}
6
6
 
7
7
  attr_reader :name
8
- attr_accessor :cost
8
+ attr_writer :cost
9
9
  attr_accessor :parent
10
10
 
11
11
  def initialize(name)
@@ -96,14 +96,35 @@ namespace :perf do
96
96
  def call_app(path = File.join("/", PATH_TO_HIT))
97
97
  cmd = "curl #{CURL_HTTP_HEADER_ARGS} 'http://localhost:#{@port}#{path}' -s --fail 2>&1"
98
98
  response = `#{cmd}`
99
- raise "Bad request to #{cmd.inspect} Response:\n#{ response.inspect }" unless $?.success?
99
+ unless $?.success?
100
+ STDERR.puts "Couldn't call app."
101
+ STDERR.puts "Bad request to #{cmd.inspect} \n\n***RESPONSE***:\n\n#{ response.inspect }"
102
+
103
+ FileUtils.mkdir_p("tmp")
104
+ File.open("tmp/fail.html", "w+") {|f| f.write response.body }
105
+
106
+ `open #{File.expand_path("tmp/fail.html")}` if ENV["DERAILED_DEBUG"]
107
+
108
+ exit(1)
109
+ end
100
110
  end
101
111
  else
102
112
  @app = Rack::MockRequest.new(DERAILED_APP)
103
113
 
104
114
  def call_app
105
115
  response = @app.get(PATH_TO_HIT, RACK_HTTP_HEADERS)
106
- raise "Bad request: #{ response.body }" unless response.status == 200
116
+ if response.status != 200
117
+ STDERR.puts "Couldn't call app. Bad request to #{PATH_TO_HIT}! Resulted in #{response.status} status."
118
+ STDERR.puts "\n\n***RESPONSE BODY***\n\n"
119
+ STDERR.puts response.body
120
+
121
+ FileUtils.mkdir_p("tmp")
122
+ File.open("tmp/fail.html", "w+") {|f| f.write response.body }
123
+
124
+ `open #{File.expand_path("tmp/fail.html")}` if ENV["DERAILED_DEBUG"]
125
+
126
+ exit(1)
127
+ end
107
128
  response
108
129
  end
109
130
  end
@@ -199,8 +220,7 @@ namespace :perf do
199
220
  end
200
221
 
201
222
  task :ram_over_time do
202
- Kernel.warn("The ram_over_time task is deprecated. Use mem_over_time")
203
- Rake::Task["perf:ram_over_time"].invoke
223
+ raise "Use mem_over_time"
204
224
  end
205
225
 
206
226
  desc "iterations per second"
@@ -1,3 +1,3 @@
1
1
  module DerailedBenchmarks
2
- VERSION = "1.3.5"
2
+ VERSION = "1.3.6"
3
3
  end
@@ -22,8 +22,9 @@ class KernelRequireTest < ActiveSupport::TestCase
22
22
  test "core extension profiles useage" do
23
23
  require fixtures_dir("require/parent_one.rb")
24
24
  parent = assert_node_in_parent("parent_one.rb", TOP_REQUIRE)
25
- child_one = assert_node_in_parent("child_one.rb", parent)
25
+ assert_node_in_parent("child_one.rb", parent)
26
26
  child_two = assert_node_in_parent("child_two.rb", parent)
27
- rse_child = assert_node_in_parent("raise_child.rb", child_two)
27
+ assert_node_in_parent("relative_child", parent)
28
+ assert_node_in_parent("raise_child.rb", child_two)
28
29
  end
29
30
  end
@@ -4,3 +4,4 @@ class ParentOne
4
4
  end
5
5
  require File.expand_path('../child_one.rb', __FILE__)
6
6
  require File.expand_path('../child_two.rb', __FILE__)
7
+ require_relative 'relative_child'
@@ -12,7 +12,7 @@ class TasksTest < ActiveSupport::TestCase
12
12
  end
13
13
 
14
14
  def rake(cmd, options = {})
15
- assert_success = options[:assert_success] || true
15
+ assert_success = options.key?(:assert_success) ? options[:assert_success] : true
16
16
  env = options[:env] || {}
17
17
  env_string = env.map {|key, value| "#{key.shellescape}=#{value.to_s.shellescape}" }.join(" ")
18
18
  cmd = "env #{env_string} bundle exec rake -f perf.rake #{cmd} --trace"
@@ -48,7 +48,7 @@ class TasksTest < ActiveSupport::TestCase
48
48
 
49
49
  test 'TEST_COUNT' do
50
50
  result = rake "perf:test", env: { "TEST_COUNT" => 1 }
51
- assert_match "1 requests", result
51
+ assert_match "1 derailed requests", result
52
52
  end
53
53
 
54
54
  test 'WARM_COUNT' do
@@ -4,4 +4,8 @@
4
4
  # If you change this key, all old signed cookies will become invalid!
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = 'bedc31c5fff702ea808045bbbc5123455f1c00ecd005a1f667a5f04332100a6abf22cfcee2b3d39b8f677c03bb6503cf1c3b65c1287b9e13bd0d20c6431ec6ab'
7
+ if Dummy::Application.config.respond_to?(:secret_key_base)
8
+ Dummy::Application.config.secret_key_base = 'bedc31c5fff702ea808045bbbc5123455f1c00ecd005a1f667a5f04332100a6abf22cfcee2b3d39b8f677c03bb6503cf1c3b65c1287b9e13bd0d20c6431ec6ab'
9
+ else
10
+ Dummy::Application.config.secret_token = 'bedc31c5fff702ea808045bbbc5123455f1c00ecd005a1f667a5f04332100a6abf22cfcee2b3d39b8f677c03bb6503cf1c3b65c1287b9e13bd0d20c6431ec6ab'
11
+ end
@@ -27,12 +27,17 @@ Capybara.default_driver = :rack_test
27
27
  Capybara.default_selector = :css
28
28
 
29
29
  # Run any available migration
30
- ActiveRecord::Migrator.migrate File.expand_path("../rails_app/db/migrate/", __FILE__)
30
+ if Rails.gem_version >= Gem::Version.new('5.2.0')
31
+ ActiveRecord::MigrationContext
32
+ .new(File.expand_path("../rails_app/db/migrate/", __FILE__))
33
+ .migrate
34
+ else
35
+ ActiveRecord::Migrator.migrate(File.expand_path("../rails_app/db/migrate/", __FILE__))
36
+ end
31
37
 
32
38
  # Load support files
33
39
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
34
40
 
35
-
36
41
  class ActiveSupport::IntegrationCase
37
42
  def assert_has_content?(content)
38
43
  assert has_content?(content), "Expected #{page.body} to include #{content.inspect}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: derailed_benchmarks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-11 00:00:00.000000000 Z
11
+ date: 2019-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: heapy
@@ -128,6 +128,20 @@ dependencies:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
130
  version: '2'
131
+ - !ruby/object:Gem::Dependency
132
+ name: m
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: rails
133
147
  requirement: !ruby/object:Gem::Requirement
@@ -135,7 +149,7 @@ dependencies:
135
149
  - - ">"
136
150
  - !ruby/object:Gem::Version
137
151
  version: '3'
138
- - - "<"
152
+ - - "<="
139
153
  - !ruby/object:Gem::Version
140
154
  version: '6'
141
155
  type: :development
@@ -145,7 +159,7 @@ dependencies:
145
159
  - - ">"
146
160
  - !ruby/object:Gem::Version
147
161
  version: '3'
148
- - - "<"
162
+ - - "<="
149
163
  - !ruby/object:Gem::Version
150
164
  version: '6'
151
165
  - !ruby/object:Gem::Dependency
@@ -200,12 +214,9 @@ files:
200
214
  - bin/derailed
201
215
  - derailed_benchmarks.gemspec
202
216
  - gemfiles/.bundle/config
203
- - gemfiles/rails_3_2.gemfile
204
- - gemfiles/rails_4_0.gemfile
205
- - gemfiles/rails_4_1.gemfile
206
- - gemfiles/rails_4_2.gemfile
207
- - gemfiles/rails_5_0.gemfile
208
217
  - gemfiles/rails_5_1.gemfile
218
+ - gemfiles/rails_5_2.gemfile
219
+ - gemfiles/rails_6_0.gemfile
209
220
  - lib/derailed_benchmarks.rb
210
221
  - lib/derailed_benchmarks/auth_helper.rb
211
222
  - lib/derailed_benchmarks/auth_helpers/devise.rb
@@ -288,8 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
299
  - !ruby/object:Gem::Version
289
300
  version: '0'
290
301
  requirements: []
291
- rubyforge_project:
292
- rubygems_version: 2.7.6
302
+ rubygems_version: 3.0.3
293
303
  signing_key:
294
304
  specification_version: 4
295
305
  summary: Benchmarks designed to performance test your ENTIRE site
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 4.1.0"
6
-
7
- group :development, :test do
8
- gem "sqlite3", platform: [:ruby, :mswin, :mingw]
9
- gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.13", platform: :jruby
10
- gem "test-unit", "~> 3.0"
11
- end
12
-
13
- gemspec path: "../"
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 4.2.0"
6
-
7
- group :development, :test do
8
- gem "sqlite3", platform: [:ruby, :mswin, :mingw]
9
- gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.13", platform: :jruby
10
- gem "test-unit", "~> 3.0"
11
- end
12
-
13
- gemspec path: "../"
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 5.0.0"
6
-
7
- group :development, :test do
8
- gem "sqlite3", platform: [:ruby, :mswin, :mingw]
9
- gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.13", platform: :jruby
10
- gem "test-unit", "~> 3.0"
11
- end
12
-
13
- gemspec path: "../"