Fix Robot evaluate
[integration/test.git] / csit / suites / controller / ThreeNodes_Datastore / puts_during_isolation.robot
index 450fb63478de77f5d5950af802a916d72ab44dc7..d7e19da6f202f95c0f347943316bd79e476d01bd 100644 (file)
@@ -19,6 +19,7 @@ Library           SSHLibrary
 Resource          ${CURDIR}/../../../variables/Variables.robot
 Resource          ${CURDIR}/../../../libraries/Utils.robot
 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource          ${CURDIR}/../../../libraries/RemoteBash.robot
 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
 Resource          ${CURDIR}/../../../libraries/CarPeople.robot
 
@@ -41,7 +42,7 @@ Start_Adding_Cars_To_Follower
     ${follower_ip} =    ClusterManagement.Resolve_IP_Address_For_Member    member_index=${idx}
     Start Tool    ${ADDCMD}    --host ${follower_ip} ${TOOL_OPTIONS}
     ${session} =    Resolve_Http_Session_For_Member    member_index=${car_leader_index}
-    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    Ensure_Cars_Being_Configured    ${session}
+    BuiltIn.Wait_Until_Keyword_Succeeds    10x    5s    Ensure_Cars_Being_Configured    ${session}
 
 Isolate_Current_Car_Leader
     [Documentation]    Isolating cluster node which is the car shard leader.
@@ -51,7 +52,7 @@ Isolate_Current_Car_Leader
 
 Verify_New_Car_Leader_Elected
     [Documentation]    Verify new owner of the car shard is elected.
-    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    ClusterManagement.Verify_Shard_Leader_Elected    ${SHARD_NAME}    ${SHARD_TYPE}    ${True}
+    BuiltIn.Wait_Until_Keyword_Succeeds    10x    5s    ClusterManagement.Verify_Shard_Leader_Elected    ${SHARD_NAME}    ${SHARD_TYPE}    ${True}
     ...    ${old_car_leader}    member_index_list=${old_car_followers}
     CarPeople.Set_Tmp_Variables_For_Shard_For_Nodes    ${old_car_followers}    shard_name=${SHARD_NAME}    shard_type=${SHARD_TYPE}
 
@@ -59,7 +60,7 @@ Verify_Cars_Configured
     [Documentation]    Verify that all cars are configured.
     BuiltIn.Wait_Until_Keyword_Succeeds    120x    2s    SSHLibrary.Read_Until_Prompt
     ${session} =    Resolve_Http_Session_For_Member    member_index=${new_leader_index}
-    Verify_Cars_Count    ${ITEM_COUNT}    ${session}
+    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    Verify_Cars_Count    ${ITEM_COUNT}    ${session}
 
 Rejoin_Isolated_Member
     [Documentation]    Rejoin isolated node
@@ -78,7 +79,7 @@ Start Suite
     [Documentation]    Upload the script file and create a virtual env
     SetupUtils.Setup_Utils_For_Setup_And_Teardown
     SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All    ${TEST_LOG_LEVEL}    ${TEST_LOG_COMPONENTS}
-    ${mininet_conn_id} =    SSHKeywords.Open_Connection_To_Tools_System
+    ${mininet_conn_id} =    SSHKeywords.Open_Connection_To_Tools_System    prompt=~]>
     Builtin.Set Suite Variable    ${mininet_conn_id}
     SSHLibrary.Put File    ${CURDIR}/../../../../tools/odl-mdsal-clustering-tests/scripts/${TOOL_NAME}    .
     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    ls    return_stdout=True    return_stderr=True
@@ -92,6 +93,10 @@ Start Suite
 Stop Suite
     [Documentation]    Stop the tool, remove virtual env and close ssh connection towards tools vm.
     Stop_Tool
+    ${session} =    Resolve_Http_Session_For_Member    member_index=${new_leader_index}
+    # best effort to make sure cars are deleted in case more suites will run after this and the delete test case had trouble
+    ${rsp}=    RequestsLibrary.Delete Request    ${session}    ${CARURL}
+    BuiltIn.Log    ${rsp.status_code} : ${rsp.text}
     SSHKeywords.Virtual_Env_Delete
     Store_File_To_Workspace    ${out_file}    ${out_file}
     SSHLibrary.Close All Connections
@@ -110,7 +115,7 @@ Stop_Tool
     # TODO: https://trello.com/c/rXsMu7iz/444-create-keywords-for-the-tool-start-and-stop-in-remotebash-robot
     ${output}=    SSHLibrary.Read
     BuiltIn.Log    ${output}
-    Utils.Write_Bare_Ctrl_C
+    RemoteBash.Write_Bare_Ctrl_C
     ${output}=    SSHLibrary.Read_Until_Prompt
     BuiltIn.Log    ${output}
     SSHKeywords.Virtual_Env_Deactivate_On_Current_Session    log_output=${True}
@@ -125,7 +130,7 @@ Get_Cars_Count
     [Arguments]    ${session}
     [Documentation]    Count car items in config ds.
     ${resp}=    RequestsLibrary.Get_Request    ${session}    ${CARURL}
-    ${count} =    BuiltIn.Evaluate    len(${resp.json()}["cars"]["car-entry"])
+    ${count} =    BuiltIn.Evaluate    len(${resp.json()}[cars][car-entry])
     BuiltIn.Return_From_Keyword    ${count}
 
 Ensure_Cars_Being_Configured