-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NH-58499: move custom_metrics to api and add test
- Loading branch information
1 parent
efd50c4
commit 6bd9542
Showing
6 changed files
with
90 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright (c) 2023 SolarWinds, LLC. | ||
# All rights reserved. | ||
|
||
require 'minitest_helper' | ||
require 'minitest/mock' | ||
require './lib/solarwinds_apm/api' | ||
|
||
describe 'SolarWinds Custom Metrics Test' do | ||
it 'test_increment_metric_with_single_variable_with_successful_liboboe_metric_call' do | ||
SolarWindsAPM::CustomMetrics.stub(:increment, 0) do | ||
SolarWindsAPM::MetricTags.stub(:new, {}) do | ||
result = SolarWindsAPM::API.increment_metric('abc') | ||
_(result).must_equal true | ||
end | ||
end | ||
end | ||
|
||
it 'test_increment_metric_with_single_variable_with_failed_liboboe_metric_call' do | ||
SolarWindsAPM::CustomMetrics.stub(:increment, 1) do | ||
SolarWindsAPM::MetricTags.stub(:new, {}) do | ||
result = SolarWindsAPM::API.increment_metric('abc') | ||
_(result).must_equal false | ||
end | ||
end | ||
end | ||
|
||
it 'test_increment_metric_with_single_variable_with_success_variables' do | ||
SolarWindsAPM::CustomMetrics.stub(:increment, 0) do | ||
SolarWindsAPM::MetricTags.stub(:new, {}) do | ||
result = SolarWindsAPM::API.increment_metric('abc', 1, true, {}) | ||
_(result).must_equal true | ||
end | ||
end | ||
end | ||
|
||
it 'test_summary_metric_with_single_variable_with_success' do | ||
SolarWindsAPM::CustomMetrics.stub(:summary, 0) do | ||
SolarWindsAPM::MetricTags.stub(:new, {}) do | ||
result = SolarWindsAPM::API.summary_metric('abc', 1, true, {}) | ||
_(result).must_equal true | ||
end | ||
end | ||
end | ||
|
||
it 'test_summary_metric_with_single_variable_with_failure' do | ||
SolarWindsAPM::CustomMetrics.stub(:summary, 1) do | ||
SolarWindsAPM::MetricTags.stub(:new, {}) do | ||
result = SolarWindsAPM::API.summary_metric('abc', 1, true, {}) | ||
_(result).must_equal false | ||
end | ||
end | ||
end | ||
|
||
it 'test_summary_metric_with_single_variable_with_failure' do | ||
SolarWindsAPM::CustomMetrics.stub(:summary, 0) do | ||
SolarWindsAPM::MetricTags.stub(:new, {}) do | ||
result = SolarWindsAPM::API.summary_metric('abc', 7.7, 1, true, {} ) | ||
_(result).must_equal true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters