diff options
author | Victor Morales <victor.morales@intel.com> | 2018-09-13 06:28:39 -0700 |
---|---|---|
committer | Victor Morales <victor.morales@intel.com> | 2018-09-13 06:28:39 -0700 |
commit | dd426e9488c3822cf58c3b6f1cf10dc17621225c (patch) | |
tree | 37aebbb0326a7a7c3c1497efaf00373baefe68bc | |
parent | fefa2efd802763db906d2a9c8303c0fbd8be0c38 (diff) |
Complete Plugin Functional tests
The script that consumes the Plugin Endpoints to ensuring its
funtionality was completed. This change helps to covers all the
endpoints exposed by the API.
Change-Id: I56d1412debd3942d42484389a1c3ff04aa3da563
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-ID: MULTICLOUD-301
-rwxr-xr-x | vagrant/tests/plugin.sh | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/vagrant/tests/plugin.sh b/vagrant/tests/plugin.sh index 744b2207..ac373cd3 100755 --- a/vagrant/tests/plugin.sh +++ b/vagrant/tests/plugin.sh @@ -11,6 +11,7 @@ set -o errexit set -o nounset set -o pipefail +#set -o xtrace # _build_generic_sim() - Creates a generic simulator image in case that doesn't exist function _build_generic_sim { @@ -44,12 +45,14 @@ function start_aai_service { # populate_csar_dir()- Creates content used for Functional tests function populate_csar_dir { mkdir -p ${CSAR_DIR}/${csar_id} - cat << SEQ > ${CSAR_DIR}/${csar_id}/metadata.yaml -deployment: - - deployment.yaml -service: - - service.yaml -SEQ + cat << META > ${CSAR_DIR}/${csar_id}/metadata.yaml +resources: + deployment: + - deployment.yaml + service: + - service.yaml +META + cat << DEPLOYMENT > ${CSAR_DIR}/${csar_id}/deployment.yaml apiVersion: apps/v1 kind: Deployment @@ -98,8 +101,8 @@ base_url="http://localhost:8081/v1/vnf_instances/" cloud_region_id="krd" namespace="default" csar_id="94e414f6-9ca4-11e8-bb6a-52540067263b" -deployment_name="plugin_functional_test_deployment" -service_name="plugin_functional_test_service" +deployment_name="test-deployment" +service_name="test-service" #start_aai_service populate_csar_dir @@ -114,16 +117,18 @@ payload_raw=" " payload=$(echo $payload_raw | tr '\n' ' ') echo "Creating VNF Instance" -curl -d "$payload" "${base_url}" +vnf_id=$(curl -s -d "$payload" "${base_url}" | jq -r '.vnf_id') +echo "=== Validating Kubernetes ===" +kubectl get --no-headers=true --namespace=${namespace} deployment ${cloud_region_id}-${namespace}-${vnf_id}-${deployment_name} +kubectl get --no-headers=true --namespace=${namespace} service ${cloud_region_id}-${namespace}-${vnf_id}-$service_name +echo "VNF Instance created succesfully with id: $vnf_id" -vnf_id=$(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}" | jq -r '.vnf_id_list[0]') -if [[ -z "$vnf_id" ]]; then - echo "VNF Instance not created" +vnf_id_list=$(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}" | jq -r '.vnf_id_list') +if [[ "$vnf_id_list" != *"${vnf_id}"* ]]; then + echo $vnf_id_list + echo "VNF Instance not stored" exit 1 fi -echo "VNF Instance created succesfully with id: $vnf_id" -#kubectl get deployment $deployment_name -#kubectl get service $service_name vnf_details=$(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}/${vnf_id}") if [[ -z "$vnf_details" ]]; then @@ -138,4 +143,3 @@ if [[ -n $(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}/${vnf_id}" echo "VNF Instance not deleted" exit 1 fi -docker logs deployments_multicloud-k8s_1 |