Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
tests: amend the pubkey test for both new and legacy format
Kyle Evans committed 5 years ago
commit 6f138bd11d9988b93d880833eb12a6f8d53eadcb
parent e38ecd1
1 file changed +46 -1
modified tests/frontend/pubkey.sh
@@ -3,8 +3,10 @@
. $(atf_get_srcdir)/test_environment.sh

tests_init \
-
	pubkey
+
	pubkey \
+
	pubkey_legacy

+
# New format, prefix the key type
pubkey_body() {
	atf_check -o ignore -e ignore \
		openssl genrsa -out repo.key 2048
@@ -31,6 +33,48 @@ EOF
	atf_check -o ignore -e ignore \
		pkg create -M test.ucl -o fakerepo
	atf_check -o ignore -e ignore \
+
		pkg repo fakerepo rsa:repo.key
+
	cat >> repo.conf << EOF
+
local: {
+
	url: file:///${TMPDIR}/fakerepo
+
	enabled: true
+
	pubkey: ${TMPDIR}/repo.pub
+
	signature_type: "pubkey"
+
}
+
EOF
+
	atf_check \
+
		-o ignore \
+
		pkg -o REPOS_DIR="${TMPDIR}" \
+
		-o ${PKG_CACHEDIR}="${TMPDIR}" update
+
}
+

+
# Legacy format, unprefixed key passed to pkg-repo
+
pubkey_legacy_body() {
+
	atf_check -o ignore -e ignore \
+
		openssl genrsa -out repo.key 2048
+
	chmod 0400 repo.key
+
	atf_check -o ignore -e ignore \
+
		openssl rsa -in repo.key -out repo.pub -pubout
+
	mkdir fakerepo
+

+
	cat >> test.ucl << EOF
+
name: test
+
origin: test
+
version: "1"
+
maintainer: test
+
categories: [test]
+
comment: a test
+
www: http://test
+
prefix: /
+
abi = "*";
+
desc: <<EOD
+
Yet another test
+
EOD
+
EOF
+

+
	atf_check -o ignore -e ignore \
+
		pkg create -M test.ucl -o fakerepo
+
	atf_check -o ignore -e ignore \
		pkg repo fakerepo repo.key
	cat >> repo.conf << EOF
local: {
@@ -45,3 +89,4 @@ EOF
		pkg -o REPOS_DIR="${TMPDIR}" \
		-o ${PKG_CACHEDIR}="${TMPDIR}" update
}
+