aboutsummaryrefslogtreecommitdiffstats
path: root/test-apis-ci/sdc-api-tests/startup.sh
blob: 7b102cadfd2d9f4fcdb89e3f4b6d0c2ba6a4f3b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash

# prepare env for HTTPS if used

is_https=$(cat /root/chef-solo/environments/${ENVNAME}.json | \
    jq -cr '.default_attributes.disableHttp' | \
    tr '[:upper:]' '[:lower:]')

if [ "$is_https" = true ] ; then
    # setup /etc/hosts
    SDC_FE_IP=$(cat /root/chef-solo/environments/${ENVNAME}.json | \
        jq -cr '.default_attributes.Nodes.FE')
    SDC_FE_HOSTNAME=$(cat /root/chef-solo/environments/${ENVNAME}.json | \
        jq -cr '.override_attributes.FE.domain_name')
    if ! grep -q "^[[:space:]]*${SDC_FE_IP}[[:space:]]" ; then
        echo "${SDC_FE_IP}" "${SDC_FE_HOSTNAME}" >> /etc/hosts
    fi
fi

# run tests

cd /root/chef-solo
chef-solo -c solo.rb -E ${ENVNAME}

rc=$?

if [[ $rc != 0 ]]; then
   echo "Startup failed !!!"
   exit $rc
else
# Note that the output below is monitored in CSIT by
# sdc/sdc-os-chef/scripts/docker_run.sh
# If this text is changed, docker_run.sh check for sdc-api-tests docker
# startup must be adjusted accordingly!
   echo "Startup completed successfully"
fi