@@ -72,10 +72,6 @@ def setUp(self) -> None:
72
72
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
73
73
TEST_LOGGER_PATH ,
74
74
)
75
- @patch (
76
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
77
- TEST_CUSTOMER_IKEY ,
78
- )
79
75
@patch (
80
76
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
81
77
TEST_EXTENSION_VERSION ,
@@ -88,15 +84,19 @@ def setUp(self) -> None:
88
84
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
89
85
True ,
90
86
)
91
- @patch (
92
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
93
- return_value = TEST_PID ,
94
- )
95
87
@patch (
96
88
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
97
89
TEST_MACHINE_NAME ,
98
90
)
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 ):
100
100
AzureStatusLogger .log_status (False , MESSAGE1 )
101
101
AzureStatusLogger .log_status (True , MESSAGE2 )
102
102
check_file_for_messages (True , MESSAGE2 )
@@ -105,10 +105,6 @@ def test_log_status_success(self, mock_getpid):
105
105
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
106
106
TEST_LOGGER_PATH ,
107
107
)
108
- @patch (
109
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
110
- TEST_CUSTOMER_IKEY ,
111
- )
112
108
@patch (
113
109
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
114
110
TEST_EXTENSION_VERSION ,
@@ -121,15 +117,19 @@ def test_log_status_success(self, mock_getpid):
121
117
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
122
118
True ,
123
119
)
124
- @patch (
125
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
126
- return_value = TEST_PID ,
127
- )
128
120
@patch (
129
121
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
130
122
TEST_MACHINE_NAME ,
131
123
)
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 ):
133
133
AzureStatusLogger .log_status (True , MESSAGE1 )
134
134
AzureStatusLogger .log_status (False , MESSAGE2 )
135
135
check_file_for_messages (False , MESSAGE2 )
@@ -138,10 +138,6 @@ def test_log_status_failed_initialization(self, mock_getpid):
138
138
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
139
139
TEST_LOGGER_PATH ,
140
140
)
141
- @patch (
142
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
143
- TEST_CUSTOMER_IKEY ,
144
- )
145
141
@patch (
146
142
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
147
143
TEST_EXTENSION_VERSION ,
@@ -154,15 +150,19 @@ def test_log_status_failed_initialization(self, mock_getpid):
154
150
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
155
151
True ,
156
152
)
157
- @patch (
158
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
159
- return_value = TEST_PID ,
160
- )
161
153
@patch (
162
154
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
163
155
TEST_MACHINE_NAME ,
164
156
)
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 ):
166
166
AzureStatusLogger .log_status (False , MESSAGE1 )
167
167
AzureStatusLogger .log_status (True )
168
168
check_file_for_messages (True )
@@ -171,10 +171,6 @@ def test_log_status_no_reason(self, mock_getpid):
171
171
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
172
172
TEST_LOGGER_PATH ,
173
173
)
174
- @patch (
175
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
176
- TEST_CUSTOMER_IKEY ,
177
- )
178
174
@patch (
179
175
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
180
176
TEST_EXTENSION_VERSION ,
@@ -187,15 +183,19 @@ def test_log_status_no_reason(self, mock_getpid):
187
183
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
188
184
False ,
189
185
)
190
- @patch (
191
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
192
- return_value = TEST_PID ,
193
- )
194
186
@patch (
195
187
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
196
188
TEST_MACHINE_NAME ,
197
189
)
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 ):
199
199
AzureStatusLogger .log_status (False , MESSAGE1 )
200
200
AzureStatusLogger .log_status (True , MESSAGE2 )
201
201
check_file_is_empty ()
@@ -204,10 +204,6 @@ def test_disabled_log_status_success(self, mock_getpid):
204
204
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
205
205
TEST_LOGGER_PATH ,
206
206
)
207
- @patch (
208
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
209
- TEST_CUSTOMER_IKEY ,
210
- )
211
207
@patch (
212
208
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
213
209
TEST_EXTENSION_VERSION ,
@@ -220,15 +216,19 @@ def test_disabled_log_status_success(self, mock_getpid):
220
216
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
221
217
False ,
222
218
)
223
- @patch (
224
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
225
- return_value = TEST_PID ,
226
- )
227
219
@patch (
228
220
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
229
221
TEST_MACHINE_NAME ,
230
222
)
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 ):
232
232
AzureStatusLogger .log_status (True , MESSAGE1 )
233
233
AzureStatusLogger .log_status (False , MESSAGE2 )
234
234
check_file_is_empty ()
@@ -237,10 +237,6 @@ def test_disabled_log_status_failed_initialization(self, mock_getpid):
237
237
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._STATUS_LOG_PATH" ,
238
238
TEST_LOGGER_PATH ,
239
239
)
240
- @patch (
241
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger._CUSTOMER_IKEY" ,
242
- TEST_CUSTOMER_IKEY ,
243
- )
244
240
@patch (
245
241
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._EXTENSION_VERSION" ,
246
242
TEST_EXTENSION_VERSION ,
@@ -253,15 +249,19 @@ def test_disabled_log_status_failed_initialization(self, mock_getpid):
253
249
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._IS_DIAGNOSTICS_ENABLED" ,
254
250
False ,
255
251
)
256
- @patch (
257
- "azure.monitor.opentelemetry.distro._diagnostics._status_logger.getpid" ,
258
- return_value = TEST_PID ,
259
- )
260
252
@patch (
261
253
"azure.monitor.opentelemetry.distro._diagnostics._status_logger._MACHINE_NAME" ,
262
254
TEST_MACHINE_NAME ,
263
255
)
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 ):
265
265
AzureStatusLogger .log_status (False , MESSAGE1 )
266
266
AzureStatusLogger .log_status (True )
267
267
check_file_is_empty ()
0 commit comments