Select addons namespace with kubectl in e2e tests
[icn.git] / cmd / bpa-restapi-agent / e2e_test.sh
index cc41f21..4742bdb 100755 (executable)
@@ -1,8 +1,10 @@
-#!/bin/bash
+#!/usr/bin/env bash
+set -eu -o pipefail
 
 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
@@ -44,6 +46,7 @@ while [[ $cur_status != "Running" ]]; do
     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
 
     fi
@@ -53,6 +56,7 @@ while [[ $cur_status != "Running" ]]; do
     sleep 10
 done
 
+sleep 30
 
 #Get CLusterIP
 IP=$(kubectl get services | grep bpa-api-service | awk '{print $3}')
@@ -68,5 +72,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