Browse Source

Add gate_hook and post_test_hook

We are setting up a devstack job for this plugin. These hooks will
be leveraged by the job.

Change-Id: I751c46bcc1768894f588c0f6689555a4392082b0
Hongbin Lu 2 years ago
parent
commit
a6365b0570
3 changed files with 66 additions and 0 deletions
  1. 21
    0
      contrib/gate_hook.sh
  2. 44
    0
      contrib/post_test_hook.sh
  3. 1
    0
      devstack/lib/docker

+ 21
- 0
contrib/gate_hook.sh View File

@@ -0,0 +1,21 @@
1
+#!/bin/bash -x
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 gate_hook function in devstack gate.
16
+
17
+
18
+# Keep all devstack settings here instead of project-config for easy
19
+# maintain if we want to change devstack config settings in future.
20
+
21
+$BASE/new/devstack-gate/devstack-vm-gate.sh

+ 44
- 0
contrib/post_test_hook.sh View File

@@ -0,0 +1,44 @@
1
+#!/bin/bash -x
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
+# Sleep some time until all services are starting
18
+sleep 5
19
+
20
+# Check if a function already exists
21
+function function_exists {
22
+    declare -f -F $1 > /dev/null
23
+}
24
+
25
+if ! function_exists echo_summary; then
26
+    function echo_summary {
27
+        echo $@
28
+    }
29
+fi
30
+
31
+# Save trace setting
32
+XTRACE=$(set +o | grep xtrace)
33
+set -o xtrace
34
+
35
+echo_summary "Devstack-plugin-container's post_test_hook.sh was called..."
36
+(set -o posix; set)
37
+
38
+# Verify that Docker is installed correctly by running the hello-world image
39
+sudo -H -u stack docker run hello-world
40
+
41
+EXIT_CODE=$?
42
+
43
+$XTRACE
44
+exit $EXIT_CODE

+ 1
- 0
devstack/lib/docker View File

@@ -48,6 +48,7 @@ function install_docker {
48 48
     local arch=$(dpkg --print-architecture)
49 49
     if is_ubuntu; then
50 50
         apt_get install linux-image-extra-$(uname -r) linux-image-extra-virtual
51
+        apt_get install apt-transport-https ca-certificates software-properties-common
51 52
         curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
52 53
         sudo add-apt-repository -y \
53 54
             "deb [arch=${arch}] https://download.docker.com/linux/${lsb_dist} \

Loading…
Cancel
Save