Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add regression test about http transport
Baptiste Daroussin committed 5 years ago
commit 550c570a1d564efe27b924367cc125a399152309
parent fc58373
4 files changed +49 -2
modified .cirrus.yml
@@ -1,5 +1,5 @@
freebsd_task:
-
        install_script: ASSUME_ALWAYS_YES=yes pkg bootstrap -f ; pkg install -y kyua pkgconf
+
        install_script: ASSUME_ALWAYS_YES=yes pkg bootstrap -f ; pkg install -y kyua pkgconf mini_httpd
        script:
                - ./configure
                - make -j4 || make V=1
modified tests/Makefile.autosetup
@@ -53,7 +53,8 @@ TESTS_SH= \
	frontend/shellscript.sh \
	frontend/clean.sh \
	frontend/backup_lib.sh \
-
	frontend/abi.sh
+
	frontend/abi.sh \
+
	frontend/http.sh

merge_OBJS=	lib/merge.o
plist_OBJS=	lib/plist.o
added tests/frontend/http.sh
@@ -0,0 +1,39 @@
+
#! /usr/bin/env atf-sh
+

+
. $(atf_get_srcdir)/test_environment.sh
+

+
tests_init \
+
	simple_repo
+

+
cleanup() {
+
	pkill -15 -F ${TMPDIR}/http.pid
+
}
+

+
simple_repo_body()
+
{
+
	pidfile=${TMPDIR}/http.pid
+
	touch ${pidfile}
+

+
	atf_require mini_httpd "Requires mini_httpd to run this test"
+
	atf_check sh ${RESOURCEDIR}/test_subr.sh new_pkg test test 1
+
	atf_check pkg create -M test.ucl
+
	mkdir repo
+
	mv test-1.txz repo/
+
	atf_check -o ignore pkg repo repo
+

+
	trap cleanup EXIT
+
	atf_check -o empty -e empty mini_httpd -h 127.0.0.1 -p 64242 -d ${TMPDIR}/repo -dd ${TMPDIR}/repo -i ${pidfile}
+

+
	cat > pkg.conf << EOF
+
PKG_DBDIR=${TMPDIR}
+
PKG_CACHEDIR=${TMPDIR}/cache
+
REPOS_DIR=[]
+
repositories: {
+
	local: { url: http://localhost:64242 }
+
}
+
EOF
+
	atf_check -o ignore \
+
		pkg -C ./pkg.conf update
+
	atf_check -o match:"Installing test-1" \
+
		pkg -C ./pkg.conf install -y test
+
}
modified tests/frontend/test_environment.sh.in
@@ -39,3 +39,10 @@ atf_skip_on() {
		atf_skip "$@"
	fi
}
+

+
atf_require() {
+
	if ! which -s $1; then
+
		shift
+
		atf_skip "$@"
+
	fi
+
}