summaryrefslogtreecommitdiff
path: root/osprofiler/tests
diff options
context:
space:
mode:
authorShoham Peller <shohamp@gmail.com>2018-10-02 17:20:13 +0300
committerShoham Peller <shohamp@gmail.com>2018-10-09 07:37:11 +0300
commit1a18d0f9449ef88db69d1f26b303da08bfc3650b (patch)
tree32d62605f33fb2e904589c8b8d0a5631e3a62b9b /osprofiler/tests
parent2b4786b5cc819c5d321d97e3cf9e1d5f24ebdb97 (diff)
downloadosprofiler-1a18d0f9449ef88db69d1f26b303da08bfc3650b.tar.gz
When shortening span-ids, check if they're already short
If you're given an int, there's nothing to do, just return it Change-Id: I289dab8cfabaecf243fdc16b972695e83c83c3e4 Closes-Bug: 1795664 Signed-off-by: Shoham Peller <shohamp@gmail.com>
Diffstat (limited to 'osprofiler/tests')
-rw-r--r--osprofiler/tests/unit/test_profiler.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/osprofiler/tests/unit/test_profiler.py b/osprofiler/tests/unit/test_profiler.py
index 1bd4b3f..00dcd0f 100644
--- a/osprofiler/tests/unit/test_profiler.py
+++ b/osprofiler/tests/unit/test_profiler.py
@@ -69,6 +69,13 @@ class ProfilerTestCase(test.TestCase):
expected = "850409eb1d4b0dee"
self.assertEqual(expected, result)
+ def test_profiler_get_shorten_id_int(self):
+ short_id_int = 42
+ prof = profiler._Profiler("secret", base_id="1", parent_id="2")
+ result = prof.get_shorten_id(short_id_int)
+ expected = "2a"
+ self.assertEqual(expected, result)
+
def test_profiler_get_base_id(self):
prof = profiler._Profiler("secret", base_id="1", parent_id="2")
self.assertEqual(prof.get_base_id(), "1")