Kiran Kamineni | ac3438c | 2019-03-13 12:24:23 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (c) 2018 Intel Corporation, Inc |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at: |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | |
| 14 | pushd ${SCRIPTS} |
| 15 | |
| 16 | # start mongodb |
| 17 | ./run-instance.sh docker.io/mongo:4.0 multicloud-k8s-mongodb |
| 18 | MONGO_IP=$(./get-instance-ip.sh multicloud-k8s-mongodb) |
| 19 | |
Kiran Kamineni | ad13ac5 | 2019-04-23 12:37:20 -0700 | [diff] [blame] | 20 | # setup multicloud-k8s configuration |
| 21 | CONFIG_FILE=$(pwd)/k8sconfig.json |
Kiran Kamineni | 22c9a56 | 2019-05-06 22:02:21 -0700 | [diff] [blame] | 22 | SERVICE_PORT=9015 |
Kiran Kamineni | ad13ac5 | 2019-04-23 12:37:20 -0700 | [diff] [blame] | 23 | cat << EOF > $CONFIG_FILE |
| 24 | { |
| 25 | "database-address": "$MONGO_IP", |
| 26 | "database-type": "mongo", |
| 27 | "plugin-dir": "plugins", |
Kiran Kamineni | 22c9a56 | 2019-05-06 22:02:21 -0700 | [diff] [blame] | 28 | "service-port": "$SERVICE_PORT", |
Kiran Kamineni | ad13ac5 | 2019-04-23 12:37:20 -0700 | [diff] [blame] | 29 | "kube-config-dir": "kubeconfigs" |
| 30 | } |
| 31 | EOF |
| 32 | |
| 33 | cat $CONFIG_FILE |
| 34 | |
Kiran Kamineni | ac3438c | 2019-03-13 12:24:23 -0700 | [diff] [blame] | 35 | # start multicloud-k8s |
Kiran Kamineni | ad13ac5 | 2019-04-23 12:37:20 -0700 | [diff] [blame] | 36 | docker run --name multicloud-k8s -v $CONFIG_FILE:/opt/multicloud/k8splugin/k8sconfig.json \ |
| 37 | -d nexus3.onap.org:10001/onap/multicloud/k8s:latest |
Kiran Kamineni | ac3438c | 2019-03-13 12:24:23 -0700 | [diff] [blame] | 38 | SERVICE_IP=$(./get-instance-ip.sh multicloud-k8s) |
Kiran Kamineni | ac3438c | 2019-03-13 12:24:23 -0700 | [diff] [blame] | 39 | popd |
| 40 | |
| 41 | if [[ $no_proxy && $no_proxy != *$SERVICE_IP* ]]; then |
| 42 | export no_proxy+=$no_proxy,$SERVICE_IP |
| 43 | fi |
| 44 | |
| 45 | for i in {1..50}; do |
| 46 | curl -sS ${SERVICE_IP}:${SERVICE_PORT} && break |
| 47 | echo sleep $i |
| 48 | sleep $i |
| 49 | done |
| 50 | |
| 51 | # Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 52 | ROBOT_VARIABLES+="-v SERVICE_IP:${SERVICE_IP} " |
| 53 | ROBOT_VARIABLES+="-v SERVICE_PORT:${SERVICE_PORT} " |