Cap the number of error logs.

Resolves openbmc/openbmc-test-automation#824

Change-Id: I68e3fcbeaa61b55baec37e55b1d72e66d82b6f9e
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/tests/test_error_log.robot b/tests/test_error_log.robot
index cc71009..0b77a1d 100644
--- a/tests/test_error_log.robot
+++ b/tests/test_error_log.robot
@@ -333,6 +333,17 @@
     # is less or equals to 2 seconds.
     Should Be True  ${time-diff} <= 2
 
+Verify Error Logs Capping
+    [Documentation]  Verify error logs capping.
+    [Tags]  Verify_Error_Logs_Capping
+
+    Delete Error Logs And Verify
+    ${cmd}=  Set Variable
+    ...  for i in {1..101}; do logging-test -c AutoTestSimple;done
+    Execute Command On BMC  ${cmd}
+    ${count}=  Count Error Entries
+    Run Keyword If  ${count} > 100
+    ...  Fail  Error logs created exceeded max capacity 100.
 
 *** Keywords ***
 
@@ -409,6 +420,15 @@
 
     Execute Command On BMC  logging-test -c AutoTestSimple
 
+Count Error Entries
+    [Documentation]  Count Error entries.
+
+    ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}
+    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK}
+    ${jsondata}=  To JSON  ${resp.content}
+    ${count}=  Get Length  ${jsondata["data"]}
+    [Return]  ${count}
+
 Verify Test Error Log
     [Documentation]  Verify test error log entries.
     ${elog_entry}=  Get URL List  ${BMC_LOGGING_ENTRY}