Skip to content

Improve Elastic files

Arturo Herrero requested to merge improve-elastic-files into master

Description

This is a small improvement following up on !168671 (merged) and !168767 (merged). I try to improve a file every time I touch it.

  • Fix Rubocop offense
  • Improve RSpec factories usage

Before

[TEST PROF INFO] Time spent in factories: 00:04.392 (23.09% of total time)
[TEST PROF INFO] Factories usage

 Total: 102
 Total top-level: 49
 Total time: 00:04.392 (out of 00:19.736)
 Total uniq factories: 14

   name                    total   top-level     total time      time per call      top-level time

   user                       21           7        0.9993s            0.0476s             0.6018s
   project                    16          16        2.5122s            0.1570s             2.5122s
   namespace_settings         13           0        0.0567s            0.0044s             0.0000s
   group                      13          13        0.9715s            0.0747s             0.9715s
   namespace_ci_cd_settings       13           0        0.0362s            0.0028s             0.0000s
   organization               11           0        0.0817s            0.0074s             0.0000s
   label                       5           5        0.0790s            0.0158s             0.0790s
   admin                       3           3        0.0753s            0.0251s             0.0753s
   namespace                   2           0        0.1380s            0.0690s             0.0000s
   group_label                 1           1        0.0094s            0.0094s             0.0094s
   project_group_link          1           1        0.0386s            0.0386s             0.0386s
   member_role                 1           1        0.0174s            0.0174s             0.0174s
   group_member                1           1        0.0648s            0.0648s             0.0648s
   license                     1           1        0.0226s            0.0226s             0.0226s

After

[TEST PROF INFO] Time spent in factories: 00:04.342 (20.79% of total time)
[TEST PROF INFO] Factories usage

 Total: 98
 Total top-level: 45
 Total time: 00:04.342 (out of 00:21.579)
 Total uniq factories: 14

   name                    total   top-level     total time      time per call      top-level time

   user                       19           5        1.1879s            0.0625s             0.5455s
   project                    16          16        2.6256s            0.1641s             2.6256s
   group                      13          13        0.9226s            0.0710s             0.9226s
   namespace_settings         13           0        0.0593s            0.0046s             0.0000s
   namespace_ci_cd_settings       13           0        0.0375s            0.0029s             0.0000s
   organization               11           0        0.0768s            0.0070s             0.0000s
   admin                       3           3        0.0797s            0.0266s             0.0797s
   label                       3           3        0.0347s            0.0116s             0.0347s
   namespace                   2           0        0.1284s            0.0642s             0.0000s
   group_label                 1           1        0.0070s            0.0070s             0.0070s
   project_group_link          1           1        0.0248s            0.0248s             0.0248s
   member_role                 1           1        0.0157s            0.0157s             0.0157s
   group_member                1           1        0.0709s            0.0709s             0.0709s
   license                     1           1        0.0162s            0.0162s             0.0162s

Merge request reports

Loading