@@ -72,10 +72,6 @@ def setUp(self) -> None:
7272 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
7373 TEST_LOGGER_PATH ,
7474 )
75- @patch (
76- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
77- TEST_CUSTOMER_IKEY ,
78- )
7975 @patch (
8076 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
8177 TEST_EXTENSION_VERSION ,
@@ -88,15 +84,19 @@ def setUp(self) -> None:
8884 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
8985 True ,
9086 )
91- @patch (
92- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
93- return_value = TEST_PID ,
94- )
9587 @patch (
9688 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
9789 TEST_MACHINE_NAME ,
9890 )
99- def test_log_status_success (self , mock_getpid ):
91+ @patch (
92+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.get_customer_ikey" ,
93+ return_value = TEST_CUSTOMER_IKEY ,
94+ )
95+ @patch (
96+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
97+ return_value = TEST_PID ,
98+ )
99+ def test_log_status_success (self , mock_get_customer_ikey , mock_getpid ):
100100 AzureStatusLogger .log_status (False , MESSAGE1 )
101101 AzureStatusLogger .log_status (True , MESSAGE2 )
102102 check_file_for_messages (True , MESSAGE2 )
@@ -105,10 +105,6 @@ def test_log_status_success(self, mock_getpid):
105105 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
106106 TEST_LOGGER_PATH ,
107107 )
108- @patch (
109- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
110- TEST_CUSTOMER_IKEY ,
111- )
112108 @patch (
113109 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
114110 TEST_EXTENSION_VERSION ,
@@ -121,15 +117,19 @@ def test_log_status_success(self, mock_getpid):
121117 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
122118 True ,
123119 )
124- @patch (
125- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
126- return_value = TEST_PID ,
127- )
128120 @patch (
129121 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
130122 TEST_MACHINE_NAME ,
131123 )
132- def test_log_status_failed_initialization (self , mock_getpid ):
124+ @patch (
125+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.get_customer_ikey" ,
126+ return_value = TEST_CUSTOMER_IKEY ,
127+ )
128+ @patch (
129+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
130+ return_value = TEST_PID ,
131+ )
132+ def test_log_status_failed_initialization (self , mock_get_customer_ikey , mock_getpid ):
133133 AzureStatusLogger .log_status (True , MESSAGE1 )
134134 AzureStatusLogger .log_status (False , MESSAGE2 )
135135 check_file_for_messages (False , MESSAGE2 )
@@ -138,10 +138,6 @@ def test_log_status_failed_initialization(self, mock_getpid):
138138 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
139139 TEST_LOGGER_PATH ,
140140 )
141- @patch (
142- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
143- TEST_CUSTOMER_IKEY ,
144- )
145141 @patch (
146142 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
147143 TEST_EXTENSION_VERSION ,
@@ -154,15 +150,19 @@ def test_log_status_failed_initialization(self, mock_getpid):
154150 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
155151 True ,
156152 )
157- @patch (
158- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
159- return_value = TEST_PID ,
160- )
161153 @patch (
162154 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
163155 TEST_MACHINE_NAME ,
164156 )
165- def test_log_status_no_reason (self , mock_getpid ):
157+ @patch (
158+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.get_customer_ikey" ,
159+ return_value = TEST_CUSTOMER_IKEY ,
160+ )
161+ @patch (
162+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
163+ return_value = TEST_PID ,
164+ )
165+ def test_log_status_no_reason (self , mock_get_customer_ikey , mock_getpid ):
166166 AzureStatusLogger .log_status (False , MESSAGE1 )
167167 AzureStatusLogger .log_status (True )
168168 check_file_for_messages (True )
@@ -171,10 +171,6 @@ def test_log_status_no_reason(self, mock_getpid):
171171 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
172172 TEST_LOGGER_PATH ,
173173 )
174- @patch (
175- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
176- TEST_CUSTOMER_IKEY ,
177- )
178174 @patch (
179175 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
180176 TEST_EXTENSION_VERSION ,
@@ -187,15 +183,19 @@ def test_log_status_no_reason(self, mock_getpid):
187183 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
188184 False ,
189185 )
190- @patch (
191- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
192- return_value = TEST_PID ,
193- )
194186 @patch (
195187 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
196188 TEST_MACHINE_NAME ,
197189 )
198- def test_disabled_log_status_success (self , mock_getpid ):
190+ @patch (
191+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.get_customer_ikey" ,
192+ return_value = TEST_CUSTOMER_IKEY ,
193+ )
194+ @patch (
195+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
196+ return_value = TEST_PID ,
197+ )
198+ def test_disabled_log_status_success (self , mock_get_customer_ikey , mock_getpid ):
199199 AzureStatusLogger .log_status (False , MESSAGE1 )
200200 AzureStatusLogger .log_status (True , MESSAGE2 )
201201 check_file_is_empty ()
@@ -204,10 +204,6 @@ def test_disabled_log_status_success(self, mock_getpid):
204204 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
205205 TEST_LOGGER_PATH ,
206206 )
207- @patch (
208- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
209- TEST_CUSTOMER_IKEY ,
210- )
211207 @patch (
212208 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
213209 TEST_EXTENSION_VERSION ,
@@ -220,15 +216,19 @@ def test_disabled_log_status_success(self, mock_getpid):
220216 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
221217 False ,
222218 )
223- @patch (
224- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
225- return_value = TEST_PID ,
226- )
227219 @patch (
228220 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
229221 TEST_MACHINE_NAME ,
230222 )
231- def test_disabled_log_status_failed_initialization (self , mock_getpid ):
223+ @patch (
224+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.get_customer_ikey" ,
225+ return_value = TEST_CUSTOMER_IKEY ,
226+ )
227+ @patch (
228+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
229+ return_value = TEST_PID ,
230+ )
231+ def test_disabled_log_status_failed_initialization (self , mock_get_customer_ikey , mock_getpid ):
232232 AzureStatusLogger .log_status (True , MESSAGE1 )
233233 AzureStatusLogger .log_status (False , MESSAGE2 )
234234 check_file_is_empty ()
@@ -237,10 +237,6 @@ def test_disabled_log_status_failed_initialization(self, mock_getpid):
237237 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
238238 TEST_LOGGER_PATH ,
239239 )
240- @patch (
241- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
242- TEST_CUSTOMER_IKEY ,
243- )
244240 @patch (
245241 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
246242 TEST_EXTENSION_VERSION ,
@@ -253,15 +249,19 @@ def test_disabled_log_status_failed_initialization(self, mock_getpid):
253249 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
254250 False ,
255251 )
256- @patch (
257- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
258- return_value = TEST_PID ,
259- )
260252 @patch (
261253 "azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
262254 TEST_MACHINE_NAME ,
263255 )
264- def test_disabled_log_status_no_reason (self , mock_getpid ):
256+ @patch (
257+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.get_customer_ikey" ,
258+ return_value = TEST_CUSTOMER_IKEY ,
259+ )
260+ @patch (
261+ "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
262+ return_value = TEST_PID ,
263+ )
264+ def test_disabled_log_status_no_reason (self , mock_get_customer_ikey , mock_getpid ):
265265 AzureStatusLogger .log_status (False , MESSAGE1 )
266266 AzureStatusLogger .log_status (True )
267267 check_file_is_empty ()
0 commit comments