From f6b2e2a01f4a815030af27e1adf25645f958472c Mon Sep 17 00:00:00 2001 From: Jozef Behran Date: Tue, 22 Mar 2016 10:46:23 +0100 Subject: [PATCH] Configure timeout in RestPerfClient Add --timeout argument setting the timeout for the RestPerfClient threads issuing requests to the timeouts calculated in the suites instead of the default 5 minutes. Do that change for all three RestPerfClient performance tests. Change-Id: I7497eb4284b3dde5909d1fab68783d03ce7a5e1a Signed-off-by: Jozef Behran --- csit/libraries/RestPerfClient.robot | 3 ++- csit/libraries/Utils.robot | 12 ++++++++++++ csit/suites/netconf/restperfclient/mdsal.robot | 4 ++-- csit/suites/netconf/restperfclient/performance.robot | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/csit/libraries/RestPerfClient.robot b/csit/libraries/RestPerfClient.robot index 5a1ca5878e..7ff0e1704b 100644 --- a/csit/libraries/RestPerfClient.robot +++ b/csit/libraries/RestPerfClient.robot @@ -57,7 +57,8 @@ Invoke_Restperfclient ${options}= BuiltIn.Set_Variable --ip ${ip} --port ${port} --edits ${count} ${options}= BuiltIn.Set_Variable ${options} --edit-content request1.json --async-requests ${async} ${options}= BuiltIn.Set_Variable ${options} --auth ${user} ${password} - ${options}= BuiltIn.Set_Variable ${options} --destination ${url} + ${timeout_in_minutes}= Utils.Convert_To_Minutes ${timeout} + ${options}= BuiltIn.Set_Variable ${options} --timeout ${timeout_in_minutes} --destination ${url} ${command}= BuiltIn.Set_Variable ${RestPerfClient__restperfclient_invocation_command_prefix} ${options} BuiltIn.Log Running restperfclient: ${command} SSHLibrary.Switch_Connection ${RestPerfClient__restperfclient} diff --git a/csit/libraries/Utils.robot b/csit/libraries/Utils.robot index 0f0ce259cd..c48a39605d 100644 --- a/csit/libraries/Utils.robot +++ b/csit/libraries/Utils.robot @@ -468,3 +468,15 @@ Set_User_Configurable_Variable_Default # "pybot -v". ${value}= BuiltIn.Get_Variable_Value \${${name}} ${value} BuiltIn.Set_Suite_Variable \${${name}} ${value} + +Convert_To_Minutes + [Arguments] ${time} + [Documentation] Convert a Robot time string to an integer expressing the time in minutes, rounded up + ... This is a wrapper around DateTime.Convert_Time which does not + ... provide this functionality directly nor is even able to produce + ... an integer directly. It is needed for RestPerfClient which + ... cannot accept floats for its --timeout parameter and interprets + ... the value supplied in this parameter in minutes. + ${seconds}= DateTime.Convert_Time ${time} result_format=number + ${minutes}= BuiltIn.Evaluate int(math.ceil(${seconds}/60.0)) modules=math + [Return] ${minutes} diff --git a/csit/suites/netconf/restperfclient/mdsal.robot b/csit/suites/netconf/restperfclient/mdsal.robot index 284877c5cf..72e1714f5e 100644 --- a/csit/suites/netconf/restperfclient/mdsal.robot +++ b/csit/suites/netconf/restperfclient/mdsal.robot @@ -119,11 +119,11 @@ Setup_Everything # Calculate timeouts ${value}= BuiltIn.Evaluate ${REQUEST_COUNT}/50+10 Utils.Set_User_Configurable_Variable_Default DIRECT_MDSAL_TIMEOUT ${value} s - ${value}= DateTime.Add_Time_To_Time ${DIRECT_MDSAL_TIMEOUT} 60s result_format=compact + ${value}= DateTime.Add_Time_To_Time ${DIRECT_MDSAL_TIMEOUT} 2m result_format=compact Utils.Set_User_Configurable_Variable_Default DIRECT_MDSAL_TIMEOUT_FOR_TESTCASE ${value} ${value}= BuiltIn.Evaluate ${REQUEST_COUNT}/10+10 Utils.Set_User_Configurable_Variable_Default NETCONF_CONNECTOR_MDSAL_TIMEOUT ${value} s - ${value}= DateTime.Add_Time_To_Time ${NETCONF_CONNECTOR_MDSAL_TIMEOUT} 60s result_format=compact + ${value}= DateTime.Add_Time_To_Time ${NETCONF_CONNECTOR_MDSAL_TIMEOUT} 2m result_format=compact Utils.Set_User_Configurable_Variable_Default NETCONF_CONNECTOR_MDSAL_TIMEOUT_FOR_TESTCASE ${value} Teardown_Everything diff --git a/csit/suites/netconf/restperfclient/performance.robot b/csit/suites/netconf/restperfclient/performance.robot index 9e42341696..7bf7654035 100644 --- a/csit/suites/netconf/restperfclient/performance.robot +++ b/csit/suites/netconf/restperfclient/performance.robot @@ -89,7 +89,7 @@ Setup_Everything # Calculate and set the value of the timeout ${value}= BuiltIn.Evaluate ${REQUEST_COUNT}/50+10 Utils.Set_User_Configurable_Variable_Default TESTTOOL_DEVICE_TIMEOUT ${value} s - ${value}= DateTime.Add_Time_To_Time ${TESTTOOL_DEVICE_TIMEOUT} 60s result_format=compact + ${value}= DateTime.Add_Time_To_Time ${TESTTOOL_DEVICE_TIMEOUT} 2m result_format=compact Utils.Set_User_Configurable_Variable_Default TESTTOOL_DEVICE_TIMEOUT_FOR_TESTCASE ${value} # Setup resources used by the suite. SetupUtils.Setup_Utils_For_Setup_And_Teardown -- 2.36.6