Browse Source

Add tempest configure scripts and rally dockerfiles

Change-Id: I452f73f8af2f9dfbdb970e680062f0ae1af28e33
Victor Ryzhenkin 2 years ago
parent
commit
4f072b79d3

+ 40
- 0
utils/jenkins/prepare_controller.sh View File

@@ -0,0 +1,40 @@
1
+#!/bin/bash -xe
2
+
3
+CONTAINER_MOUNT_HOME_DIR="${CONTAINER_MOUNT_HOME_DIR:-/var/lib/rally-tempest-container-home-dir}"
4
+KEYSTONE_API_VERSION="v2.0"
5
+CA_CERT_PATH="/var/lib/astute/haproxy/public_haproxy.pem"
6
+
7
+if [ ! -d ${CONTAINER_MOUNT_HOME_DIR} ]; then
8
+    mkdir ${CONTAINER_MOUNT_HOME_DIR}
9
+fi
10
+chown 65500 ${CONTAINER_MOUNT_HOME_DIR}
11
+
12
+cp /root/openrc ${CONTAINER_MOUNT_HOME_DIR}/
13
+chown 65500 ${CONTAINER_MOUNT_HOME_DIR}/openrc
14
+echo "export HTTP_PROXY='$CONTROLLER_PROXY_URL'" >> ${CONTAINER_MOUNT_HOME_DIR}/openrc
15
+echo "export HTTPS_PROXY='$CONTROLLER_PROXY_URL'" >> ${CONTAINER_MOUNT_HOME_DIR}/openrc
16
+
17
+IS_TLS=`. openrc; openstack endpoint show identity 2>/dev/null | awk '/https/'`
18
+
19
+if [ "${IS_TLS}" ]; then
20
+    cp ${CA_CERT_PATH} ${CONTAINER_MOUNT_HOME_DIR}/
21
+    chown 65500 ${CONTAINER_MOUNT_HOME_DIR}/$(basename ${CA_CERT_PATH})
22
+    echo "export OS_CACERT='/home/rally/$(basename ${CA_CERT_PATH})'" >> ${CONTAINER_MOUNT_HOME_DIR}/openrc
23
+fi
24
+
25
+cat > ${CONTAINER_MOUNT_HOME_DIR}/bashrc <<EOF
26
+test "\${PS1}" || return
27
+HISTCONTROL=ignoreboth
28
+shopt -s histappend
29
+HISTSIZE=1000
30
+HISTFILESIZE=2000
31
+alias ls=ls\ --color=auto
32
+alias ll=ls\ --color=auto\ -lhap
33
+echo \${PATH} | grep ":\${HOME}/bin" >/dev/null || export PATH="\${PATH}:\${HOME}/bin"
34
+if [ \$(id -u) -eq 0 ]; then
35
+    export PS1='\[\033[01;41m\]\u@\h:\[\033[01;44m\] \W \[\033[01;41m\] #\[\033[0m\] '
36
+else
37
+    export PS1='\[\033[01;33m\]\u@\h\[\033[01;0m\]:\[\033[01;34m\]\W\[\033[01;0m\]$ '
38
+fi
39
+source /home/rally/openrc
40
+EOF

+ 18
- 0
utils/jenkins/rally-tempest/latest/Dockerfile View File

@@ -0,0 +1,18 @@
1
+FROM rallyforge/rally:latest
2
+MAINTAINER Yaroslav Lobankov <ylobankov@mirantis.com>
3
+
4
+# We need to switch to 'root' user to avoid permission issues.
5
+USER root
6
+
7
+WORKDIR /tmp
8
+RUN git clone https://git.openstack.org/openstack/tempest && \
9
+    pip install -r tempest/requirements.txt -r tempest/test-requirements.txt && \
10
+    mv tempest/ /var/lib/
11
+
12
+COPY setup_tempest.sh /usr/bin/setup-tempest
13
+RUN chown rally /usr/bin/setup-tempest
14
+
15
+WORKDIR /home/rally
16
+
17
+# Switch to 'rally' user back.
18
+USER rally

+ 11
- 0
utils/jenkins/rally-tempest/latest/setup_tempest.sh View File

@@ -0,0 +1,11 @@
1
+#!/bin/bash -xe
2
+
3
+source /home/rally/openrc
4
+
5
+rally-manage db recreate
6
+rally deployment create --fromenv --name=tempest
7
+rally verify install --source /var/lib/tempest
8
+rally verify genconfig
9
+rally verify showconfig
10
+rally verify installplugin --source https://github.com/openstack/murano
11
+rally verify listplugins

+ 97
- 0
utils/jenkins/tempest_tests.sh View File

