Skip to content

Commit 7f4da26

Browse files
authored
[app_ext] [auto-ts] Add available_mem_threshold option (sonic-net#2423)
- What I did With this change, when a new app-extension is installed, available_mem_threshold config is added to AUTO_TECHSUPPORT_FEATURE|<feature_name> key - How I did it - How to verify it vkarri@d7a060369aba:/sonic/src/sonic-utilities$ pytest-3 tests/sonic_package_manager/test_service_creator.py =============================================================== test session starts =============================================================== platform linux -- Python 3.9.2, pytest-6.0.2, py-1.10.0, pluggy-0.13.0 rootdir: /sonic/src/sonic-utilities/tests, configfile: pytest.ini plugins: pyfakefs-4.7.0, cov-2.10.1 collected 13 items tests/sonic_package_manager/test_service_creator.py ............. [100%] =============================================================== 13 passed in 0.25s ================================================================ Signed-off-by: Vivek Reddy Karri <[email protected]>
1 parent b250701 commit 7f4da26

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

sonic_package_manager/service_creator/feature.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
AUTO_TS_GLOBAL = "AUTO_TECHSUPPORT"
2020
AUTO_TS_FEATURE = "AUTO_TECHSUPPORT_FEATURE"
2121
CFG_STATE = "state"
22-
# TODO: Enable available_mem_threshold once the mem_leak_auto_ts feature is available
2322
DEFAULT_AUTO_TS_FEATURE_CONFIG = {
2423
'state': 'disabled',
25-
'rate_limit_interval': '600'
24+
'rate_limit_interval': '600',
25+
'available_mem_threshold': '10.0'
2626
}
2727

2828
def is_enabled(cfg):

tests/sonic_package_manager/test_service_creator.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def get_entry(cls, table, key):
313313
@classmethod
314314
def get_entry_running_cfg(cls, table, key):
315315
if table == "AUTO_TECHSUPPORT_FEATURE" and key == "test":
316-
return {"state" : "disabled", "rate_limit_interval" : "1000"}
316+
return {"state" : "disabled", "rate_limit_interval" : "1000", "available_mem_threshold": "20.0"}
317317
else:
318318
return {}
319319

@@ -328,7 +328,8 @@ def test_auto_ts_global_disabled(mock_sonic_db, manifest):
328328
feature_registry.register(manifest)
329329
mock_init_cfg.set_entry.assert_any_call("AUTO_TECHSUPPORT_FEATURE", "test", {
330330
"state" : "disabled",
331-
"rate_limit_interval" : "600"
331+
"rate_limit_interval" : "600",
332+
"available_mem_threshold": "10.0"
332333
}
333334
)
334335

@@ -343,7 +344,8 @@ def test_auto_ts_global_enabled(mock_sonic_db, manifest):
343344
feature_registry.register(manifest)
344345
mock_init_cfg.set_entry.assert_any_call("AUTO_TECHSUPPORT_FEATURE", "test", {
345346
"state" : "enabled",
346-
"rate_limit_interval" : "600"
347+
"rate_limit_interval" : "600",
348+
"available_mem_threshold": "10.0"
347349
}
348350
)
349351

@@ -382,7 +384,8 @@ def test_auto_ts_feature_update_flow(mock_sonic_db, manifest):
382384
call("AUTO_TECHSUPPORT_FEATURE", "test", None),
383385
call("AUTO_TECHSUPPORT_FEATURE", "test_new", {
384386
"state" : "enabled",
385-
"rate_limit_interval" : "600"
387+
"rate_limit_interval" : "600",
388+
"available_mem_threshold": "10.0"
386389
})
387390
],
388391
any_order = True
@@ -393,7 +396,8 @@ def test_auto_ts_feature_update_flow(mock_sonic_db, manifest):
393396
call("AUTO_TECHSUPPORT_FEATURE", "test", None),
394397
call("AUTO_TECHSUPPORT_FEATURE", "test_new", {
395398
"state" : "disabled",
396-
"rate_limit_interval" : "1000"
399+
"rate_limit_interval" : "1000",
400+
"available_mem_threshold": "20.0"
397401
})
398402
],
399403
any_order = True

0 commit comments

Comments
 (0)