-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pytest] Test the feature of monitoring critical processes by Supervisord. #2955
[pytest] Test the feature of monitoring critical processes by Supervisord. #2955
Conversation
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
This pull request introduces 1 alert when merging 9af1b25 into 2b00e37 - view on LGTM.com new alerts:
|
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
""" | ||
logger.info("Checking the alerting messages from syslog...") | ||
command_output = duthost.shell("sudo cat /var/log/syslog | grep '.*ERR.*supervisor-proc-exit-listener'", | ||
module_ignore_errors=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use log analyzer to achieve this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix. Another pytest PR has the same issue and will also fix.
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
1.Use `num_asics()` to get number of asics. 2.Use `sonic-db-cli CONFIG_DB keys 'FEATURE|*' to get the container list. 3.Move two functions to `tests/common/helpers/dut_utils.py`. Signed-off-by: Yong Zhao <yozhao@microsoft.com>
This pull request introduces 1 alert when merging 418ebed into e893f73 - view on LGTM.com new alerts:
|
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
the DUTs installed with 201911 or old image version. Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
This pull request introduces 1 alert when merging f0c549c into 856c106 - view on LGTM.com new alerts:
|
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
This pull request introduces 1 alert when merging b0ae37a into cb81ec8 - view on LGTM.com new alerts:
|
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
This pull request introduces 1 alert when merging 9cfca51 into a1a713e - view on LGTM.com new alerts:
|
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
This pull request introduces 1 alert when merging f0af91f into a1a713e - view on LGTM.com new alerts:
|
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
tests/monitoring_processes/test_monitoring_critical_processes.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
This pull request introduces 1 alert when merging 2bf80f0 into 795d794 - view on LGTM.com new alerts:
|
check the lgtm alerts? |
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
return is_enabled, has_global_scope, has_per_asic_scope | ||
|
||
|
||
def parse_feature_table(duthost, num_asics, skip_containers): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function parse_feature_table(...)
was used to get running containers list and which namespaces currently they are running. Currently this function was already removed and replaced by the function get_containers_namespace_ids(...)
in which I used the get_feature_status(...)
(https://github.com/Azure/sonic-mgmt/blob/67d5be22c740636c132047340d41fce163b9cee1/tests/common/devices.py#L972) to get the running container list.
tests/kvmtest.sh
Outdated
@@ -154,7 +155,8 @@ test_t1_lag() { | |||
lldp/test_lldp.py \ | |||
route/test_default_route.py \ | |||
platform_tests/test_cpu_memory_usage.py \ | |||
bgp/test_bgpmon.py" | |||
bgp/test_bgpmon.py \ | |||
monitoring_processes/test_monitoring_critical_processes.py" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest renaming the directory to process_monitoring
and the file to test_critical_process_monitoring.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
critical process monitoring in kvmtest.sh. Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao yozhao@microsoft.com
Description of PR
Summary:
This PR aims to test the feature of monitoring the critical processes by Supervisord.
Fixes # (issue)
Type of change
Approach
What is the motivation for this PR?
The motivation for this PR is to test the feature of monitoring the critical processes by Supervisord. This monitoring feature required Supervisord should write an alerting message into syslog if a critical process exited unexpectedly and the autorestart of container hosting this process was disabled.
How did you do it?
The logic of this PR is as follows:
Step 1: Records the autorestart status of all containers.
Step 2: Gets the number of ASICs on DUT.
Step 3: Gets all the containers which were enabled on DUT and at the same time for each enabled container, retrieve a list of namespaces which this container should be running.
Step 4: Disables the autorestart of all enabled containers.
Step 5: Manually stops all the critical process in all enabled containers on DUT.
Step 6: Waits for 70 seconds for the alerting messages to appear.
Step 7: Checks whether the expected alerting messages appeared in syslog or not.
Step 8: Executes the
config_reload(...)
to restart containers.Step 9: Checks whether all critical processes in enabled containers are running.
Step 10: Restores the autorestart status of all containers.
Step 11: Does the post-check.
How did you verify/test it?
I tested this PR on a physical testbed with single ASIC.
Any platform specific information?
N/A
Supported testbed topology if it's a new test case?
N/A
Documentation