Skip to content
代码片段 群组 项目
未验证 提交 e94b26c8 编辑于 作者: Anton Smith's avatar Anton Smith 提交者: GitLab
浏览文件

Fix broken schema path

The schema path on an Omnibus GitLab instance can be incorrect
causing a 500 error in the group analytics dashboard. This
change fixes that scenario by returning the path to the root
of the Rails application.

Changelog: fixed
EE: true
上级 9894379c
No related branches found
No related tags found
无相关合并请求
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module ProductAnalytics module ProductAnalytics
module SchemaValidator module SchemaValidator
def schema_errors_for(yaml) def schema_errors_for(yaml)
validator = JSONSchemer.schema(Pathname.new(self.class::SCHEMA_PATH)) validator = JSONSchemer.schema(Pathname.new(Rails.root.join(self.class::SCHEMA_PATH)))
validator_errors = validator.validate(yaml) validator_errors = validator.validate(yaml)
validator_errors.map { |e| JSONSchemer::Errors.pretty(e) } if validator_errors.any? validator_errors.map { |e| JSONSchemer::Errors.pretty(e) } if validator_errors.any?
end end
......
...@@ -47,6 +47,17 @@ ...@@ -47,6 +47,17 @@
end end
end end
describe '#schema_errors_for' do
let(:dashboard) { dashboards.find { |d| d.title == 'Audience' } }
it 'fetches correct schema path' do
allow(JSONSchemer).to receive(:schema).and_call_original
expect(JSONSchemer).to receive(:schema).with(Rails.root.join(described_class::SCHEMA_PATH))
dashboard.panels.first.visualization
end
end
describe '.for' do describe '.for' do
context 'when resource_parent is a Project' do context 'when resource_parent is a Project' do
subject { described_class.for(container: project, user: user) } subject { described_class.for(container: project, user: user) }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册