Require a needed dependency in LazyHeatMap class
Context
Closes #1426 (closed)
What does this MR do and why?
Require a needed dependency
The lazy_heat_map file uses a class from gitlab-triage, but it doesn't require it explicitly. This breaks the specs for this class when run in isolation.
This commit ensures we require the class that is used in the LazyHeatMap class.
Does it work?
master
branch
From You'll also need to remove require 'gitlab/triage/engine'
from the spec_helper.rb
file.
Command
$ be rspec spec/lib/lazy_heat_map_spec.rb
Output
Click to expand
Randomized with seed 25686
[...]
Failures:
1) LazyHeatMap#generate_heat_map_table_stuck when no milestones are set renders the table with the correct link
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:84:in `block (2 levels) in generate_heat_map_table_stuck'
# ./lib/lazy_heat_map.rb:82:in `each'
# ./lib/lazy_heat_map.rb:82:in `map'
# ./lib/lazy_heat_map.rb:82:in `block in generate_heat_map_table_stuck'
# ./lib/lazy_heat_map.rb:80:in `each'
# ./lib/lazy_heat_map.rb:80:in `map'
# ./lib/lazy_heat_map.rb:80:in `generate_heat_map_table_stuck'
# ./spec/lib/lazy_heat_map_spec.rb:161:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:204:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
2) LazyHeatMap#generate_heat_map_table_stuck when an assignee is not set renders the table with the correct link
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:84:in `block (2 levels) in generate_heat_map_table_stuck'
# ./lib/lazy_heat_map.rb:82:in `each'
# ./lib/lazy_heat_map.rb:82:in `map'
# ./lib/lazy_heat_map.rb:82:in `block in generate_heat_map_table_stuck'
# ./lib/lazy_heat_map.rb:80:in `each'
# ./lib/lazy_heat_map.rb:80:in `map'
# ./lib/lazy_heat_map.rb:80:in `generate_heat_map_table_stuck'
# ./spec/lib/lazy_heat_map_spec.rb:161:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:183:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
3) LazyHeatMap#generate_heat_map_table_stuck when the milestone is in the past renders the table with the correct link
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:84:in `block (2 levels) in generate_heat_map_table_stuck'
# ./lib/lazy_heat_map.rb:82:in `each'
# ./lib/lazy_heat_map.rb:82:in `map'
# ./lib/lazy_heat_map.rb:82:in `block in generate_heat_map_table_stuck'
# ./lib/lazy_heat_map.rb:80:in `each'
# ./lib/lazy_heat_map.rb:80:in `map'
# ./lib/lazy_heat_map.rb:80:in `generate_heat_map_table_stuck'
# ./spec/lib/lazy_heat_map_spec.rb:161:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:246:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
4) LazyHeatMap#generate_heat_map_table_stuck when the milestone is Backlog renders the table with the correct link
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:84:in `block (2 levels) in generate_heat_map_table_stuck'
# ./lib/lazy_heat_map.rb:82:in `each'
# ./lib/lazy_heat_map.rb:82:in `map'
# ./lib/lazy_heat_map.rb:82:in `block in generate_heat_map_table_stuck'
# ./lib/lazy_heat_map.rb:80:in `each'
# ./lib/lazy_heat_map.rb:80:in `map'
# ./lib/lazy_heat_map.rb:80:in `generate_heat_map_table_stuck'
# ./spec/lib/lazy_heat_map_spec.rb:161:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:225:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
5) LazyHeatMap#generate_heat_map_table generates the heatmap
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:43:in `block (2 levels) in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:41:in `map'
# ./lib/lazy_heat_map.rb:41:in `block in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:39:in `each_key'
# ./lib/lazy_heat_map.rb:39:in `each'
# ./lib/lazy_heat_map.rb:39:in `map'
# ./lib/lazy_heat_map.rb:39:in `generate_heat_map_table'
# ./spec/lib/lazy_heat_map_spec.rb:50:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:59:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
6) LazyHeatMap#generate_heat_map_table when all of resources have priorities and severities still shows No priorities/severities columns
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:43:in `block (2 levels) in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:41:in `map'
# ./lib/lazy_heat_map.rb:41:in `block in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:39:in `each_key'
# ./lib/lazy_heat_map.rb:39:in `each'
# ./lib/lazy_heat_map.rb:39:in `map'
# ./lib/lazy_heat_map.rb:39:in `generate_heat_map_table'
# ./spec/lib/lazy_heat_map_spec.rb:50:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:84:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
7) LazyHeatMap#generate_heat_map_table when for a project url contains project path
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:43:in `block (2 levels) in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:41:in `map'
# ./lib/lazy_heat_map.rb:41:in `block in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:39:in `each_key'
# ./lib/lazy_heat_map.rb:39:in `each'
# ./lib/lazy_heat_map.rb:39:in `map'
# ./lib/lazy_heat_map.rb:39:in `generate_heat_map_table'
# ./spec/lib/lazy_heat_map_spec.rb:50:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:98:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
8) LazyHeatMap#generate_heat_map_table when for a project when for a numeric project ID url contains project path
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:43:in `block (2 levels) in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:41:in `map'
# ./lib/lazy_heat_map.rb:41:in `block in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:39:in `each_key'
# ./lib/lazy_heat_map.rb:39:in `each'
# ./lib/lazy_heat_map.rb:39:in `map'
# ./lib/lazy_heat_map.rb:39:in `generate_heat_map_table'
# ./spec/lib/lazy_heat_map_spec.rb:50:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:108:in `block (5 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
9) LazyHeatMap#generate_heat_map_table when for a project when for a subgroup project url contains project path
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:43:in `block (2 levels) in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:41:in `map'
# ./lib/lazy_heat_map.rb:41:in `block in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:39:in `each_key'
# ./lib/lazy_heat_map.rb:39:in `each'
# ./lib/lazy_heat_map.rb:39:in `map'
# ./lib/lazy_heat_map.rb:39:in `generate_heat_map_table'
# ./spec/lib/lazy_heat_map_spec.rb:50:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:116:in `block (5 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
10) LazyHeatMap#generate_heat_map_table when for a group url contains group path
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:43:in `block (2 levels) in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:41:in `map'
# ./lib/lazy_heat_map.rb:41:in `block in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:39:in `each_key'
# ./lib/lazy_heat_map.rb:39:in `each'
# ./lib/lazy_heat_map.rb:39:in `map'
# ./lib/lazy_heat_map.rb:39:in `generate_heat_map_table'
# ./spec/lib/lazy_heat_map_spec.rb:50:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:136:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
11) LazyHeatMap#generate_heat_map_table when for a group when for a numeric group ID url contains group path
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:43:in `block (2 levels) in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:41:in `map'
# ./lib/lazy_heat_map.rb:41:in `block in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:39:in `each_key'
# ./lib/lazy_heat_map.rb:39:in `each'
# ./lib/lazy_heat_map.rb:39:in `map'
# ./lib/lazy_heat_map.rb:39:in `generate_heat_map_table'
# ./spec/lib/lazy_heat_map_spec.rb:50:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:146:in `block (5 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
12) LazyHeatMap#generate_heat_map_table when for a group when for a subgroup group url contains project path
Failure/Error:
context = Gitlab::Triage::Resource::Context.build(
resource, network: @network)
NameError:
uninitialized constant Gitlab::Triage
# ./lib/lazy_heat_map.rb:202:in `source_url_for_resource'
# ./lib/lazy_heat_map.rb:137:in `issues_base_url'
# ./lib/lazy_heat_map.rb:127:in `issues_link'
# ./lib/lazy_heat_map.rb:43:in `block (2 levels) in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:41:in `map'
# ./lib/lazy_heat_map.rb:41:in `block in generate_heat_map_table'
# ./lib/lazy_heat_map.rb:39:in `each_key'
# ./lib/lazy_heat_map.rb:39:in `each'
# ./lib/lazy_heat_map.rb:39:in `map'
# ./lib/lazy_heat_map.rb:39:in `generate_heat_map_table'
# ./spec/lib/lazy_heat_map_spec.rb:50:in `block (3 levels) in <top (required)>'
# ./spec/lib/lazy_heat_map_spec.rb:154:in `block (5 levels) in <top (required)>'
# ./spec/spec_helper.rb:219:in `block (2 levels) in <top (required)>'
Finished in 0.03556 seconds (files took 0.57447 seconds to load)
12 examples, 12 failures
Failed examples:
rspec ./spec/lib/lazy_heat_map_spec.rb:203 # LazyHeatMap#generate_heat_map_table_stuck when no milestones are set renders the table with the correct link
rspec ./spec/lib/lazy_heat_map_spec.rb:182 # LazyHeatMap#generate_heat_map_table_stuck when an assignee is not set renders the table with the correct link
rspec ./spec/lib/lazy_heat_map_spec.rb:245 # LazyHeatMap#generate_heat_map_table_stuck when the milestone is in the past renders the table with the correct link
rspec ./spec/lib/lazy_heat_map_spec.rb:224 # LazyHeatMap#generate_heat_map_table_stuck when the milestone is Backlog renders the table with the correct link
rspec ./spec/lib/lazy_heat_map_spec.rb:52 # LazyHeatMap#generate_heat_map_table generates the heatmap
rspec ./spec/lib/lazy_heat_map_spec.rb:81 # LazyHeatMap#generate_heat_map_table when all of resources have priorities and severities still shows No priorities/severities columns
rspec ./spec/lib/lazy_heat_map_spec.rb:97 # LazyHeatMap#generate_heat_map_table when for a project url contains project path
rspec ./spec/lib/lazy_heat_map_spec.rb:107 # LazyHeatMap#generate_heat_map_table when for a project when for a numeric project ID url contains project path
rspec ./spec/lib/lazy_heat_map_spec.rb:115 # LazyHeatMap#generate_heat_map_table when for a project when for a subgroup project url contains project path
rspec ./spec/lib/lazy_heat_map_spec.rb:135 # LazyHeatMap#generate_heat_map_table when for a group url contains group path
rspec ./spec/lib/lazy_heat_map_spec.rb:145 # LazyHeatMap#generate_heat_map_table when for a group when for a numeric group ID url contains group path
rspec ./spec/lib/lazy_heat_map_spec.rb:153 # LazyHeatMap#generate_heat_map_table when for a group when for a subgroup group url contains project path
From this branch
Command
$ be rspec spec/lib/lazy_heat_map_spec.rb
Output
Click to expand
$ be rspec spec/lib/lazy_heat_map_spec.rb
Randomized with seed 45562
LazyHeatMap
#generate_heat_map_table
generates the heatmap
when for a group
url contains group path
when for a subgroup group
url contains project path
when for a numeric group ID
url contains group path
when for a project
url contains project path
when for a numeric project ID
url contains project path
when for a subgroup project
url contains project path
when all of resources have priorities and severities
still shows No priorities/severities columns
#generate_heat_map_table_stuck
when an assignee is not set
renders the table with the correct link
when the milestone is in the past
renders the table with the correct link
when the milestone is Backlog
renders the table with the correct link
when no milestones are set
renders the table with the correct link
Top 10 slowest examples (0.01668 seconds, 68.1% of total time):
LazyHeatMap#generate_heat_map_table generates the heatmap
0.00468 seconds ./spec/lib/lazy_heat_map_spec.rb:52
LazyHeatMap#generate_heat_map_table when for a group url contains group path
0.00206 seconds ./spec/lib/lazy_heat_map_spec.rb:135
LazyHeatMap#generate_heat_map_table when for a project url contains project path
0.00181 seconds ./spec/lib/lazy_heat_map_spec.rb:97
LazyHeatMap#generate_heat_map_table when for a project when for a numeric project ID url contains project path
0.00144 seconds ./spec/lib/lazy_heat_map_spec.rb:107
LazyHeatMap#generate_heat_map_table when for a project when for a subgroup project url contains project path
0.0014 seconds ./spec/lib/lazy_heat_map_spec.rb:115
LazyHeatMap#generate_heat_map_table when all of resources have priorities and severities still shows No priorities/severities columns
0.00129 seconds ./spec/lib/lazy_heat_map_spec.rb:81
LazyHeatMap#generate_heat_map_table when for a group when for a subgroup group url contains project path
0.00106 seconds ./spec/lib/lazy_heat_map_spec.rb:153
LazyHeatMap#generate_heat_map_table_stuck when an assignee is not set renders the table with the correct link
0.00104 seconds ./spec/lib/lazy_heat_map_spec.rb:182
LazyHeatMap#generate_heat_map_table when for a group when for a numeric group ID url contains group path
0.001 seconds ./spec/lib/lazy_heat_map_spec.rb:145
LazyHeatMap#generate_heat_map_table_stuck when the milestone is in the past renders the table with the correct link
0.00089 seconds ./spec/lib/lazy_heat_map_spec.rb:245
Finished in 0.02448 seconds (files took 0.86878 seconds to load)
12 examples, 0 failures
Action items
-
If adding environment variables for reactive processors, update config/triage-web.yaml
and.gitlab/ci/triage-web.yml
-
(If applicable) Add documentation to the handbook pages for Triage Operations => - (If applicable) Identify the affected groups and how to communicate to them:
-
/cc @ person_or_group
=> -
Relevant Slack channels => -
Engineering week-in-review
-