This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chance Feick
authored
Mar 20, 2017
1 parent
4dd5d14
commit 04d3f5e
Showing
2 changed files
with
64 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require 'test_helper' | ||
|
||
module Librato | ||
class Rack | ||
class ValidatingQueueTest < Minitest::Test | ||
def setup | ||
@queue = ValidatingQueue.new | ||
end | ||
|
||
def test_valid_metric_name_tag_name_tag_value | ||
@queue.add valid_metric_name: { | ||
value: rand(100), | ||
tags: { valid_tag_name: 'valid_tag_value' } | ||
} | ||
@queue.validate_measurements | ||
refute_empty @queue.queued[:measurements] | ||
end | ||
|
||
def test_valid_tag_value_with_whitespace | ||
@queue.add valid_metric_name: { | ||
value: rand(100), | ||
tags: { valid_tag_name: 'valid tag value' } | ||
} | ||
@queue.validate_measurements | ||
refute_empty @queue.queued[:measurements] | ||
end | ||
|
||
def test_invalid_metric_name | ||
@queue.add 'invalid metric name' => { | ||
value: rand(100), | ||
tags: { valid_tag_name: 'valid_tag_value' } | ||
} | ||
@queue.validate_measurements | ||
assert_empty @queue.queued[:measurements] | ||
end | ||
|
||
def test_invalid_tag_name | ||
@queue.add valid_metric_name: { | ||
value: rand(100), | ||
tags: { 'invalid_tag_name!' => 'valid_tag_value' } | ||
} | ||
@queue.validate_measurements | ||
assert_empty @queue.queued[:measurements] | ||
end | ||
|
||
def test_invalid_tag_value | ||
@queue.add valid_metric_name: { | ||
value: rand(100), | ||
tags: { valid_tag_name: 'invalid_tag_value!' } | ||
} | ||
@queue.validate_measurements | ||
assert_empty @queue.queued[:measurements] | ||
end | ||
end | ||
end | ||
end |