@@ -32,13 +32,14 @@ def setUp(self):
32
32
33
33
@parameterized .parameters (8000 , 1234 )
34
34
def test_collect_profile_port (self , port ):
35
- profiling .collect_profile (
35
+ result = profiling .collect_profile (
36
36
port = port ,
37
37
duration_ms = 1000 ,
38
38
host = "127.0.0.1" ,
39
39
log_dir = "gs://test_bucket/test_dir" ,
40
40
)
41
41
42
+ self .assertTrue (result )
42
43
self .mock_post .assert_called_once_with (
43
44
f"http://127.0.0.1:{ port } /profiling" ,
44
45
json = {
@@ -49,13 +50,14 @@ def test_collect_profile_port(self, port):
49
50
50
51
@parameterized .parameters (1000 , 1234 )
51
52
def test_collect_profile_duration_ms (self , duration_ms ):
52
- profiling .collect_profile (
53
+ result = profiling .collect_profile (
53
54
port = 8000 ,
54
55
duration_ms = duration_ms ,
55
56
host = "127.0.0.1" ,
56
57
log_dir = "gs://test_bucket/test_dir" ,
57
58
)
58
59
60
+ self .assertTrue (result )
59
61
self .mock_post .assert_called_once_with (
60
62
"http://127.0.0.1:8000/profiling" ,
61
63
json = {
@@ -66,13 +68,14 @@ def test_collect_profile_duration_ms(self, duration_ms):
66
68
67
69
@parameterized .parameters ("127.0.0.1" , "localhost" , "192.168.1.1" )
68
70
def test_collect_profile_host (self , host ):
69
- profiling .collect_profile (
71
+ result = profiling .collect_profile (
70
72
port = 8000 ,
71
73
duration_ms = 1000 ,
72
74
host = host ,
73
75
log_dir = "gs://test_bucket/test_dir" ,
74
76
)
75
77
78
+ self .assertTrue (result )
76
79
self .mock_post .assert_called_once_with (
77
80
f"http://{ host } :8000/profiling" ,
78
81
json = {
@@ -87,10 +90,11 @@ def test_collect_profile_host(self, host):
87
90
"gs://test_bucket3/test/log/dir" ,
88
91
)
89
92
def test_collect_profile_log_dir (self , log_dir ):
90
- profiling .collect_profile (
93
+ result = profiling .collect_profile (
91
94
port = 8000 , duration_ms = 1000 , host = "127.0.0.1" , log_dir = log_dir
92
95
)
93
96
97
+ self .assertTrue (result )
94
98
self .mock_post .assert_called_once_with (
95
99
"http://127.0.0.1:8000/profiling" ,
96
100
json = {
@@ -102,7 +106,7 @@ def test_collect_profile_log_dir(self, log_dir):
102
106
@parameterized .parameters ("/logs/test_log_dir" , "relative_path/my_log_dir" )
103
107
def test_collect_profile_log_dir_error (self , log_dir ):
104
108
with self .assertRaises (ValueError ):
105
- profiling .collect_profile (
109
+ result = profiling .collect_profile (
106
110
port = 8000 , duration_ms = 1000 , host = "127.0.0.1" , log_dir = log_dir
107
111
)
108
112
0 commit comments