Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gershnik committed Jun 6, 2024
1 parent 6d0bae8 commit 05acdef
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/expected/tests/test_alpine.py.test_two/APKINDEX
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
C:Q15n3yDvEce9+/S6laLndWEZsUjfc=
P:cgdb
V:0.8.0-r2
A:x86_64
S:143753
I:335872
T:The Curses Debugger
U:https://cgdb.github.io/
L:GPL-2.0-or-later
o:cgdb
m:Natanael Copa <ncopa@alpinelinux.org>
t:1710257622
c:fc95c59998285564fbcb0bfb2443898c62e10171
D:gdb so:libc.musl-x86_64.so.1 so:libgcc_s.so.1 so:libncursesw.so.6 so:libreadline.so.8 so:libstdc++.so.6
p:cmd:cgdb=0.8.0-r2

C:Q1TXVgzyQiVmY+lk5/cMY6XdPA4CI=
P:samba-client
V:4.19.6-r0
A:x86_64
S:678507
I:2490368
T:Samba client programs
U:https://www.samba.org/
L:GPL-3.0-or-later AND LGPL-3.0-or-later
o:samba
m:Natanael Copa <ncopa@alpinelinux.org>
t:1716198147
c:b4a9e905062153013701be64f4bec53be3cb2008
D:samba-libs=4.19.6-r0 samba-common=4.19.6-r0 so:libCHARSET3-samba4.so so:libaddns-samba4.so so:libarchive.so.13 so:libc.musl-x86_64.so.1 so:libcli-cldap-samba4.so so:libcli-ldap-samba4.so so:libcli-smb-common-samba4.so so:libcli-spoolss-samba4.so so:libcliauth-samba4.so so:libcmdline-contexts-samba4.so so:libcmdline-samba4.so so:libcom-err-samba4.so so:libdbwrap-samba4.so so:libdcerpc-binding.so.0 so:libdcerpc-samba-samba4.so so:libevents-samba4.so so:libformw.so.6 so:libgenrand-samba4.so so:libgensec-samba4.so so:libgnutls.so.30 so:libkrb5-samba4.so so:libkrb5samba-samba4.so so:libldb.so.2 so:libldbsamba-samba4.so so:liblibcli-lsa3-samba4.so so:liblibcli-netlogon3-samba4.so so:liblibsmb-samba4.so so:libmscat-samba4.so so:libmsrpc3-samba4.so so:libncursesw.so.6 so:libndr-nbt.so.0 so:libndr-samba-samba4.so so:libndr-samba4.so so:libndr-standard.so.0 so:libndr.so.3 so:libpanelw.so.6 so:libpopt.so.0 so:libregistry-samba4.so so:libreplace-samba4.so so:libsamba-credentials.so.1 so:libsamba-debug-samba4.so so:libsamba-errors.so.1 so:libsamba-hostconfig.so.0 so:libsamba-passdb.so.0 so:libsamba-security-samba4.so so:libsamba-sockets-samba4.so so:libsamba-util.so.0 so:libsamba3-util-samba4.so so:libsamdb-common-samba4.so so:libsecrets3-samba4.so so:libserver-role-samba4.so so:libsmbclient-raw-samba4.so so:libsmbclient.so.0 so:libsmbconf.so.0 so:libsocket-blocking-samba4.so so:libtalloc.so.2 so:libtevent-util.so.0 so:libtevent.so.0 so:libtrusts-util-samba4.so so:libutil-reg-samba4.so so:libutil-tdb-samba4.so
p:cmd:cifsdd=4.19.6-r0 cmd:dbwrap_tool=4.19.6-r0 cmd:dumpmscat=4.19.6-r0 cmd:mdsearch=4.19.6-r0 cmd:mvxattr=4.19.6-r0 cmd:nmblookup=4.19.6-r0 cmd:oLschema2ldif=4.19.6-r0 cmd:regdiff=4.19.6-r0 cmd:regpatch=4.19.6-r0 cmd:regshell=4.19.6-r0 cmd:regtree=4.19.6-r0 cmd:rpcclient=4.19.6-r0 cmd:samba-regedit=4.19.6-r0 cmd:sharesec=4.19.6-r0 cmd:smbcacls=4.19.6-r0 cmd:smbclient=4.19.6-r0 cmd:smbcquotas=4.19.6-r0 cmd:smbget=4.19.6-r0 cmd:smbprint=4.19.6-r0 cmd:smbspool=4.19.6-r0 cmd:smbtar=4.19.6-r0 cmd:smbtree=4.19.6-r0

