Revert "Modified BPA controller and fixed bugs"
[icn.git] / cmd / bpa-restapi-agent / e2e_test.sh
index 09c4582..b998f40 100755 (executable)
@@ -3,6 +3,7 @@
 ICN_DIR=$(dirname "$(dirname "$PWD")")
 
 source "$ICN_DIR/env/lib/common.sh"
+source "$ICN_DIR/deploy/kud-plugin-addons/minio/lib/minio.sh"
 
 #create sample image
 if true ; then
@@ -36,24 +37,25 @@ if true ; then
 EOF
 fi
 
-curr_status=""
+cur_status=""
 
-while [[ $curr_status != "Running" ]]; do
+while [[ $cur_status != "Running" ]]; do
+
+    cur_status=$(kubectl get pods | grep bpa-api-deployment | awk '{print $3}')
+    if [[ $cur_status != "Running" ]]; then
+        echo "$(date +%H:%M:%S) - BPA-RESTful-API Pod status: $cur_status"
+    else
+        echo "$(date +%H:%M:%S) - BPA-RESTful-API Pod status: $cur_status"
+        break
 
-    new_status=$(kubectl get pods | grep bpa-api-deployment | awk '{print $3}')
-    if [[ $new_status != $curr_status ]]; then
-        echo "$(date +%H:%M:%S) - BPA-RESTful-API Pod status: $new_status"
-        curr_status=$new_status
-        if [[ $new_status == "Running" ]]; then
-            break
-        fi
     fi
-    if [[ $new_status == "Err"* ]]; then
+    if [[ $cur_status == "Err"* ]]; then
         exit 1
     fi
     sleep 10
 done
 
+sleep 10
 
 #Get CLusterIP
 IP=$(kubectl get services | grep bpa-api-service | awk '{print $3}')
@@ -69,5 +71,13 @@ call_api --request PATCH --data-binary "@/tmp/sample_image" \
 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123 \
 --header "Upload-Offset: 0" --header "Expect:" -i
 
+MINIO_IP=$(kubectl get services | grep minio-service | awk '{print $3}')
+setup_mc $MINIO_IP
+obj_size=$(get_object_size container qwerty123)
+echo "Got obj size: $obj_size"
+if [[ $obj_size != $IMAGE_SIZE ]]; then
+    exit 1
+fi
+
 call_api -i -X DELETE \
 http://$IP:9015/v1/baremetalcluster/alpha/beta/container_images/qwerty123