Suchitra Vemuri | 270398d | 2018-01-25 23:36:30 -0800 | [diff] [blame] | 1 | # Copyright 2017-present Radisys Corporation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | |
| 16 | *** Settings *** |
| 17 | Documentation Test suite for checking results collected by various commands on the soak server |
| 18 | Library OperatingSystem |
| 19 | Library ../cord-api/Framework/utils/onosUtils.py |
| 20 | Library ../cord-api/Framework/utils/utils.py |
| 21 | |
| 22 | *** Variables *** |
Suchitra Vemuri | b5a36d0 | 2018-01-31 17:02:31 -0800 | [diff] [blame] | 23 | ${FILE_PATH} /home/cord/SoakTest_Logs |
Suchitra Vemuri | 270398d | 2018-01-25 23:36:30 -0800 | [diff] [blame] | 24 | |
| 25 | *** Test Cases *** |
| 26 | Verify Docker Containers Restart Status |
| 27 | [Documentation] Verify that no containers have been restarted |
Suchitra Vemuri | b5a36d0 | 2018-01-31 17:02:31 -0800 | [diff] [blame] | 28 | [Tags] Restart_Status |
Suchitra Vemuri | de95a28 | 2018-02-14 16:04:39 -0800 | [diff] [blame] | 29 | ${command_output}= Run docker inspect --format "ID: {{.ID}} RESTARTS: {{.RestartCount}} NAME: {{.Name}}" $(docker ps -aq) | grep -v ": 0" > /tmp/count_log |
| 30 | Log To Console ${command_output} |
| 31 | ${file_output}= Run cat /tmp/count_log |
| 32 | ${count}= Run cat /tmp/count_log | wc -l |
| 33 | Log ${file_output} |
| 34 | ${command_output1}= Run sudo mv /tmp/count_log ${FILE_PATH}/container_restarts$(date "+%Y.%m.%d-%H.%M.%S") |
| 35 | Should Be Empty ${count} |
Suchitra Vemuri | 270398d | 2018-01-25 23:36:30 -0800 | [diff] [blame] | 36 | |
| 37 | Verify Memory Utilization on the Containers |
| 38 | [Documentation] Display the memory utilization for the containers |
Suchitra Vemuri | b5a36d0 | 2018-01-31 17:02:31 -0800 | [diff] [blame] | 39 | [Tags] Container_Memory_Usage |
| 40 | ${command_output}= Run docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" $(docker ps -a --format '{{.Names}}') > /tmp/mem_log |
| 41 | ${cat_output}= Run cat /tmp/mem_log |
| 42 | ${count}= Run cat /tmp/mem_log | wc -l |
Suchitra Vemuri | de95a28 | 2018-02-14 16:04:39 -0800 | [diff] [blame] | 43 | ${command_output1}= Run sudo mv /tmp/mem_log ${FILE_PATH}/container_mem_usage_$(date "+%Y.%m.%d-%H.%M.%S") |
Suchitra Vemuri | 270398d | 2018-01-25 23:36:30 -0800 | [diff] [blame] | 44 | Should Not Be Empty ${count} |