blob: 4b8f60be75f03f890d72e4e7f758ad55652d516a [file] [log] [blame]
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +02001#!/usr/bin/env bash
2
3saveenv=$-
4set -e
Brian Haley4f971492020-02-17 16:40:33 -05005
6# install_octavia_tempest_plugin
7function install_octavia_tempest_plugin {
8 setup_dev_lib "octavia-tempest-plugin"
9}
10
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +020011function build_backend_test_server {
12 if is_fedora || is_ubuntu; then
13 install_package golang
14 else
15 die "Distribution not supported. Supported distributions are: RHEL, CentOS, Fedora, Ubuntu"
16 fi
17
18 go_path=$(find $DEST/tempest/.tox/tempest/ -name test_server.go)
19 bin_path=${go_path%.go}.bin
20 CGO_ENABLED=0 GOOS=linux go build \
21 -a -ldflags '-s -w -extldflags -static' -o $bin_path \
22 ${DEST}/octavia-tempest-plugin/octavia_tempest_plugin/contrib/test_server/test_server.go
23}
24
Brian Haley4f971492020-02-17 16:40:33 -050025if [[ "$1" == "stack" ]]; then
26 case "$2" in
27 install)
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +020028 # Install dev library if
29 # - the release is more recent than stein (devstack in stein would
30 # try to install it in a python2 env, but octavia-tempest-plugin is
31 # now a python3-only project)
32 # - or the user explicitly requests it (INSTALL_TEMPEST=True)
33 if [[ "$DEVSTACK_SERIES" != "stein" ]] || [[ "$(trueorfalse False INSTALL_TEMPEST)" == "True" ]]; then
34 echo_summary "Installing octavia-tempest-plugin"
35 install_octavia_tempest_plugin
36 fi
37 ;;
38 test-config)
39 echo_summary "Building backend test server"
40 build_backend_test_server
Brian Haley4f971492020-02-17 16:40:33 -050041 ;;
42 esac
43fi
Carlos Goncalvesf077c3a2020-10-19 11:17:26 +020044
45if [[ $saveenv =~ e ]]; then
46 set -e
47else
48 set +e
49fi