mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
Remove previous shell based testing. Show versions report on install test cases.
This commit is contained in:
parent
46033b0dda
commit
4c3775522f
2 changed files with 99 additions and 100 deletions
|
@ -1,100 +0,0 @@
|
||||||
#!/bin/bash -
|
|
||||||
#===============================================================================
|
|
||||||
#
|
|
||||||
# FILE: .travis-ci-test.sh
|
|
||||||
#
|
|
||||||
# USAGE: ./.travis-ci-test.sh
|
|
||||||
#
|
|
||||||
# DESCRIPTION: Run several tests against the bootstrap script
|
|
||||||
#
|
|
||||||
# OPTIONS: ---
|
|
||||||
# REQUIREMENTS: ---
|
|
||||||
# BUGS: https://github.com/saltstack/salt-bootstrap
|
|
||||||
# AUTHOR: Pedro Algarvio (s0undt3ch), pedro@algarvio.me
|
|
||||||
# ORGANIZATION: Salt Stack (saltstack.org)
|
|
||||||
# CREATED: 32/01/2013 06:01:27 PM WET
|
|
||||||
#===============================================================================
|
|
||||||
|
|
||||||
set -o nounset # Treat unset variables as an error
|
|
||||||
|
|
||||||
# Find out the available columns on our tty
|
|
||||||
COLUMNS=$(tput cols || 80)
|
|
||||||
|
|
||||||
if [ $(whoami) != "root" ] ; then
|
|
||||||
title="You need to run this script as root."
|
|
||||||
line="$(printf "%${COLUMNS}s" "")"
|
|
||||||
printf "\033[1;31m%s\033[0m\n" "${line// /*}"
|
|
||||||
printf "\033[1;31m%*s\033[0m\n" $(((${#title}+$COLUMNS)/2)) "$title"
|
|
||||||
printf "\033[1;31m%s\033[0m\n" "${line// /*}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Change to the scripts parent directory
|
|
||||||
cd $(dirname $0)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
title_echo() {
|
|
||||||
title="$1"
|
|
||||||
line="$(printf "%${COLUMNS}s" "")"
|
|
||||||
printf "\033[0;33m%s\033[0m\n" "${line// /*}"
|
|
||||||
printf "\033[0;33m%*s\033[0m\n" $(((${#title}+$COLUMNS)/2)) "$title"
|
|
||||||
}
|
|
||||||
|
|
||||||
failed_echo() {
|
|
||||||
title="FAILED"
|
|
||||||
line="$(printf "%${COLUMNS}s" "")"
|
|
||||||
printf "\033[1;31m%*s\033[0m\n" $(((${#title}+$COLUMNS)/2)) "$title"
|
|
||||||
printf "\033[1;31m%s\033[0m\n" "${line// /*}"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
passed_echo() {
|
|
||||||
title="OK"
|
|
||||||
line="$(printf "%${COLUMNS}s" "")"
|
|
||||||
printf "\033[1;32m%*s\033[0m\n" $(((${#title}+$COLUMNS)/2)) "$title"
|
|
||||||
printf "\033[1;32m%s\033[0m\n" "${line// /*}"
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup() {
|
|
||||||
apt-get remove -y -o DPkg::Options::=--force-confold --purge salt-master salt-minion salt-syndic
|
|
||||||
apt-get autoremove -y -o DPkg::Options::=--force-confold --purge
|
|
||||||
[ -d /tmp/git ] && rm -rf /tmp/git
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
title_echo "Running checkbashisms"
|
|
||||||
/usr/bin/checkbashisms -pxfn bootstrap-salt-minion.sh && passed_echo || failed_echo
|
|
||||||
|
|
||||||
title_echo "Passing '-N'(no minion) without passing '-M'(install master) or '-S'(install syndic) fails"
|
|
||||||
./bootstrap-salt-minion.sh -N && failed_echo || passed_echo
|
|
||||||
|
|
||||||
title_echo "Using an unknown installation type fails"
|
|
||||||
./bootstrap-salt-minion.sh foobar && failed_echo || passed_echo
|
|
||||||
|
|
||||||
title_echo "Installing using bash"
|
|
||||||
(/bin/bash bootstrap-salt-minion.sh && salt-minion --versions-report && cleanup) && passed_echo || failed_echo
|
|
||||||
|
|
||||||
title_echo "Installing using sh"
|
|
||||||
(./bootstrap-salt-minion.sh && salt-minion --versions-report && cleanup) && passed_echo || failed_echo
|
|
||||||
|
|
||||||
title_echo "Installing stable with sh"
|
|
||||||
(./bootstrap-salt-minion.sh stable && salt-minion --versions-report && cleanup) && passed_echo || failed_echo
|
|
||||||
|
|
||||||
title_echo "Installing ubuntu daily packages using sh"
|
|
||||||
(./bootstrap-salt-minion.sh daily && salt-minion --versions-report && cleanup) && passed_echo || failed_echo
|
|
||||||
|
|
||||||
title_echo "Installing stable piped through sh"
|
|
||||||
(cat ./bootstrap-salt-minion.sh | sh && salt-minion --versions-report && cleanup) && passed_echo || failed_echo
|
|
||||||
|
|
||||||
title_echo "Installing latest develop branch from git"
|
|
||||||
(./bootstrap-salt-minion.sh git develop && salt --versions-report && cleanup ) && passed_echo || failed_echo
|
|
||||||
|
|
||||||
title_echo "Installing from a specific git tag"
|
|
||||||
(./bootstrap-salt-minion.sh git v0.12.1 && salt --versions-report && cleanup ) && passed_echo || failed_echo
|
|
||||||
|
|
||||||
title_echo "Installing from a specific git sha commit"
|
|
||||||
(./bootstrap-salt-minion.sh git bf1d7dfb733a6133d6a750e0ab63a27e72cf7e81 && salt --versions-report && cleanup ) && passed_echo || failed_echo
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -67,6 +67,19 @@ class InstallationTestCase(BootstrapTestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Try to get the versions report
|
||||||
|
self.assert_script_result(
|
||||||
|
'Failed to the versions report',
|
||||||
|
0,
|
||||||
|
self.run_script(
|
||||||
|
script=None,
|
||||||
|
args=('salt-minion', '--versions-report'),
|
||||||
|
timeout=15 * 60,
|
||||||
|
stream_stds=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_install_using_sh(self):
|
def test_install_using_sh(self):
|
||||||
self.assert_script_result(
|
self.assert_script_result(
|
||||||
'Failed to install using sh',
|
'Failed to install using sh',
|
||||||
|
@ -77,6 +90,19 @@ class InstallationTestCase(BootstrapTestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Try to get the versions report
|
||||||
|
self.assert_script_result(
|
||||||
|
'Failed to the versions report',
|
||||||
|
0,
|
||||||
|
self.run_script(
|
||||||
|
script=None,
|
||||||
|
args=('salt-minion', '--versions-report'),
|
||||||
|
timeout=15 * 60,
|
||||||
|
stream_stds=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_install_explicit_stable(self):
|
def test_install_explicit_stable(self):
|
||||||
self.assert_script_result(
|
self.assert_script_result(
|
||||||
'Failed to install explicit stable using sh',
|
'Failed to install explicit stable using sh',
|
||||||
|
@ -88,6 +114,19 @@ class InstallationTestCase(BootstrapTestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Try to get the versions report
|
||||||
|
self.assert_script_result(
|
||||||
|
'Failed to the versions report',
|
||||||
|
0,
|
||||||
|
self.run_script(
|
||||||
|
script=None,
|
||||||
|
args=('salt-minion', '--versions-report'),
|
||||||
|
timeout=15 * 60,
|
||||||
|
stream_stds=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_install_daily(self):
|
def test_install_daily(self):
|
||||||
rc, out, err = self.run_script(
|
rc, out, err = self.run_script(
|
||||||
args=('daily',), timeout=15 * 60, stream_stds=True
|
args=('daily',), timeout=15 * 60, stream_stds=True
|
||||||
|
@ -97,6 +136,18 @@ class InstallationTestCase(BootstrapTestCase):
|
||||||
'Failed to install daily',
|
'Failed to install daily',
|
||||||
0, (rc, out, err)
|
0, (rc, out, err)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Try to get the versions report
|
||||||
|
self.assert_script_result(
|
||||||
|
'Failed to the versions report',
|
||||||
|
0,
|
||||||
|
self.run_script(
|
||||||
|
script=None,
|
||||||
|
args=('salt-minion', '--versions-report'),
|
||||||
|
timeout=15 * 60,
|
||||||
|
stream_stds=True
|
||||||
|
)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self.assert_script_result(
|
self.assert_script_result(
|
||||||
'Although system is not Ubuntu, we managed to install',
|
'Although system is not Ubuntu, we managed to install',
|
||||||
|
@ -115,6 +166,18 @@ class InstallationTestCase(BootstrapTestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Try to get the versions report
|
||||||
|
self.assert_script_result(
|
||||||
|
'Failed to the versions report',
|
||||||
|
0,
|
||||||
|
self.run_script(
|
||||||
|
script=None,
|
||||||
|
args=('salt-minion', '--versions-report'),
|
||||||
|
timeout=15 * 60,
|
||||||
|
stream_stds=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def test_install_latest_from_git_develop(self):
|
def test_install_latest_from_git_develop(self):
|
||||||
self.assert_script_result(
|
self.assert_script_result(
|
||||||
'Failed to install using latest git develop',
|
'Failed to install using latest git develop',
|
||||||
|
@ -126,6 +189,18 @@ class InstallationTestCase(BootstrapTestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Try to get the versions report
|
||||||
|
self.assert_script_result(
|
||||||
|
'Failed to the versions report',
|
||||||
|
0,
|
||||||
|
self.run_script(
|
||||||
|
script=None,
|
||||||
|
args=('salt', '--versions-report'),
|
||||||
|
timeout=15 * 60,
|
||||||
|
stream_stds=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def test_install_specific_git_tag(self):
|
def test_install_specific_git_tag(self):
|
||||||
self.assert_script_result(
|
self.assert_script_result(
|
||||||
'Failed to install using specific git tag',
|
'Failed to install using specific git tag',
|
||||||
|
@ -137,6 +212,18 @@ class InstallationTestCase(BootstrapTestCase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Try to get the versions report
|
||||||
|
self.assert_script_result(
|
||||||
|
'Failed to the versions report',
|
||||||
|
0,
|
||||||
|
self.run_script(
|
||||||
|
script=None,
|
||||||
|
args=('salt', '--versions-report'),
|
||||||
|
timeout=15 * 60,
|
||||||
|
stream_stds=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def test_install_specific_git_sha(self):
|
def test_install_specific_git_sha(self):
|
||||||
self.assert_script_result(
|
self.assert_script_result(
|
||||||
'Failed to install using specific git sha',
|
'Failed to install using specific git sha',
|
||||||
|
@ -147,3 +234,15 @@ class InstallationTestCase(BootstrapTestCase):
|
||||||
stream_stds=True
|
stream_stds=True
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Try to get the versions report
|
||||||
|
self.assert_script_result(
|
||||||
|
'Failed to the versions report',
|
||||||
|
0,
|
||||||
|
self.run_script(
|
||||||
|
script=None,
|
||||||
|
args=('salt', '--versions-report'),
|
||||||
|
timeout=15 * 60,
|
||||||
|
stream_stds=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue