summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorr.kuralamudhan <kuralamudhan.ramakrishnan@intel.com>2019-11-19 23:05:47 -0800
committerr.kuralamudhan <kuralamudhan.ramakrishnan@intel.com>2019-11-20 06:41:11 -0800
commitd405884a52745df2b09f777a62c2facd7651885f (patch)
tree3d41b67e900dfd01bdaf801945ccd1475a5f3281
parentf168ebb73d8dad0e1c75747cbc9b0a0de8fc2357 (diff)
Enabling testing for the containerized installer
Issue-ID: MULTICLOUD-942 Signed-off-by: r.kuralamudhan <kuralamudhan.ramakrishnan@intel.com> Change-Id: I4c5da84002135d856c5c3dcccf103aa52bb8a0f9
-rw-r--r--kud/build/Dockerfile4
-rw-r--r--kud/hosting_providers/containerized/README.md4
-rwxr-xr-xkud/hosting_providers/containerized/installer.sh19
-rwxr-xr-xkud/tests/plugin_edgex.sh14
-rwxr-xr-xkud/tests/plugin_fw.sh14
5 files changed, 41 insertions, 14 deletions
diff --git a/kud/build/Dockerfile b/kud/build/Dockerfile
index da100bb7..38c63295 100644
--- a/kud/build/Dockerfile
+++ b/kud/build/Dockerfile
@@ -1,4 +1,8 @@
FROM ubuntu:18.04 as base
+ARG KUD_ENABLE_TESTS=false
+ARG KUD_PLUGIN_ENABLED=false
+ENV KUD_ENABLE_TESTS=$KUD_ENABLE_TESTS
+ENV KUD_PLUGIN_ENABLED=$KUD_PLUGIN_ENABLED
ADD . /usr/src/multicloud-k8s
USER root
SHELL ["/bin/bash", "-c"]
diff --git a/kud/hosting_providers/containerized/README.md b/kud/hosting_providers/containerized/README.md
index d1659629..12ce1a19 100644
--- a/kud/hosting_providers/containerized/README.md
+++ b/kud/hosting_providers/containerized/README.md
@@ -27,7 +27,7 @@ Kubernetes jobs(a cluster per job) are used to install multiple clusters and log
## Quickstart Installation Guide
-Build the kud docker images as follows:
+Build the kud docker images as follows, add KUD_ENABLE_TESTS & KUD_PLUGIN_ENABLED for the testing only:
```
$ git clone https://github.com/onap/multicloud-k8s.git && cd multicloud-k8s
@@ -38,6 +38,8 @@ $ docker build --rm \
--build-arg HTTPS_PROXY=${HTTPS_PROXY} \
--build-arg no_proxy=${no_proxy} \
--build-arg NO_PROXY=${NO_PROXY} \
+ --build-arg KUD_ENABLE_TESTS=true \
+ --build-arg KUD_PLUGIN_ENABLED=true \
-t github.com/onap/multicloud-k8s:latest . -f build/Dockerfile
```
Let's create a cluster-101 and cluster-102 hosts.ini as follows
diff --git a/kud/hosting_providers/containerized/installer.sh b/kud/hosting_providers/containerized/installer.sh
index ad44dc56..713847ea 100755
--- a/kud/hosting_providers/containerized/installer.sh
+++ b/kud/hosting_providers/containerized/installer.sh
@@ -19,7 +19,7 @@ function install_prerequisites {
#install package for docker images
apt-get update
apt-get install -y curl vim wget git \
- software-properties-common python-pip
+ software-properties-common python-pip sudo
add-apt-repository -y ppa:longsleep/golang-backports
apt-get update
apt-get install -y golang-go rsync
@@ -136,21 +136,17 @@ function install_addons {
# install_plugin() - Install ONAP Multicloud Kubernetes plugin
function install_plugin {
- echo "Installing multicloud/k8s plugin"
- mkdir -p /opt/{kubeconfig,consul/config}
- cp $HOME/.kube/config /opt/kubeconfig/kud
-
- pushd $kud_folder/../../../deployments
- ./build.sh
+ echo "Installing multicloud/k8s onap4k8s plugin"
if [[ "${testing_enabled}" == "true" ]]; then
- ./start.sh
pushd $kud_tests
- for functional_test in plugin plugin_edgex plugin_fw; do
- bash ${functional_test}.sh
+ echo "Test the onap4k8s installation"
+ bash onap4k8s.sh
+ echo "Test the onap4k8s plugin installation"
+ for functional_test in plugin_edgex plugin_fw; do
+ bash ${functional_test}.sh --external
done
popd
fi
- popd
}
# _print_kubernetes_info() - Prints the login Kubernetes information
@@ -191,6 +187,7 @@ k8s_info_file=$kud_folder/k8s_info.log
testing_enabled=${KUD_ENABLE_TESTS:-false}
mkdir -p /opt/csar
+export CSAR_DIR=/opt/csar
function install_pkg {
# Install dependencies
diff --git a/kud/tests/plugin_edgex.sh b/kud/tests/plugin_edgex.sh
index 8eae5692..ae390add 100755
--- a/kud/tests/plugin_edgex.sh
+++ b/kud/tests/plugin_edgex.sh
@@ -17,7 +17,16 @@ source _common_test.sh
source _functions.sh
source _common.sh
-base_url="http://localhost:9015/v1"
+if [ ${1:+1} ]; then
+ if [ "$1" == "--external" ]; then
+ master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \
+ awk -F ":" '{print $2}' | awk -F "//" '{print $2}')
+ onap_svc_node_port=30498
+ base_url="http://$master_ip:$onap_svc_node_port/v1"
+ fi
+fi
+
+base_url=${base_url:-"http://localhost:9015/v1"}
kubeconfig_path="$HOME/.kube/config"
csar_id=cb009bfe-bbee-11e8-9766-525400435678
rb_name="edgex"
@@ -91,6 +100,9 @@ response="$(call_api -d "${payload}" "${base_url}/instance")"
echo "$response"
vnf_id="$(jq -r '.id' <<< "${response}")"
+print_msg "Waiting for EdgeX instances"
+sleep 240
+
print_msg "Validating Kubernetes"
kubectl get --no-headers=true --namespace=${namespace} deployment edgex-core-command
kubectl get --no-headers=true --namespace=${namespace} service edgex-core-command
diff --git a/kud/tests/plugin_fw.sh b/kud/tests/plugin_fw.sh
index d7bed4fd..eec467c3 100755
--- a/kud/tests/plugin_fw.sh
+++ b/kud/tests/plugin_fw.sh
@@ -17,7 +17,16 @@ source _common_test.sh
source _functions.sh
source _common.sh
-base_url="http://localhost:9015/v1"
+if [ ${1:+1} ]; then
+ if [ "$1" == "--external" ]; then
+ master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \
+ awk -F ":" '{print $2}' | awk -F "//" '{print $2}')
+ onap_svc_node_port=30498
+ base_url="http://$master_ip:$onap_svc_node_port/v1"
+ fi
+fi
+
+base_url=${base_url:-"http://localhost:9015/v1"}
kubeconfig_path="$HOME/.kube/config"
csar_id=cc009bfe-bbee-11e8-9766-525400435678
rb_name="vfw"
@@ -98,6 +107,9 @@ wait_for_pod -n "${namespace}" -l app=firewall
wait_for_pod -n "${namespace}" -l app=packetgen
# TODO: Provide some health check to verify vFW work
+print_msg "Waiting for VNF instances"
+sleep 480
+
print_msg "Retrieving VNF details"
call_api "${base_url}/instance/${vnf_id}"