Browse Source

Manila: add pre_, post_ test_hook scripts for CI

Add pre_test_hook and post_test_hook scripts that enables Manila to
be setup with one of the GlusterFS based drivers as the backend
share_drive, and allows Tempest test cases to run with the Manila
setup.

Change-Id: I60c715350b8e53a7e19667574ce0e5ef02e51f22
changes/44/213044/2
Ramana Raja 3 years ago
parent
commit
858b2443f1
2 changed files with 134 additions and 0 deletions
  1. 84
    0
      manila/post_test_hook.sh
  2. 50
    0
      manila/pre_test_hook.sh

+ 84
- 0
manila/post_test_hook.sh View File

@@ -0,0 +1,84 @@
1
+#!/bin/bash -xe
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+# not use this file except in compliance with the License. You may obtain
5
+# a copy of the License at
6
+#
7
+# http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+# License for the specific language governing permissions and limitations
13
+# under the License.
14
+
15
+# This script is executed inside post_test_hook function in devstack gate.
16
+
17
+sudo chown -R jenkins:stack $BASE/new/tempest
18
+sudo chown -R jenkins:stack $BASE/data/tempest
19
+sudo chmod -R o+rx $BASE/new/devstack/files
20
+
21
+# Import devstack functions 'iniset'
22
+source $BASE/new/devstack/functions
23
+
24
+
25
+
26
+if [[ "$JOB_NAME" =~ "glusterfs-native" ]]; then
27
+    local BACKEND_NAME="GLUSTERNATIVE"
28
+    iniset $BASE/new/tempest/etc/tempest.conf share enable_protocols glusterfs
29
+    iniset $BASE/new/tempest/etc/tempest.conf share storage_protocol GLUSTERFS
30
+else
31
+    local BACKEND_NAME="GLUSTERFS"
32
+    iniset $BASE/new/tempest/etc/tempest.conf share enable_protocols nfs
33
+    iniset $BASE/new/tempest/etc/tempest.conf share enable_ip_rules_for_protocols nfs
34
+    iniset $BASE/new/tempest/etc/tempest.conf share storage_protocol NFS
35
+fi
36
+
37
+
38
+iniset $BASE/new/tempest/etc/tempest.conf share backend_names $BACKEND_NAME
39
+
40
+# Set two retries for CI jobs
41
+iniset $BASE/new/tempest/etc/tempest.conf share share_creation_retry_number 2
42
+
43
+# Suppress errors in cleanup of resources
44
+SUPPRESS_ERRORS=${SUPPRESS_ERRORS_IN_CLEANUP:-True}
45
+iniset $BASE/new/tempest/etc/tempest.conf share suppress_errors_in_cleanup $SUPPRESS_ERRORS
46
+
47
+
48
+# Disable multi_backend tests
49
+RUN_MANILA_MULTI_BACKEND_TESTS=${RUN_MANILA_MULTI_BACKEND_TESTS:-False}
50
+iniset $BASE/new/tempest/etc/tempest.conf share multi_backend $RUN_MANILA_MULTI_BACKEND_TESTS
51
+
52
+# Disable manage/unmanage tests
53
+RUN_MANILA_MANAGE_TESTS=${RUN_MANILA_MANAGE_TESTS:-False}
54
+iniset $BASE/new/tempest/etc/tempest.conf share run_manage_unmanage_tests $RUN_MANILA_MANAGE_TESTS
55
+
56
+# Disable extend tests
57
+RUN_MANILA_EXTEND_TESTS=${RUN_MANILA_EXTEND_TESTS:-False}
58
+iniset $BASE/new/tempest/etc/tempest.conf share run_extend_tests $RUN_MANILA_EXTEND_TESTS
59
+
60
+# Disable shrink tests
61
+RUN_MANILA_SHRINK_TESTS=${RUN_MANILA_SHRINK_TESTS:-False}
62
+iniset $BASE/new/tempest/etc/tempest.conf share run_shrink_tests $RUN_MANILA_SHRINK_TESTS
63
+
64
+# Disable multi_tenancy tests
65
+iniset $BASE/new/tempest/etc/tempest.conf share multitenancy_enabled False
66
+
67
+# Disable snapshot tests
68
+RUN_MANILA_SNAPSHOT_TESTS=${RUN_MANILA_SNAPSHOT_TESTS:-False}
69
+iniset $BASE/new/tempest/etc/tempest.conf share run_snapshot_tests $RUN_MANILA_SNAPSHOT_TESTS
70
+
71
+# let us control if we die or not
72
+set +o errexit
73
+cd $BASE/new/tempest
74
+
75
+export MANILA_TEMPEST_CONCURRENCY=${MANILA_TEMPEST_CONCURRENCY:-12}
76
+export MANILA_TESTS=${MANILA_TESTS:-'tempest.api.share*'}
77
+
78
+if [[ "$JOB_NAME" =~ "scenario" ]]; then
79
+    echo "Set test set to scenario only"
80
+    MANILA_TESTS='tempest.scenario.*share*'
81
+fi
82
+
83
+echo "Running tempest manila test suites"
84
+sudo -H -u jenkins tox -eall $MANILA_TESTS -- --concurrency=$MANILA_TEMPEST_CONCURRENCY

+ 50
- 0
manila/pre_test_hook.sh View File

@@ -0,0 +1,50 @@
1
+#!/bin/bash -xe
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+# not use this file except in compliance with the License. You may obtain
5
+# a copy of the License at
6
+#
7
+# http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+# License for the specific language governing permissions and limitations
13
+# under the License.
14
+
15
+# This script is executed inside pre_test_hook function in devstack gate.
16
+
17
+localrc_path=$BASE/new/devstack/localrc
18
+echo "DEVSTACK_GATE_TEMPEST_ALLOW_TENANT_ISOLATION=1" >> $localrc_path
19
+echo "API_RATE_LIMIT=False" >> $localrc_path
20
+echo "TEMPEST_SERVICES+=,manila" >> $localrc_path
21
+
22
+echo "MANILA_USE_DOWNGRADE_MIGRATIONS=True" >> $localrc_path
23
+
24
+# JOB_NAME is defined in openstack-infra/config project
25
+# used by CI/CD, where this script is intended to be used.
26
+if [[ "$JOB_NAME" =~ "multibackend" ]]; then
27
+    echo "MANILA_MULTI_BACKEND=True" >> $localrc_path
28
+else
29
+    echo "MANILA_MULTI_BACKEND=False" >> $localrc_path
30
+fi
31
+
32
+# Enabling isolated metadata in Neutron is required because
33
+# Tempest creates isolated networks and created vm's in scenario tests don't
34
+# have access to Nova Metadata service. This leads to unavailability of
35
+# created vm's in scenario tests.
36
+echo '[[post-config|$Q_DHCP_CONF_FILE]]' >> $localrc_path
37
+echo '[DEFAULT]' >> $localrc_path
38
+echo "enable_isolated_metadata=True" >> $localrc_path
39
+
40
+# Go to Tempest dir and checkout stable commit to avoid possible
41
+# incompatibilities for plugin stored in Manila repo.
42
+TEMPEST_COMMIT="489f5e62"  # 15 June, 2015
43
+cd $BASE/new/tempest
44
+git checkout $TEMPEST_COMMIT
45
+
46
+# Print current Tempest status
47
+git status
48
+
49
+# Install Manila Tempest integration
50
+cp -r $BASE/new/manila/contrib/tempest/tempest/* $BASE/new/tempest/tempest

Loading…
Cancel
Save