1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
"""Unit tests for buildscripts/mongosymb.py."""
import unittest
from buildscripts import mongosymb as under_test
class TestGetVersion(unittest.TestCase):
def test_get_version_with_patch(self):
trace_doc = {
"processInfo": {
"mongodbVersion": "6.0.0-alpha0-37-ge1d28c1-patch-6257e60a32f417196bc25169"
}
}
version = under_test.get_version(trace_doc)
self.assertEqual(version, "6.0.0-alpha0-37-ge1d28c1-patch-6257e60a32f417196bc25169")
def test_get_version_without_patch(self):
trace_doc = {"processInfo": {"mongodbVersion": "6.1.0-alpha-504-g0c8a142"}}
version = under_test.get_version(trace_doc)
self.assertEqual(version, "6.1.0-alpha-504-g0c8a142")
def test_get_version_no_mongodb_version(self):
trace_doc = {"processInfo": {}}
version = under_test.get_version(trace_doc)
self.assertEqual(version, None)
def test_get_version_no_process_info(self):
trace_doc = {}
version = under_test.get_version(trace_doc)
self.assertEqual(version, None)
class TestHasHighNotFoundPathsRatio(unittest.TestCase):
def test_not_found_paths_ratio_is_more_than_0_5(self):
frames = [
{"path": "some/path"},
{"path": "some/path"},
{"path": "some/path"},
{"path": None},
]
ret = under_test.has_high_not_found_paths_ratio(frames)
self.assertEqual(ret, False)
def test_not_found_paths_ratio_is_equal_to_0_5(self):
frames = [
{"path": "some/path"},
{"path": "some/path"},
{"path": None},
{"path": None},
]
ret = under_test.has_high_not_found_paths_ratio(frames)
self.assertEqual(ret, True)
def test_not_found_paths_ratio_is_less_than_0_5(self):
frames = [
{"path": "some/path"},
{"path": None},
{"path": None},
{"path": None},
]
ret = under_test.has_high_not_found_paths_ratio(frames)
self.assertEqual(ret, True)
def test_no_frames(self):
frames = []
ret = under_test.has_high_not_found_paths_ratio(frames)
self.assertEqual(ret, False)
|