File tree 1 file changed +20
-0
lines changed
datadog_checks_base/tests/base/checks 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1316,3 +1316,23 @@ def test_env_var_logic_preset():
1316
1316
AgentCheck ()
1317
1317
assert os .getenv ('OPENSSL_CONF' , None ) == preset_conf
1318
1318
assert os .getenv ('OPENSSL_MODULES' , None ) == preset_modules
1319
+
1320
+ @pytest .mark .parametrize (
1321
+ "should_profile_value, expected_calls" ,
1322
+ [
1323
+ (True , 1 ),
1324
+ (False , 0 ),
1325
+ ],
1326
+ )
1327
+ def test_profile_memory (should_profile_value , expected_calls ):
1328
+ """
1329
+ Test that profile_memory is called when should_profile_memory is True
1330
+ """
1331
+ check = AgentCheck ('test' , {}, [{}])
1332
+ check .should_profile_memory = mock .MagicMock (return_value = should_profile_value )
1333
+ check .profile_memory = mock .MagicMock ()
1334
+
1335
+ check .run ()
1336
+
1337
+ assert check .should_profile_memory .call_count == 1
1338
+ assert check .profile_memory .call_count == expected_calls
You can’t perform that action at this time.
0 commit comments