summaryrefslogtreecommitdiffstats
path: root/tools/test.sh
blob: 7f3cf59078a204042c1ee7436be4e55fe50258b4 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash

set -e

# Implements run of the OPNFV functional tests (Functest)
# https://wiki.opnfv.org/pages/viewpage.action?pageId=29098314

export FUNCTEST_CACHE=${FUNCTEST_CACHE:-"${HOME}/.opnfv/functest"}
export SITE=${2:-"intel-pod17"}

cp tools/files/tempest_conf.yaml ${FUNCTEST_CACHE}
cp tools/files/rally_blacklist.yaml ${FUNCTEST_CACHE}
cp tools/files/tempest_blacklist.yaml ${FUNCTEST_CACHE}
TMP_DIR=$(mktemp -d)
cd $TMP_DIR

trap "{ sudo rm -rf $TMP_DIR; }" EXIT


cat > env << EOF
S3_ENDPOINT_URL=https://storage.googleapis.com
S3_DST_URL=s3://artifacts.opnfv.org/xtesting/test
HTTP_DST_URL=http://artifacts.opnfv.org/xtesting/test
TEST_DB_URL=http://testresults.opnfv.org/test/api/v1/results
TEST_DB_EXT_URL=http://testresults.opnfv.org/test/api/v1/results
EXTERNAL_NETWORK=public
BLOCK_MIGRATION=False
DEPLOY_SCENARIO=ovs
NO_TENANT_NETWORK=true
FLAVOR_EXTRA_SPECS=hw:mem_page_size:large
NEW_USER_ROLE=_member_
EOF

cat > openstack.env << EOF
export OS_AUTH_URL=http://identity-nc.$SITE.opnfv.org/v3
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_DOMAIN_NAME=default
export OS_USERNAME=admin
export OS_PROJECT_NAME=admin
export OS_PASSWORD=0bbaf9908f63abec8ffb
export OS_IDENTITY_API_VERSION=3
export OS_INTERFACE=public
export OS_REGION_NAME=$SITE
EOF

# check/download images
if [ ! -d $FUNCTEST_CACHE ]; then
  mkdir -p $FUNCTEST_CACHE/images && cd $FUNCTEST_CACHE
  wget -q -O- https://git.opnfv.org/functest/plain/functest/ci/download_images.sh?h=stable/iruya | bash -s -- images
  cd $TMP_DIR
fi


help() {
  echo "Usage: $0 <healthcheck|smoke|vnf>"
}


run_tests() {

  sudo rm -rf ${FUNCTEST_CACHE}/results && mkdir ${FUNCTEST_CACHE}/results
  sudo docker pull opnfv/functest-${1}:iruya
  sudo docker run -it --env-file env --network host \
      -v $(pwd)/openstack.env:/home/opnfv/functest/conf/env_file \
      -v ${FUNCTEST_CACHE}/.boto:/root/.boto \
      -v ${FUNCTEST_CACHE}/images:/home/opnfv/functest/images \
      -v ${FUNCTEST_CACHE}/results:/home/opnfv/functest/results \
      -v ${FUNCTEST_CACHE}/tempest_conf.yaml:/usr/lib/python3.6/site-packages/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml \
      -v ${FUNCTEST_CACHE}/tempest_blacklist.yaml:/usr/lib/python3.6/site-packages/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.yaml \
      -v ${FUNCTEST_CACHE}/rally_blacklist.yaml:/usr/lib/python3.6/site-packages/functest/opnfv_tests/openstack/rally/blacklist.yaml \
      -v /home/ubuntu/nc/functest/functest/core/singlevm.py:/usr/lib/python3.6/site-packages/functest/core/singlevm.py \
      opnfv/functest-${1}:iruya bash
}

case "$1" in
'healthcheck')
  run_tests $1
  ;;
'smoke')
  run_tests $1
  ;;
'benchmarking')
  run_tests $1
  ;;
'vnf')
  run_tests $1
  ;;
*) help
   exit 1
  ;;
esac