@@ -0,0 +1,97 @@
1
+#!/usr/bin/env bash
2
+set -x
3
+
4
+export SSH_OPTS='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
5
+export FUEL_PASSWD='r00tme'
6
+
7
+SNAPSHOT_NAME=$(dos.py snapshot-list "$ENV_NAME" | tail -1 | awk '{print $1}')
8
+
9
+dos.py revert-resume "$ENV_NAME" "$SNAPSHOT_NAME"
10
+
11
+ADMIN_NODE_IP=$(dos.py net-list $ENV_NAME | tail -1 | awk '{print $2}' | sed 's|/.*||g' | sed 's|.$|2|g')
12
+
13
+echo "LOG: fuel-master ip=$ADMIN_NODE_IP"
14
+
15
+CONTROLLER_ID=`echo 'fuel node | \
16
+                     grep controller | \
17
+                     awk '\''{print $1}'\'' | \
18
+                     head -1' | \
19
+                     sshpass -p "$FUEL_PASSWD" \
20
+              ssh ${SSH_OPTS} -T root@"$ADMIN_NODE_IP"`
21
+
22
+wget -qO- https://get.docker.com/ | sh
23
+
24
+##### Generating docker file and copying it to admin node,#####
25
+##### and then to controller node                         #####
26
+sudo -H docker build -t rally-tempest "$WORKSPACE/utils/jenkins/rally-tempest/latest"
27
+sudo -H docker save -o ./dimage rally-tempest
28
+sudo chown "${USER}:${USER}" ./dimage
29
+sshpass -p "$FUEL_PASSWD" scp ${SSH_OPTS} dimage root@"$ADMIN_NODE_IP":/root/rally
30
+
31
+echo "scp /root/rally node-$CONTROLLER_ID:/root/rally" | sshpass -p "$FUEL_PASSWD" ssh ${SSH_OPTS} -T root@"$ADMIN_NODE_IP"
32
+
33
+echo 'wget -qO- https://get.docker.com/ | sh' > ssh_scr.sh
34
+
35
+cat "$WORKSPACE/utils/jenkins/prepare_controller.sh" >> ssh_scr.sh
36
+
37
+echo '' >> ssh_scr.sh
38
+
39
+cat >> ssh_scr.sh <<'EOF'
40
+
41
+docker load -i /root/rally
42
+ID=$(docker images | awk '/rally/ {print $3}')
43
+echo "LOG: INFO rally image id=$ID"
44
+
45
+export DOCK_ID=$(docker run -tid -v /var/lib/rally-tempest-container-home-dir:/home/rally --net host "$ID")
46
+
47
+sed -i "s|:5000|:5000/v2.0|g" /var/lib/rally-tempest-container-home-dir/openrc
48
+
49
+docker exec -u root "$DOCK_ID" sed -i "s|\#swift_operator_role = Member|swift_operator_role=SwiftOperator|g" /etc/rally/rally.conf
50
+docker exec "$DOCK_ID" setup-tempest
51
+
52
+tempest_file=$(find / -name tempest.conf)
53
+
54
+sed -i "79i max_template_size = 5440000" $tempest_file
55
+sed -i "80i max_resources_per_stack = 20000" $tempest_file
56
+sed -i "81i max_json_body_size = 10880000" $tempest_file
57
+sed -i "24i volume_device_name = vdc" $tempest_file
58
+sed -i "/[service_available]/a murano = True" $tempest_file
59
+sed -i "/[service_available]/a glare = True" $tempest_file
60
+
61
+echo "[application_catalog]" >> $tempest_file
62
+echo "glare_backend = True" >> $tempest_file
63
+
64
+deployment=$(docker exec "$DOCK_ID" bash -c "rally deployment list | awk '/tempest/ {print \$2}'")
65
+
66
+docker exec "$DOCK_ID" bash -c "source /home/rally/openrc && rally verify start --regex application_catalog --concurrency 2"
67
+
68
+docker exec "$DOCK_ID" bash -c "rally verify results --json --output-file output.json"
69
+docker exec "$DOCK_ID" bash -c "rm -rvf rally_json2junit && git clone https://github.com/greatehop/rally_json2junit && python rally_json2junit/rally_json2junit/results_parser.py output.json"
70
+EOF
71
+
72
+chmod +x ssh_scr.sh
73
+
74
+##### Copying script to master node, then to controller #####
75
+sshpass -p "$FUEL_PASSWD" scp ${SSH_OPTS} ssh_scr.sh root@"$ADMIN_NODE_IP":/root/ssh_scr.sh
76
+echo "scp /root/ssh_scr.sh node-$CONTROLLER_ID:/root/ssh_scr.sh" | sshpass -p "$FUEL_PASSWD" ssh ${SSH_OPTS} -T root@"$ADMIN_NODE_IP"
77
+
78
+##### Executing script from admin node on controller node: #####
79
+EXEC_CMD="echo 'chmod +x /root/ssh_scr.sh && /bin/bash -xe /root/ssh_scr.sh > /root/log.log' | ssh -T node-$CONTROLLER_ID"
80
+echo "$EXEC_CMD" | sshpass -p "$FUEL_PASSWD" ssh ${SSH_OPTS} -T root@"$ADMIN_NODE_IP"
81
+
82
+##########################################################
83
+##### Copying results from controller to admin node: #####
84
+##### and then to host in workspace folder           #####
85
+##########################################################
86
+GET_RES_CMD="scp node-$CONTROLLER_ID:/var/lib/rally-tempest-container-home-dir/verification.xml /root/verification.xml"
87
+echo "$GET_RES_CMD" |  sshpass -p "$FUEL_PASSWD" ssh ${SSH_OPTS} -T root@"$ADMIN_NODE_IP"
88
+sshpass -p "$FUEL_PASSWD" scp ${SSH_OPTS} root@"$ADMIN_NODE_IP":/root/verification.xml "$WORKSPACE/logs/"
89
+
90
+GET_LOG_CMD="scp node-$CONTROLLER_ID:/root/log.log /root/log.log"
91
+echo "$GET_LOG_CMD" |  sshpass -p "$FUEL_PASSWD" ssh ${SSH_OPTS} -T root@"$ADMIN_NODE_IP"
92
+sshpass -p "$FUEL_PASSWD" scp ${SSH_OPTS} root@"$ADMIN_NODE_IP":/root/log.log "$WORKSPACE/logs/"
93
+
94
+sudo rm -vf dimage
95
+sudo rm -vf ssh_scr.sh
96
+
97
+set +x

Loading…
Cancel
Save