[RIC-571] Fix automation tests 94/4494/1
authorAmichai <amichai.sichel@intl.att.com>
Sat, 1 Aug 2020 21:12:43 +0000 (21:12 +0000)
committerAmichai <amichai.sichel@intl.att.com>
Sat, 1 Aug 2020 21:12:50 +0000 (21:12 +0000)
Change-Id: I385d3c6503fb8b950d5021a0213c1b60f54dec5e
Signed-off-by: Amichai <amichai.sichel@intl.att.com>
Automation/Tests/Resource/Keywords.robot
Automation/Tests/Scripts/k8s_helper.py

index 6d1fdd8..29b933b 100644 (file)
@@ -29,9 +29,6 @@ Library     OperatingSystem
 Library     Process
 Variables  ../Scripts/variables.py
 
 Library     Process
 Variables  ../Scripts/variables.py
 
-*** Variables ***
-${e2adapter}  ${e2adapter_pod_name}
-
 *** Keywords ***
 Get Request nodeb
     [Arguments]    ${nodeb_name}=${ranName}
 *** Keywords ***
 Get Request nodeb
     [Arguments]    ${nodeb_name}=${ranName}
@@ -176,6 +173,11 @@ Stop e2adapter
      Run And Return Rc And Output    ${stop_e2adapter}
      Sleep  5s
 
      Run And Return Rc And Output    ${stop_e2adapter}
      Sleep  5s
 
+Restart e2adapter
+    Log to Console  Restarting e2adapter
+    Stop e2adapter
+    Start e2adapter
+
 Flush And Populate DB
     [Arguments]    ${set_new_timestamp}=${True}
     Log To Console  Flushing and populating DB
 Flush And Populate DB
     [Arguments]    ${set_new_timestamp}=${True}
     Log To Console  Flushing and populating DB
@@ -192,8 +194,10 @@ Stop All Pods Except Simulator
 
 Send eNB Setup Request
     Log To Console  Sending eNB setup request form e2adapter
 
 Send eNB Setup Request
     Log To Console  Sending eNB setup request form e2adapter
-    ${send_enb_setup}       Evaluate    "kubectl -n ricplt exec -it ${e2adapter} cli send-e2setup-req 10.0.2.15"
-    Sleep    3s
+    Restart e2adapter
+    Wait until keyword succeeds  2 min    3 sec    Validate Required Dockers
+    ${e2adapter_pod} =    Run And Return Rc And Output   kubectl get pods -n ricplt | /bin/grep e2adapter | /bin/grep Running | awk '{{print $1}}'
+    ${send_enb_setup}    Evaluate    "kubectl -n ricplt exec -it ${e2adapter_pod[1]} cli send-e2setup-req 10.0.2.15"
     Run And Return Rc And Output    ${send_enb_setup}
 
 Start Redis Monitor
     Run And Return Rc And Output    ${send_enb_setup}
 
 Start Redis Monitor
index 4fe6dd8..a1cce5f 100644 (file)
@@ -32,7 +32,7 @@ def extract_service_ip(service_name):
     return service_ip.strip()
 
 def extract_pod_name(pod_base_name):
     return service_ip.strip()
 
 def extract_pod_name(pod_base_name):
-    k8s_command = "kubectl get pods -n ricplt | /bin/grep {} | awk \'{{print $1}}\'" \
+    k8s_command = "kubectl get pods -n ricplt | /bin/grep {} | /bin/grep Running | awk \'{{print $1}}\'" \
         .format(pod_base_name)
 
     pod_name = subprocess.check_output(["/bin/bash", "-c", k8s_command], universal_newlines=True)
         .format(pod_base_name)
 
     pod_name = subprocess.check_output(["/bin/bash", "-c", k8s_command], universal_newlines=True)