golang-client/tools/test-setup.sh
Dean Troyer 753e96dd4a Fix unit tests
* OpenStack CI (Zuul?) puts repos under test in a repo named for the
  running job rather than the actual repo name, Go doesn't like ths.
  Get the actual package name from glide.yaml to build the golang
  workspace rather than the current directory.
* Only install glide on OS/X if it is not already found
* Hack out a bunch of the volume v3 stuff that I should not have merged
  before the unit job was working...the revert fails now too, so this
  is just a fine mess that I am going to clean up now.

Change-Id: I66b359fc1bfd91e686ef0b3f068e582b009e1ea5
2017-01-18 10:52:41 -06:00

55 lines
1.4 KiB
Bash
Executable File

#!/bin/bash -xe
# test-setup.sh - Install required stuffs
# Used in both CI jobs and locally
#
# Install the following tools:
# * glide
# Get OS
case $(uname -s) in
Darwin)
OS=darwin
;;
Linux)
if LSB_RELEASE=$(which lsb_release); then
OS=$($LSB_RELEASE -s -c)
else
# No lsb-release, trya hack or two
if which dpkg 1>/dev/null; then
OS=debian
elif which yum 1>/dev/null || which dnf 1>/dev/null; then
OS=redhat
else
echo "Linux distro not yet supported"
exit 1
fi
fi
;;
*)
echo "Unsupported OS"
exit 1
;;
esac
case $OS in
darwin)
if which brew 1>/dev/null; then
if ! which glide 1>/dev/null; then
brew install glide
fi
else
echo "Homebrew not found, install Glide from source?"
fi
;;
xenial)
APT_GET="DEBIAN_FRONTEND=noninteractive \
apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes"
if ! which add-apt-repository 1>/dev/null; then
sudo $APT_GET install software-properties-common
fi
sudo add-apt-repository --yes ppa:masterminds/glide && sudo apt-get update
sudo $APT_GET install glide
;;
esac