Skip to content

Commit

Permalink
tests: Stop using "ostree trivial-httpd"
Browse files Browse the repository at this point in the history
I built+installed ostree git master with
ostreedev/ostree#723 in my dev container,
which broke the rpm-ostree tests.  Kind of embarrassing that
I forgot to check rpm-ostree for usage of `ostree trivial-httpd`.

This is another thing that really wants a shared test container.

Anyways let's just use Python for this.
  • Loading branch information
cgwalters committed Mar 16, 2017
1 parent fc93963 commit 1c222ba
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/common/libtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ setup_test_repository () {
cd $oldpwd
}

run_temp_webserver() {
env PYTHONUNBUFFERED=1 setsid python -m SimpleHTTPServer 0 >${test_tmpdir}/httpd-output &
for x in $(seq 50); do
sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output > ${test_tmpdir}/httpd-port
if ! cmp ${test_tmpdir}/httpd-output ${test_tmpdir}/httpd-port 1>/dev/null; then
break
fi
sleep 0.1
done
port=$(cat ${test_tmpdir}/httpd-port)
echo "http://127.0.0.1:${port}" > ${test_tmpdir}/httpd-address
}

setup_fake_remote_repo1() {
mode=$1
args=$2
Expand Down Expand Up @@ -218,9 +231,7 @@ setup_fake_remote_repo1() {
mkdir ${test_tmpdir}/httpd
cd httpd
ln -s ${test_tmpdir}/ostree-srv ostree
ostree trivial-httpd --autoexit --daemonize -p ${test_tmpdir}/httpd-port $args
port=$(cat ${test_tmpdir}/httpd-port)
echo "http://127.0.0.1:${port}" > ${test_tmpdir}/httpd-address
run_temp_webserver
cd ${oldpwd}

export OSTREE="ostree --repo=repo"
Expand Down Expand Up @@ -322,9 +333,7 @@ EOF
mkdir ${test_tmpdir}/httpd
cd httpd
ln -s ${test_tmpdir} ostree
ostree trivial-httpd --autoexit --daemonize -p ${test_tmpdir}/httpd-port $args
port=$(cat ${test_tmpdir}/httpd-port)
echo "http://127.0.0.1:${port}" > ${test_tmpdir}/httpd-address
run_temp_webserver
cd ${oldpwd}
}

Expand Down

0 comments on commit 1c222ba

Please sign in to comment.