Skip to content

Commit

Permalink
add test for publishing distribution with slash (/)
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Apr 11, 2024
1 parent 287a947 commit 2a2e35c
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 0 deletions.
10 changes: 10 additions & 0 deletions deb/publish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ func (s *PublishedRepoSuite) TestNewPublishedRepo(c *C) {

_, err := NewPublishedRepo("", ".", "a", nil, []string{"main", "main"}, []interface{}{s.snapshot, s.snapshot2}, s.factory)
c.Check(err, ErrorMatches, "duplicate component name: main")

_, err = NewPublishedRepo("", ".", "wheezy/updates", nil, []string{"main"}, []interface{}{s.snapshot}, s.factory)
c.Check(err, IsNil)
}

func (s *PublishedRepoSuite) TestPrefixNormalization(c *C) {
Expand Down Expand Up @@ -287,6 +290,13 @@ func (s *PublishedRepoSuite) TestDistributionComponentGuessing(c *C) {
c.Check(repo.Distribution, Equals, "precise")
c.Check(repo.Components(), DeepEquals, []string{"contrib"})

s.localRepo.DefaultDistribution = "precise/updates"

repo, err = NewPublishedRepo("", "ppa", "", nil, []string{""}, []interface{}{s.localRepo}, s.factory)
c.Check(err, IsNil)
c.Check(repo.Distribution, Equals, "precise/updates")
c.Check(repo.Components(), DeepEquals, []string{"contrib"})

repo, err = NewPublishedRepo("", "ppa", "", nil, []string{"", "contrib"}, []interface{}{s.snapshot, s.snapshot2}, s.factory)
c.Check(err, IsNil)
c.Check(repo.Distribution, Equals, "squeeze")
Expand Down
23 changes: 23 additions & 0 deletions system/t04_mirror/UpdateMirror25Test_gold
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

Download Error: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages
Download Error: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages.gz
Download Error: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages.xz
Downloading & parsing package files...
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/InRelease
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages.gz
Downloading: http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages.xz
ERROR: unable to update: HTTP code 404 while fetching http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages
Error (retrying): HTTP code 404 while fetching http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages
Error (retrying): HTTP code 404 while fetching http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages.gz
Error (retrying): HTTP code 404 while fetching http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages.xz
Retrying 0 http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages...
Retrying 0 http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages.gz...
Retrying 0 http://repo.aptly.info/system-tests/archive.debian.org/debian-security/dists/stretch/updates/main/binary-i386/Packages.xz...
gpgv: using RSA key 379483D8B60160B155B372DDAA8E81B4331F7F50
gpgv: using RSA key 5237CEEEF212F3D51C74ABE0112695A0E562B32A
gpgv: Good signature from "Debian Security Archive Automatic Signing Key (10/buster) <ftpmaster@debian.org>"
gpgv: Good signature from "Debian Security Archive Automatic Signing Key (9/stretch) <ftpmaster@debian.org>"
gpgv: Signature made Sat Feb 18 04:22:45 2023 UTC
gpgv: Signature made Sat Feb 18 04:22:45 2023 UTC
gpgv: can't allocate lock for '/home/runner/.gnupg/aptlytest.gpg'
15 changes: 15 additions & 0 deletions system/t04_mirror/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,18 @@ class UpdateMirror24Test(BaseTest):
]
runCmd = "aptly mirror update -keyring=aptlytest.gpg trusty"
outputMatchPrepare = filterOutSignature


class UpdateMirror25Test(BaseTest):
"""
update mirrors: mirror with / in distribution
"""
configOverride = {"max-tries": 1}
sortOutput = True
longTest = False
fixtureGpg = True
fixtureCmds = [
"aptly -architectures='i386' mirror create -keyring=aptlytest.gpg -with-sources mirror19 http://repo.aptly.info/system-tests/archive.debian.org/debian-security/ stretch/updates main"
]
runCmd = "aptly mirror update -keyring=aptlytest.gpg mirror19"
outputMatchPrepare = filterOutSignature
14 changes: 14 additions & 0 deletions system/t06_publish/PublishSnapshot41Test_gold
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:

Snapshot snap41 has been successfully published.
Please setup your webserver to serve directory '/home/runner/.aptly/public' with autoindexing.
Now you can add following line to apt sources:
deb http://your-server/ buster/updates main
deb-src http://your-server/ buster/updates main
Don't forget to add your GPG key to apt with apt-key.

You can also use `aptly serve` to publish your repositories over HTTP quickly.
104 changes: 104 additions & 0 deletions system/t06_publish/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,3 +1240,107 @@ def check(self):
self.check_exists('public/dists/maverick/main/binary-amd64/Packages')
self.check_exists('public/dists/maverick/main/binary-amd64/Packages.gz')
self.check_not_exists('public/dists/maverick/main/binary-amd64/Packages.bz2')


class PublishSnapshot41Test(BaseTest):
"""
publish snapshot: mirror with / in distribution
"""
configOverride = {"max-tries": 1}
fixtureGpg = True
fixtureCmds = [
"aptly -architectures='i386' mirror create -keyring=aptlytest.gpg -with-sources -filter='nginx | Priority (required)'" # continued on next line
" -filter-with-deps=true ps41 http://repo.aptly.info/system-tests/security.debian.org/debian-security buster/updates main",
"aptly mirror update -keyring=aptlytest.gpg ps41",
"aptly snapshot create snap41 from mirror ps41",
]
runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap41"
gold_processor = BaseTest.expand_environ

def check(self):
super(PublishSnapshot41Test, self).check()

self.check_exists('public/dists/buster/updates/Release')
self.check_exists('public/dists/buster/updates/Release.gpg')
self.check_exists('public/dists/buster/updates/InRelease')
self.check_exists('public/dists/buster/updates/main/source/Release')
self.check_exists('public/dists/buster/updates/main/source/Sources')
self.check_exists('public/dists/buster/updates/main/source/Sources.gz')
self.check_exists('public/dists/buster/updates/main/source/Sources.bz2')
self.check_exists('public/dists/buster/updates/main/binary-i386/Packages')
self.check_exists('public/dists/buster/updates/main/binary-i386/Packages.gz')
self.check_exists('public/dists/buster/updates/main/binary-i386/Packages.bz2')
self.check_exists('public/dists/buster/updates/main/binary-i386/Release')
self.check_exists('public/dists/buster/updates/main/Contents-i386.gz')
self.check_exists('public/dists/buster/updates/Contents-i386.gz')
self.check_exists('public/pool/main/u/util-linux/bsdutils_2.33.1-0.1+deb10u1_i386.deb')
self.check_exists('public/pool/main/u/util-linux/fdisk_2.33.1-0.1+deb10u1_i386.deb')
self.check_exists('public/pool/main/u/util-linux/libblkid1_2.33.1-0.1+deb10u1_i386.deb')
self.check_exists('public/pool/main/u/util-linux/libfdisk1_2.33.1-0.1+deb10u1_i386.deb')
self.check_exists('public/pool/main/u/util-linux/libmount1_2.33.1-0.1+deb10u1_i386.deb')
self.check_exists('public/pool/main/u/util-linux/libsmartcols1_2.33.1-0.1+deb10u1_i386.deb')
self.check_exists('public/pool/main/u/util-linux/libuuid1_2.33.1-0.1+deb10u1_i386.deb')
self.check_exists('public/pool/main/u/util-linux/mount_2.33.1-0.1+deb10u1_i386.deb')
self.check_exists('public/pool/main/u/util-linux/util-linux_2.33.1-0.1+deb10u1_i386.deb')
self.check_exists('public/pool/main/d/dpkg/dpkg_1.19.8_i386.deb')
self.check_exists('public/pool/main/e/e2fsprogs/e2fslibs_1.44.5-1+deb10u2_i386.deb')
self.check_exists('public/pool/main/e/e2fsprogs/e2fsprogs_1.44.5-1+deb10u2_i386.deb')
self.check_exists('public/pool/main/e/e2fsprogs/libcom-err2_1.44.5-1+deb10u2_i386.deb')
self.check_exists('public/pool/main/e/e2fsprogs/libcomerr2_1.44.5-1+deb10u2_i386.deb')
self.check_exists('public/pool/main/e/e2fsprogs/libext2fs2_1.44.5-1+deb10u2_i386.deb')
self.check_exists('public/pool/main/e/e2fsprogs/libss2_1.44.5-1+deb10u2_i386.deb')
self.check_exists('public/pool/main/g/gzip/gzip_1.9-3+deb10u1_i386.deb')
self.check_exists('public/pool/main/g/glibc/libc-bin_2.28-10+deb10u2_i386.deb')
self.check_exists('public/pool/main/g/glibc/libc6_2.28-10+deb10u2_i386.deb')
self.check_exists('public/pool/main/g/glibc/multiarch-support_2.28-10+deb10u2_i386.deb')
self.check_exists('public/pool/main/b/bzip2/libbz2-1.0_1.0.6-9.2~deb10u2_i386.deb')
self.check_exists('public/pool/main/f/freetype/libfreetype6_2.9.1-3+deb10u2_i386.deb')
self.check_exists('public/pool/main/libg/libgd2/libgd3_2.2.5-5.2+deb10u1_i386.deb')
self.check_exists('public/pool/main/i/icu/libicu63_63.1-6+deb10u2_i386.deb')
self.check_exists('public/pool/main/l/lz4/liblz4-1_1.8.3-1+deb10u1_i386.deb')
self.check_exists('public/pool/main/x/xz-utils/liblzma5_5.2.4-1+deb10u1_i386.deb')
self.check_exists('public/pool/main/n/ncurses/libncursesw6_6.1+20181013-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/ncurses/libtinfo5_6.1+20181013-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/ncurses/libtinfo6_6.1+20181013-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/ncurses/ncurses-base_6.1+20181013-2+deb10u5_all.deb')
self.check_exists('public/pool/main/n/ncurses/ncurses-bin_6.1+20181013-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-auth-pam_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-cache-purge_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-dav-ext_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-echo_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-fancyindex_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-geoip_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-headers-more-filter_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-image-filter_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-lua_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-ndk_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-perl_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-subs-filter_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-uploadprogress_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-upstream-fair_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-http-xslt-filter_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-mail_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-nchan_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/libnginx-mod-stream_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/nginx_1.14.2-2+deb10u5_all.deb')
self.check_exists('public/pool/main/n/nginx/nginx_1.14.2-2+deb10u5.debian.tar.xz')
self.check_exists('public/pool/main/n/nginx/nginx_1.14.2-2+deb10u5.dsc')
self.check_exists('public/pool/main/n/nginx/nginx_1.14.2.orig.tar.gz')
self.check_exists('public/pool/main/n/nginx/nginx-common_1.14.2-2+deb10u5_all.deb')
self.check_exists('public/pool/main/n/nginx/nginx-extras_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/nginx-full_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/n/nginx/nginx-light_1.14.2-2+deb10u5_i386.deb')
self.check_exists('public/pool/main/o/openssl/libssl1.1_1.1.1n-0+deb10u6_i386.deb')
self.check_exists('public/pool/main/s/systemd/libsystemd0_241-7~deb10u10_i386.deb')
self.check_exists('public/pool/main/s/systemd/libudev1_241-7~deb10u10_i386.deb')
self.check_exists('public/pool/main/t/tiff/libtiff5_4.1.0+git191117-2~deb10u9_i386.deb')
self.check_exists('public/pool/main/t/tar/tar_1.30+dfsg-6+deb10u1_i386.deb')
self.check_exists('public/pool/main/t/tzdata/tzdata_2021a-0+deb10u12_all.deb')
self.check_exists('public/pool/main/libw/libwebp/libwebp6_0.6.1-2+deb10u3_i386.deb')
self.check_exists('public/pool/main/libx/libx11/libx11-6_1.6.7-1+deb10u4_i386.deb')
self.check_exists('public/pool/main/libx/libx11/libx11-data_1.6.7-1+deb10u4_all.deb')
self.check_exists('public/pool/main/libx/libxml2/libxml2_2.9.4+dfsg1-7+deb10u6_i386.deb')
self.check_exists('public/pool/main/libx/libxpm/libxpm4_3.5.12-1+deb10u2_i386.deb')
self.check_exists('public/pool/main/libx/libxslt/libxslt1.1_1.1.32-2.2~deb10u2_i386.deb')
self.check_exists('public/pool/main/libz/libzstd/libzstd1_1.3.8+dfsg-3+deb10u2_i386.deb')
self.check_exists('public/pool/main/z/zlib/zlib1g_1.2.11.dfsg-1+deb10u2_i386.deb')

0 comments on commit 2a2e35c

Please sign in to comment.