COE : Pass proper GERRIT_REFSPEC
[integration/test.git] / csit / libraries / Coe.robot
index a9462b43144fb436a2d82c7e32117a5aa8ffd4ec..9eed0faa8b2f458f116b10e3a356d4446059301c 100644 (file)
@@ -34,6 +34,7 @@ Coe Suite Setup
     [Documentation]    COE project requires start suite to be executed only for the first test suite.This keyword find the current suite,compares it with the stored first suite value and executes Coe.Start suite only if the cuurent suite is equal to the first suite.
     ToolsSystem.Get Tools System Nodes Data
     Coe.Set Connection ids and Bridge
+    Coe.Derive Coe Data Models
     ${current suite}    ${suite names updated}    Extract current suite name
     ${first_suite} =    Set Variable    ${suite names updated[0]}
     ${status} =    BuiltIn.Evaluate    '${first_suite}' == '${current suite}'
@@ -48,7 +49,6 @@ Start Suite
     Coe.Label Nodes
     BuiltIn.Wait Until Keyword Succeeds    60    2    ClusterManagement.Check Status Of Services Is OPERATIONAL    @{COE_DIAG_SERVICES}
     BuiltIn.Wait Until Keyword Succeeds    85    2    Genius.Verify Tunnel Status as UP    default-transport-zone
-    Coe.Derive Coe Data Models
 
 Set Connection ids and Bridge
     [Documentation]    Sets the connection ids for all the nodes and get the bridge from configuration file .
@@ -73,7 +73,13 @@ Configuration Playbook
     OperatingSystem.Create File    ${WATCHER_COE}    ${watcher}
     SSHKeywords.Copy_File_To_Remote_System    ${K8s_MASTER_IP}    ${WATCHER_COE}    ${USER_HOME}
     OperatingSystem.Copy File    ${PLAYBOOK_FILE}    ${USER_HOME}
-    ${play_output} =    OperatingSystem.Run    ansible-playbook -v ${USER_HOME}/coe_play.yaml -i ${USER_HOME}/hosts.yaml --extra-vars '{"gerrit_branch":"FETCH_HEAD","gerrit_refspec":"${GERRIT_REFSPEC}"}'
+    ${default_ref_spec} =    BuiltIn.Catenate    SEPARATOR=    refs/heads/    ${GERRIT_BRANCH}
+    ${gerrit_ref_spec} =    BuiltIn.Set Variable If    '${GERRIT_PROJECT}' == 'coe'    ${GERRIT_REFSPEC}    ${default_ref_spec}
+    Run Coe Playbook    ${gerrit_ref_spec}
+
+Run Coe Playbook
+    [Arguments]    ${gerrit_ref_spec}
+    ${play_output} =    OperatingSystem.Run    ansible-playbook -v ${USER_HOME}/coe_play.yaml -i ${USER_HOME}/hosts.yaml --extra-vars '{"gerrit_branch":"${GERRIT_BRANCH}","gerrit_refspec":"${gerrit_ref_spec}"}'
     BuiltIn.Log    ${play_output}
 
 Modifying templates in playbook
@@ -234,7 +240,7 @@ Log Statements
     @{log statement} =    Create List
     ${i} =    Set Variable    0
     : FOR    ${pod_ip}    IN    @{pod ips}
-    \    ${ping statement}    Set Variable    Ping ${pod_name} and ${pod names[${i}]} : ${pod ip}
+    \    ${ping statement}    Set Variable    Ping from ${pod_name} to ${pod names[${i}]} (${pod ip})
     \    Append To List    ${log statement}    ${ping statement}
     \    ${i} =    Evaluate    ${i}+1
     [Return]    @{log statement}