Commit 832824f4 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'alipniagov-fix-wiki_can_not_be_created_total-counter' into 'master'

Fix :wiki_can_not_be_created_total counter

See merge request gitlab-org/gitlab-ce!31673
parents 7a48b4d6 3c25e873
...@@ -122,7 +122,7 @@ module Projects ...@@ -122,7 +122,7 @@ module Projects
ProjectWiki.new(project, project.owner).wiki ProjectWiki.new(project, project.owner).wiki
rescue ProjectWiki::CouldNotCreateWikiError rescue ProjectWiki::CouldNotCreateWikiError
log_error("Could not create wiki for #{project.full_name}") log_error("Could not create wiki for #{project.full_name}")
Gitlab::Metrics.counter(:wiki_can_not_be_created_total, 'Counts the times we failed to create a wiki') Gitlab::Metrics.counter(:wiki_can_not_be_created_total, 'Counts the times we failed to create a wiki').increment
end end
def update_pages_config def update_pages_config
......
---
title: Fix :wiki_can_not_be_created_total counter
merge_request: 31673
author:
type: fixed
...@@ -186,7 +186,10 @@ describe Projects::UpdateService do ...@@ -186,7 +186,10 @@ describe Projects::UpdateService do
expect_any_instance_of(ProjectWiki).to receive(:wiki).and_raise(ProjectWiki::CouldNotCreateWikiError) expect_any_instance_of(ProjectWiki).to receive(:wiki).and_raise(ProjectWiki::CouldNotCreateWikiError)
expect_any_instance_of(described_class).to receive(:log_error).with("Could not create wiki for #{project.full_name}") expect_any_instance_of(described_class).to receive(:log_error).with("Could not create wiki for #{project.full_name}")
expect(Gitlab::Metrics).to receive(:counter)
counter = double(:counter)
expect(Gitlab::Metrics).to receive(:counter).with(:wiki_can_not_be_created_total, 'Counts the times we failed to create a wiki').and_return(counter)
expect(counter).to receive(:increment)
update_project(project, user, project_feature_attributes: { wiki_access_level: ProjectFeature::ENABLED }) update_project(project, user, project_feature_attributes: { wiki_access_level: ProjectFeature::ENABLED })
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment