Commit 16414139ef0d6c4840dc0451d55c0689501ca0a3
1 parent
41474777
Exists in
web_steps_improvements
and in
6 other branches
Share non linear performance factor and avoid CI failures
Showing
6 changed files
with
30 additions
and
68 deletions
Show diff stats
plugins/people_block/test/unit/friends_block_test.rb
| ... | ... | @@ -154,22 +154,6 @@ class FriendsBlockViewTest < ActionView::TestCase |
| 154 | 154 | assert_tag_in_string render_block_footer(block), tag: 'a', attributes: {class: 'view-all', href: '/profile/mytestperson/friends' } |
| 155 | 155 | end |
| 156 | 156 | |
| 157 | - FACTOR = 1.8 | |
| 158 | - | |
| 159 | - # Testing blog page display. It should not present a linear increase in time | |
| 160 | - # needed to display a blog page with the increase in number of posts. | |
| 161 | - # | |
| 162 | - # GOOD BAD | |
| 163 | - # | |
| 164 | - # ^ ^ / | |
| 165 | - # | | / | |
| 166 | - # | _____ | / | |
| 167 | - # | / | / | |
| 168 | - # | / | / | |
| 169 | - # |/ |/ | |
| 170 | - # +---------> +---------> | |
| 171 | - # 0 50 100 0 50 100 | |
| 172 | - # | |
| 173 | 157 | should 'not have a linear increase in time to display friends block' do |
| 174 | 158 | owner = fast_create(Person) |
| 175 | 159 | owner.boxes<< Box.new |
| ... | ... | @@ -205,7 +189,7 @@ class FriendsBlockViewTest < ActionView::TestCase |
| 205 | 189 | # the inclination of the second segment. |
| 206 | 190 | a1 = (time1.total - time0.total)/50.0 |
| 207 | 191 | a2 = (time2.total - time1.total)/50.0 |
| 208 | - assert a1 > a2*FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{FACTOR}" | |
| 192 | + assert a1 > a2*NON_LINEAR_FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{NON_LINEAR_FACTOR}" | |
| 209 | 193 | end |
| 210 | 194 | |
| 211 | 195 | end | ... | ... |
plugins/people_block/test/unit/members_block_test.rb
| ... | ... | @@ -307,22 +307,6 @@ class MembersBlockViewTest < ActionView::TestCase |
| 307 | 307 | end |
| 308 | 308 | end |
| 309 | 309 | |
| 310 | - FACTOR = 1.8 | |
| 311 | - | |
| 312 | - # Testing blog page display. It should not present a linear increase in time | |
| 313 | - # needed to display a blog page with the increase in number of posts. | |
| 314 | - # | |
| 315 | - # GOOD BAD | |
| 316 | - # | |
| 317 | - # ^ ^ / | |
| 318 | - # | | / | |
| 319 | - # | _____ | / | |
| 320 | - # | / | / | |
| 321 | - # | / | / | |
| 322 | - # |/ |/ | |
| 323 | - # +---------> +---------> | |
| 324 | - # 0 50 100 0 50 100 | |
| 325 | - # | |
| 326 | 310 | should 'not have a linear increase in time to display members block' do |
| 327 | 311 | owner = fast_create(Community) |
| 328 | 312 | owner.boxes<< Box.new |
| ... | ... | @@ -359,7 +343,7 @@ class MembersBlockViewTest < ActionView::TestCase |
| 359 | 343 | # the inclination of the second segment. |
| 360 | 344 | a1 = (time1.total - time0.total)/50.0 |
| 361 | 345 | a2 = (time2.total - time1.total)/50.0 |
| 362 | - assert a1 > a2*FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{FACTOR}" | |
| 346 | + assert a1 > a2*NON_LINEAR_FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{NON_LINEAR_FACTOR}" | |
| 363 | 347 | end |
| 364 | 348 | |
| 365 | 349 | end | ... | ... |
plugins/people_block/test/unit/people_block_test.rb
| ... | ... | @@ -146,22 +146,6 @@ class PeopleBlockViewTest < ActionView::TestCase |
| 146 | 146 | end |
| 147 | 147 | end |
| 148 | 148 | |
| 149 | - FACTOR = 1.8 | |
| 150 | - | |
| 151 | - # Testing blog page display. It should not present a linear increase in time | |
| 152 | - # needed to display a blog page with the increase in number of posts. | |
| 153 | - # | |
| 154 | - # GOOD BAD | |
| 155 | - # | |
| 156 | - # ^ ^ / | |
| 157 | - # | | / | |
| 158 | - # | _____ | / | |
| 159 | - # | / | / | |
| 160 | - # | / | / | |
| 161 | - # |/ |/ | |
| 162 | - # +---------> +---------> | |
| 163 | - # 0 50 100 0 50 100 | |
| 164 | - # | |
| 165 | 149 | should 'not have a linear increase in time to display people block' do |
| 166 | 150 | owner = fast_create(Environment) |
| 167 | 151 | owner.boxes<< Box.new |
| ... | ... | @@ -195,7 +179,7 @@ class PeopleBlockViewTest < ActionView::TestCase |
| 195 | 179 | # the inclination of the second segment. |
| 196 | 180 | a1 = (time1.total - time0.total)/50.0 |
| 197 | 181 | a2 = (time2.total - time1.total)/50.0 |
| 198 | - assert a1 > a2*FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{FACTOR}" | |
| 182 | + assert a1 > a2*NON_LINEAR_FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{NON_LINEAR_FACTOR}" | |
| 199 | 183 | end |
| 200 | 184 | |
| 201 | 185 | end | ... | ... |
test/integration/performance_test.rb
| ... | ... | @@ -5,22 +5,6 @@ class PerformanceTest < ActionDispatch::IntegrationTest |
| 5 | 5 | |
| 6 | 6 | all_fixtures |
| 7 | 7 | |
| 8 | - FACTOR = 1.8 | |
| 9 | - | |
| 10 | - # Testing blog page display. It should not present a linear increase in time | |
| 11 | - # needed to display a blog page with the increase in number of posts. | |
| 12 | - # | |
| 13 | - # GOOD BAD | |
| 14 | - # | |
| 15 | - # ^ ^ / | |
| 16 | - # | | / | |
| 17 | - # | _____ | / | |
| 18 | - # | / | / | |
| 19 | - # | / | / | |
| 20 | - # |/ |/ | |
| 21 | - # +---------> +---------> | |
| 22 | - # 0 50 100 0 50 100 | |
| 23 | - # | |
| 24 | 8 | should 'not have a linear increase in time to display a blog page' do |
| 25 | 9 | person = create_profile('clueless') |
| 26 | 10 | |
| ... | ... | @@ -50,7 +34,7 @@ class PerformanceTest < ActionDispatch::IntegrationTest |
| 50 | 34 | # the inclination of the second segment. |
| 51 | 35 | a1 = (time1.total - time0.total)/50.0 |
| 52 | 36 | a2 = (time2.total - time1.total)/50.0 |
| 53 | - assert a1 > a2*FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{FACTOR}" | |
| 37 | + assert a1 > a2*NON_LINEAR_FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{NON_LINEAR_FACTOR}" | |
| 54 | 38 | end |
| 55 | 39 | protected |
| 56 | 40 | ... | ... |
| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | +module PerformanceHelper | |
| 2 | + | |
| 3 | + # Testing blog page display. It should not present a linear increase in time | |
| 4 | + # needed to display a blog page with the increase in number of posts. | |
| 5 | + # | |
| 6 | + # GOOD BAD | |
| 7 | + # | |
| 8 | + # ^ ^ / | |
| 9 | + # | | / | |
| 10 | + # | _____ | / | |
| 11 | + # | / | / | |
| 12 | + # | / | / | |
| 13 | + # |/ |/ | |
| 14 | + # +---------> +---------> | |
| 15 | + # 0 50 100 0 50 100 | |
| 16 | + # | |
| 17 | + # On the travis/gitlab CI this can vary with servers' IO load, so | |
| 18 | + # we soften to avoid failures | |
| 19 | + # | |
| 20 | + NON_LINEAR_FACTOR = unless ENV['CI'] then 1.8 else 1.0 end | |
| 21 | + | |
| 22 | +end | |
| 23 | + | ... | ... |
test/test_helper.rb
| ... | ... | @@ -19,6 +19,7 @@ require_relative 'support/controller_test_case' |
| 19 | 19 | require_relative 'support/authenticated_test_helper' |
| 20 | 20 | require_relative 'support/action_tracker_test_helper' |
| 21 | 21 | require_relative 'support/noosfero_doc_test' |
| 22 | +require_relative 'support/performance_helper' | |
| 22 | 23 | require_relative 'support/noosfero_test_helper' |
| 23 | 24 | |
| 24 | 25 | FileUtils.rm_rf(Rails.root.join('index', 'test')) |
| ... | ... | @@ -60,6 +61,8 @@ class ActiveSupport::TestCase |
| 60 | 61 | |
| 61 | 62 | include AuthenticatedTestHelper |
| 62 | 63 | |
| 64 | + include PerformanceHelper | |
| 65 | + | |
| 63 | 66 | extend Test::Should |
| 64 | 67 | |
| 65 | 68 | fixtures :environments, :roles | ... | ... |