/usr/lib/obs/tests/appliance/0100-check_webserver_and_api.ts is in obs-server 2.7.1-10.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 36 37 38 39 40 | #!/bin/bash
export BASH_TAP_ROOT=$(dirname $0)
. $(dirname $0)/bash-tap-bootstrap
plan tests 4
if [ ! -f $HOME/.oscrc ];then
cat <<EOF > $HOME/.oscrc
[general]
apiurl = https://localhost
[https://localhost]
user = Admin
pass = opensuse
EOF
fi
API_VERSION=$(osc api about|grep revision|perl -p -e 's#.*<revision>(.*)</revision>.*#$1#')
RPM_VERSION=$(rpm -q --qf "%{version}\n" obs-server)
is $API_VERSION $RPM_VERSION "Checking api about version"
OSC_UNAUHTORIZED=$(osc -A https://localhost ls 2>&1|grep 401)
[ -z "$OSC_UNAUHTORIZED" ]
is "$?" 0 "Checking authorization for osc"
# test /apidocs
HTTP_OK=$(curl -ik https://localhost/apidocs/ 2>/dev/null |grep "200 OK")
[ -n "$HTTP_OK" ]
is $? 0 "Checking for https://localhost/apidocs/"
STATUS_CODE_200=$(curl -I http://localhost 2>/dev/null|head -1|grep -w 200)
[[ -n $STATUS_CODE_200 ]]
is "$?" 0 "Checking https://localhost for http status code 200"
|