Binary file not shown.
1 change: 1 addition & 0 deletions tests/expected/tests/test_alpine.py.test_two/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fancy repo
23 changes: 23 additions & 0 deletions tests/expected/tests/test_rpm.py.test_two/filelists.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version='1.0' encoding='utf-8'?>
<filelists xmlns="http://linux.duke.edu/metadata/filelists" packages="2">
<package pkgid="68aa84af88f89fc89bdaf7f3f0cc47c5775a56461dea624dcb7f4aec708ad89e" name="dhcp-dev" arch="x86_64">
<version epoch="0" ver="4.3.3" rel="10" />
<file>/usr/include/dhcpctl/dhcpctl.h</file>
<file>/usr/include/isc-dhcp/dst.h</file>
<file>/usr/include/omapip/alloc.h</file>
<file>/usr/include/omapip/buffer.h</file>
<file>/usr/include/omapip/convert.h</file>
<file>/usr/include/omapip/hash.h</file>
<file>/usr/include/omapip/isclib.h</file>
<file>/usr/include/omapip/omapip.h</file>
<file>/usr/include/omapip/omapip_p.h</file>
<file>/usr/include/omapip/result.h</file>
<file>/usr/include/omapip/trace.h</file>
<file>/usr/lib64/libdhcpctl.so</file>
<file>/usr/lib64/libomapi.so</file>
</package>
<package pkgid="9268854320030a2b27654325b585ff85551386d8d11ba68336bbf982d80ce201" name="sudo-setuid" arch="x86_64">
<version epoch="0" ver="1.8.17p1" rel="34" />
<file>/usr/bin/sudo</file>
</package>
</filelists>
9 changes: 9 additions & 0 deletions tests/expected/tests/test_rpm.py.test_two/other.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<otherdata xmlns="http://linux.duke.edu/metadata/other" packages="2">
<package pkgid="68aa84af88f89fc89bdaf7f3f0cc47c5775a56461dea624dcb7f4aec708ad89e" name="dhcp-dev" arch="x86_64">
<version epoch="0" ver="4.3.3" rel="10" />
</package>
<package pkgid="9268854320030a2b27654325b585ff85551386d8d11ba68336bbf982d80ce201" name="sudo-setuid" arch="x86_64">
<version epoch="0" ver="1.8.17p1" rel="34" />
</package>
</otherdata>
65 changes: 65 additions & 0 deletions tests/expected/tests/test_rpm.py.test_two/primary.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version='1.0' encoding='utf-8'?>
<metadata xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm" packages="2">
<package type="rpm">
<name>dhcp-dev</name>
<arch>x86_64</arch>
<version epoch="0" ver="4.3.3" rel="10" />
<checksum type="sha256" pkgid="YES">68aa84af88f89fc89bdaf7f3f0cc47c5775a56461dea624dcb7f4aec708ad89e</checksum>
<summary>dev components for the dhcp package.</summary>
<description>dev components for the dhcp package.</description>
<packager>Koji</packager>
<url>https://ftp.isc.org/isc/dhcp/4.3.3-P1/dhcp-4.3.3-P1.tar.gz</url>
<time file="1717163107" build="1470667413" />
<size package="19768" installed="69557" archive="71560" />
<location href="dhcp-dev-4.3.3-10.x86_64.rpm" />
<format>
<rpm:license>ISC</rpm:license>
<rpm:vendor>Koji</rpm:vendor>
<rpm:group>Development</rpm:group>
<rpm:buildhost>kojibuild03</rpm:buildhost>
<rpm:sourcerpm>dhcp-4.3.3-10.src.rpm</rpm:sourcerpm>
<rpm:header-range start="4392" end="7612" />
<rpm:provides>
<rpm:entry name="dhcp-dev" flags="EQ" epoch="0" ver="4.3.3" rel="10" />
<rpm:entry name="dhcp-dev(x86-64)" flags="EQ" epoch="0" ver="4.3.3" rel="10" />
<rpm:entry name="dhcp-devel" />
</rpm:provides>
<rpm:requires>
<rpm:entry name="dhcp-bin" />
<rpm:entry name="dhcp-lib" />
</rpm:requires>
</format>
</package>
<package type="rpm">
<name>sudo-setuid</name>
<arch>x86_64</arch>
<version epoch="0" ver="1.8.17p1" rel="34" />
<checksum type="sha256" pkgid="YES">9268854320030a2b27654325b585ff85551386d8d11ba68336bbf982d80ce201</checksum>
<summary>setuid components for the sudo package.</summary>
<description>setuid components for the sudo package.</description>
<packager>Koji</packager>
<url>http://www.sudo.ws/dist/sudo-1.8.17p1.tar.gz</url>
<time file="1717163107" build="1466775784" />
<size package="56464" installed="130280" archive="130532" />
<location href="sudo-setuid-1.8.17p1-34.x86_64.rpm" />
<format>
<rpm:license>ISC MIT-Opengroup</rpm:license>
<rpm:vendor>Koji</rpm:vendor>
<rpm:group>Default</rpm:group>
<rpm:buildhost>kojibuild03</rpm:buildhost>
<rpm:sourcerpm>sudo-1.8.17p1-34.src.rpm</rpm:sourcerpm>
<rpm:header-range start="4392" end="6924" />
<rpm:provides>
<rpm:entry name="sudo-setuid" flags="EQ" epoch="0" ver="1.8.17p1" rel="34" />
<rpm:entry name="sudo-setuid(x86-64)" flags="EQ" epoch="0" ver="1.8.17p1" rel="34" />
</rpm:provides>
<rpm:requires>
<rpm:entry name="libsudo_util.so.0()(64bit)" />
<rpm:entry name="libutil.so.1()(64bit)" />
<rpm:entry name="libutil.so.1(GLIBC_2.2.5)(64bit)" />
<rpm:entry name="libc.so.6(GLIBC_2.14)(64bit)" />
</rpm:requires>
</format>
<file>/usr/bin/sudo</file>
</package>
</metadata>
28 changes: 28 additions & 0 deletions tests/expected/tests/test_rpm.py.test_two/repomd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version='1.0' encoding='utf-8'?>
<repomd xmlns="http://linux.duke.edu/metadata/repo" xmlns:rpm="http://linux.duke.edu/metadata/rpm">
<revision>1717163107</revision>
<data type="primary">
<checksum type="sha256">53f4a5e860534ccaa0b1fd9638304f3d0d43d456ab54042f2f9d56f6c016ccc6</checksum>
<open-checksum type="sha256">f98713c1abeeecdb2cefa7552d922c9284f9bf4d64dfc52dbb27899e2a5354e9</open-checksum>
<location href="repodata/primary.xml.gz" />
<timestamp>1717163107</timestamp>
<size>955</size>
<open-size>2974</open-size>
</data>
<data type="filelists">
<checksum type="sha256">d2f8a60cd79a6b44700f23174430f9daa4d80867010a46bf1bc4fe660361d72e</checksum>
<open-checksum type="sha256">fc6590150a9a35bccb3c3f2d20d79978932812661bcec31b85c7beda8dac1c3d</open-checksum>
<location href="repodata/filelists.xml.gz" />
<timestamp>1717163107</timestamp>
<size>433</size>
<open-size>1100</open-size>
</data>
<other>
<checksum type="sha256">02ffab444f854b38db0236cb5b6fa3b2be23b268438dcd4df2aafdffe8f9f9d6</checksum>
<open-checksum type="sha256">8afbf85a50f2cab8cb48351c5acfdadfabed8f45e58310a0bb908f0222368d47</open-checksum>
<location href="repodata/other.xml.gz" />
<timestamp>1717163107</timestamp>
<size>313</size>
<open-size>477</open-size>
</other>
</repomd>
23 changes: 23 additions & 0 deletions tests/test_alpine.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,26 @@ def test_one(binaries_path, output_path, expected_path, pki_signer, fixed_dateti
compare_files(output_path / 'x86_64/APKINDEX.tar.gz', expected_path / 'APKINDEX.tar.gz', should_populate)
compare_files(output_path / 'expanded/DESCRIPTION', expected_path / 'DESCRIPTION', should_populate)
compare_files(output_path / 'expanded/x86_64/APKINDEX', expected_path / 'APKINDEX', should_populate)

@pytest.mark.download(
'https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/samba-client-4.19.6-r0.apk',
'https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/cgdb-0.8.0-r2.apk'
)
def test_two(binaries_path, output_path, expected_path, pki_signer, fixed_datetime, should_populate):
repo = AlpineRepo('fancy repo')
repo.add_package(binaries_path / 'samba-client-4.19.6-r0.apk')
package = repo.add_package(binaries_path / 'cgdb-0.8.0-r2.apk')
assert package.name == 'cgdb'
assert package.arch == 'x86_64'
assert package.version_str == '0.8.0-r2'
assert package.version_key == VersionKey(0, 8, 0, 'r', 2)
assert package.src_path == binaries_path / 'cgdb-0.8.0-r2.apk'
assert package.repo_filename == 'cgdb-0.8.0-r2.apk'
assert package.fields['C'] == 'Q15n3yDvEce9+/S6laLndWEZsUjfc='
repo.export(output_path, pki_signer, 'alpine-devel@lists.alpinelinux.org-5261cecb', fixed_datetime, keep_expanded=True)
compare_files(output_path / 'x86_64/samba-client-4.19.6-r0.apk', binaries_path / 'samba-client-4.19.6-r0.apk')
compare_files(output_path / 'x86_64/cgdb-0.8.0-r2.apk', binaries_path / 'cgdb-0.8.0-r2.apk')
if sys.version_info >= (3, 9):
compare_files(output_path / 'x86_64/APKINDEX.tar.gz', expected_path / 'APKINDEX.tar.gz', should_populate)
compare_files(output_path / 'expanded/DESCRIPTION', expected_path / 'DESCRIPTION', should_populate)
compare_files(output_path / 'expanded/x86_64/APKINDEX', expected_path / 'APKINDEX', should_populate)
20 changes: 20 additions & 0 deletions tests/test_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,23 @@ def test_one(binaries_path, output_path, expected_path, pgp_signer, fixed_dateti
compare_files(output_path / 'repodata/primary.xml', expected_path / 'primary.xml', should_populate)
compare_files(output_path / 'repodata/filelists.xml', expected_path / 'filelists.xml', should_populate)
compare_files(output_path / 'repodata/other.xml', expected_path / 'other.xml', should_populate)

@pytest.mark.download(
"https://download.clearlinux.org/releases/10540/clear/x86_64/os/Packages/sudo-setuid-1.8.17p1-34.x86_64.rpm",
"https://download.clearlinux.org/releases/10540/clear/x86_64/os/Packages/dhcp-dev-4.3.3-10.x86_64.rpm"
)
def test_two(binaries_path, output_path, expected_path, pgp_signer, fixed_datetime, should_populate):
repo = RpmRepo()
repo.add_package(binaries_path / 'sudo-setuid-1.8.17p1-34.x86_64.rpm')
package = repo.add_package(binaries_path / 'dhcp-dev-4.3.3-10.x86_64.rpm')
assert package.name == 'dhcp-dev'
assert package.arch == 'x86_64'
assert package.version_str == '4.3.3-10'
assert package.version_key == RpmVersion(('0', '4.3.3', '10'))
repo.export(output_path, pgp_signer, now=fixed_datetime, keep_expanded=True)
compare_files(output_path / 'sudo-setuid-1.8.17p1-34.x86_64.rpm', binaries_path / 'sudo-setuid-1.8.17p1-34.x86_64.rpm')
compare_files(output_path / 'dhcp-dev-4.3.3-10.x86_64.rpm', binaries_path / 'dhcp-dev-4.3.3-10.x86_64.rpm')
compare_files(output_path / 'repodata/repomd.xml', expected_path / 'repomd.xml', should_populate)
compare_files(output_path / 'repodata/primary.xml', expected_path / 'primary.xml', should_populate)
compare_files(output_path / 'repodata/filelists.xml', expected_path / 'filelists.xml', should_populate)
compare_files(output_path / 'repodata/other.xml', expected_path / 'other.xml', should_populate)

0 comments on commit 05acdef

Please sign in to comment.