summaryrefslogtreecommitdiff
path: root/scripts/test-in-container.sh
blob: ee389febef4509c249e5024b7074db14b750014d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash -e
#
# Run this script in docker containers. This script installs mscp from built package
# and run test for mscp in the installed path.

source /etc/os-release
script_dir=$(cd $(dirname ${0}) && pwd)
cd $script_dir
project_version=$(cat ../VERSION)
arch=$(uname -p)

set -x

# install package
case $ID in
        ubuntu*)
		pkg=mscp_${project_version}-${ID}-${VERSION_ID}-${arch}.deb
		dpkg -i ../build/$pkg
                ;;
        centos* | rhel*)
		pkg=mscp_${project_version}-${ID}-${VERSION_ID}-${arch}.rpm
		rpm -iv ../build/$pkg
                ;;
        *)
                echo "unsupported test platform: $ID"
                exit 1
esac

# Run sshd
if [ ! -e /var/run/sshd.pid ]; then
	/usr/sbin/sshd
fi

# Run test
python3 -m pytest ../test -v