Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | saveenv=$- |
| 4 | set -e |
Brian Haley | 4f97149 | 2020-02-17 16:40:33 -0500 | [diff] [blame] | 5 | |
| 6 | # install_octavia_tempest_plugin |
| 7 | function install_octavia_tempest_plugin { |
| 8 | setup_dev_lib "octavia-tempest-plugin" |
| 9 | } |
| 10 | |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 11 | function 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 Haley | 4f97149 | 2020-02-17 16:40:33 -0500 | [diff] [blame] | 25 | if [[ "$1" == "stack" ]]; then |
| 26 | case "$2" in |
| 27 | install) |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 28 | # 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 Haley | 4f97149 | 2020-02-17 16:40:33 -0500 | [diff] [blame] | 41 | ;; |
| 42 | esac |
| 43 | fi |
Carlos Goncalves | f077c3a | 2020-10-19 11:17:26 +0200 | [diff] [blame] | 44 | |
| 45 | if [[ $saveenv =~ e ]]; then |
| 46 | set -e |
| 47 | else |
| 48 | set +e |
| 49 | fi |