mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
System tests for aptly repo add..
This commit is contained in:
+4
-1
@@ -146,7 +146,10 @@ class BaseTest(object):
|
|||||||
try:
|
try:
|
||||||
#start = time.time()
|
#start = time.time()
|
||||||
if not hasattr(command, "__iter__"):
|
if not hasattr(command, "__iter__"):
|
||||||
params = {'files': os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files")}
|
params = {
|
||||||
|
'files': os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"),
|
||||||
|
'testfiles': os.path.join(os.path.dirname(inspect.getsourcefile(self.__class__)), self.__class__.__name__),
|
||||||
|
}
|
||||||
if self.fixtureWebServer:
|
if self.fixtureWebServer:
|
||||||
params['url'] = self.webServerUrl
|
params['url'] = self.webServerUrl
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Loading packages...
|
||||||
|
[+] pyspi-0.6.1-1.3_source added
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Name: repo10
|
||||||
|
Comment: Repo10
|
||||||
|
Number of packages: 3
|
||||||
|
Packages:
|
||||||
|
libboost-program-options-dev-1.49.0.1_i386
|
||||||
|
pyspi-0.6.1-1.3_source
|
||||||
|
pyspi-0.6.1-1.4_source
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Loading packages...
|
||||||
|
[+] libboost-program-options-dev-1.49.0.1_i386 added
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Name: repo1
|
||||||
|
Comment: Repo1
|
||||||
|
Number of packages: 1
|
||||||
|
Packages:
|
||||||
|
libboost-program-options-dev-1.49.0.1_i386
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Loading packages...
|
||||||
|
[+] pyspi-0.6.1-1.4_source added
|
||||||
|
[+] pyspi-0.6.1-1.3_source added
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Name: repo2
|
||||||
|
Comment: Repo2
|
||||||
|
Number of packages: 2
|
||||||
|
Packages:
|
||||||
|
pyspi-0.6.1-1.3_source
|
||||||
|
pyspi-0.6.1-1.4_source
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
Loading packages...
|
||||||
|
[+] libboost-program-options-dev-1.49.0.1_i386 added
|
||||||
|
[+] pyspi-0.6.1-1.4_source added
|
||||||
|
[+] pyspi-0.6.1-1.3_source added
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Name: repo3
|
||||||
|
Comment: Repo3
|
||||||
|
Number of packages: 3
|
||||||
|
Packages:
|
||||||
|
libboost-program-options-dev-1.49.0.1_i386
|
||||||
|
pyspi-0.6.1-1.3_source
|
||||||
|
pyspi-0.6.1-1.4_source
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Loading packages...
|
||||||
|
[+] libboost-program-options-dev-1.49.0.1_i386 added
|
||||||
|
[+] pyspi-0.6.1-1.3_source added
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Name: repo4
|
||||||
|
Comment: Repo4
|
||||||
|
Number of packages: 2
|
||||||
|
Packages:
|
||||||
|
libboost-program-options-dev-1.49.0.1_i386
|
||||||
|
pyspi-0.6.1-1.3_source
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Loading packages...
|
||||||
|
[!] Unable to import file /02/03/pyspi_0.6.1-1.3.diff.gz into pool: open /02/03/pyspi_0.6.1-1.3.diff.gz: no such file or directory
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Name: repo5
|
||||||
|
Comment: Repo5
|
||||||
|
Number of packages: 0
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Loading packages...
|
||||||
|
[!] Unable to process no-such-file: stat no-such-file: no such file or directory
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ERROR: unable to add: local repo with name repo7 not found
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
Format: 1.0
|
||||||
|
Source: pyspi
|
||||||
|
Binary: python-at-spi
|
||||||
|
Architecture: any
|
||||||
|
Version: 0.6.1-1.3
|
||||||
|
Maintainer: Jose Carlos Garcia Sogo <jsogo@debian.org>
|
||||||
|
Homepage: http://people.redhat.com/zcerza/dogtail
|
||||||
|
Standards-Version: 3.7.3
|
||||||
|
Vcs-Svn: svn://svn.tribulaciones.org/srv/svn/pyspi/trunk
|
||||||
|
Build-Depends: debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev
|
||||||
|
Files:
|
||||||
|
d41d8cd98f00b204e9800998ecf8427e 0 pyspi_0.6.1.orig.tar.gz
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Loading packages...
|
||||||
|
[!] Unable to save package pyspi-0.6.1-1.3_source: unable to save: pyspi-0.6.1-1.3_source, conflict with existing packge
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Name: repo8
|
||||||
|
Comment: Repo8
|
||||||
|
Number of packages: 1
|
||||||
|
Packages:
|
||||||
|
pyspi-0.6.1-1.3_source
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Loading packages...
|
||||||
|
[!] Unable to import file /pyspi_0.6.1.orig.tar.gz into pool: unable to import into pool: file /Users/smira/.aptly/pool/de/f3/pyspi_0.6.1.orig.tar.gz already exists
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
Name: repo2
|
Name: repo2
|
||||||
Comment: Cool
|
Comment: Cool
|
||||||
Number of packages: 0
|
Number of packages: 3
|
||||||
Packages:
|
Packages:
|
||||||
|
libboost-program-options-dev-1.49.0.1_i386
|
||||||
|
pyspi-0.6.1-1.3_source
|
||||||
|
pyspi-0.6.1-1.4_source
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
Testing local repo management
|
Testing local repo management
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from .add import *
|
||||||
from .create import *
|
from .create import *
|
||||||
from .show import *
|
from .show import *
|
||||||
from .list import *
|
from .list import *
|
||||||
|
|||||||
@@ -0,0 +1,212 @@
|
|||||||
|
import tempfile
|
||||||
|
import shutil
|
||||||
|
import os
|
||||||
|
import inspect
|
||||||
|
from lib import BaseTest
|
||||||
|
|
||||||
|
|
||||||
|
class AddRepo1Test(BaseTest):
|
||||||
|
"""
|
||||||
|
add package to local repo: .deb file
|
||||||
|
"""
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly repo create -comment=Repo1 repo1",
|
||||||
|
]
|
||||||
|
runCmd = "aptly repo add repo1 ${files}/libboost-program-options-dev_1.49.0.1_i386.deb"
|
||||||
|
|
||||||
|
def check(self):
|
||||||
|
self.check_output()
|
||||||
|
self.check_cmd_output("aptly repo show -with-packages repo1", "repo_show")
|
||||||
|
|
||||||
|
# check pool
|
||||||
|
self.check_exists('pool/00/35/libboost-program-options-dev_1.49.0.1_i386.deb')
|
||||||
|
|
||||||
|
|
||||||
|
class AddRepo2Test(BaseTest):
|
||||||
|
"""
|
||||||
|
add package to local repo: .dsc file
|
||||||
|
"""
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly repo create -comment=Repo2 repo2",
|
||||||
|
]
|
||||||
|
runCmd = "aptly repo add repo2 ${files}/pyspi_0.6.1-1.3.dsc ${files}/pyspi-0.6.1-1.3.stripped.dsc"
|
||||||
|
|
||||||
|
def check(self):
|
||||||
|
self.check_output()
|
||||||
|
self.check_cmd_output("aptly repo show -with-packages repo2", "repo_show")
|
||||||
|
|
||||||
|
# check pool
|
||||||
|
self.check_exists('pool/22/ff/pyspi_0.6.1-1.3.diff.gz')
|
||||||
|
self.check_exists('pool/b7/2c/pyspi_0.6.1-1.3.dsc')
|
||||||
|
self.check_exists('pool/de/f3/pyspi_0.6.1.orig.tar.gz')
|
||||||
|
self.check_exists('pool/2f/5b/pyspi-0.6.1-1.3.stripped.dsc')
|
||||||
|
|
||||||
|
|
||||||
|
class AddRepo3Test(BaseTest):
|
||||||
|
"""
|
||||||
|
add package to local repo: directory
|
||||||
|
"""
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly repo create -comment=Repo3 repo3",
|
||||||
|
]
|
||||||
|
runCmd = "aptly repo add repo3 ${files}"
|
||||||
|
|
||||||
|
def check(self):
|
||||||
|
self.check_output()
|
||||||
|
self.check_cmd_output("aptly repo show -with-packages repo3", "repo_show")
|
||||||
|
|
||||||
|
# check pool
|
||||||
|
self.check_exists('pool/00/35/libboost-program-options-dev_1.49.0.1_i386.deb')
|
||||||
|
self.check_exists('pool/22/ff/pyspi_0.6.1-1.3.diff.gz')
|
||||||
|
self.check_exists('pool/b7/2c/pyspi_0.6.1-1.3.dsc')
|
||||||
|
self.check_exists('pool/de/f3/pyspi_0.6.1.orig.tar.gz')
|
||||||
|
self.check_exists('pool/2f/5b/pyspi-0.6.1-1.3.stripped.dsc')
|
||||||
|
|
||||||
|
|
||||||
|
class AddRepo4Test(BaseTest):
|
||||||
|
"""
|
||||||
|
add package to local repo: complex directory + remove
|
||||||
|
"""
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly repo create -comment=Repo4 repo4",
|
||||||
|
]
|
||||||
|
runCmd = "aptly repo add -remove-files repo4 "
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(AddRepo4Test, self).prepare()
|
||||||
|
|
||||||
|
self.tempSrcDir = tempfile.mkdtemp()
|
||||||
|
os.makedirs(os.path.join(self.tempSrcDir, "01"), 0755)
|
||||||
|
os.makedirs(os.path.join(self.tempSrcDir, "02", "03"), 0755)
|
||||||
|
|
||||||
|
shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "libboost-program-options-dev_1.49.0.1_i386.deb"),
|
||||||
|
os.path.join(self.tempSrcDir, "01"))
|
||||||
|
shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1-1.3.dsc"),
|
||||||
|
os.path.join(self.tempSrcDir, "02", "03"))
|
||||||
|
shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1.orig.tar.gz"),
|
||||||
|
os.path.join(self.tempSrcDir, "02", "03"))
|
||||||
|
shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1-1.3.diff.gz"),
|
||||||
|
os.path.join(self.tempSrcDir, "02", "03"))
|
||||||
|
shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1-1.3.diff.gz"),
|
||||||
|
os.path.join(self.tempSrcDir, "02", "03", "other.file"))
|
||||||
|
|
||||||
|
self.runCmd += self.tempSrcDir
|
||||||
|
|
||||||
|
def check(self):
|
||||||
|
self.check_output()
|
||||||
|
self.check_cmd_output("aptly repo show -with-packages repo4", "repo_show")
|
||||||
|
|
||||||
|
# check pool
|
||||||
|
self.check_exists('pool/00/35/libboost-program-options-dev_1.49.0.1_i386.deb')
|
||||||
|
self.check_exists('pool/22/ff/pyspi_0.6.1-1.3.diff.gz')
|
||||||
|
self.check_exists('pool/b7/2c/pyspi_0.6.1-1.3.dsc')
|
||||||
|
self.check_exists('pool/de/f3/pyspi_0.6.1.orig.tar.gz')
|
||||||
|
|
||||||
|
path = os.path.join(self.tempSrcDir, "01", "libboost-program-options-dev_1.49.0.1_i386.deb")
|
||||||
|
if os.path.exists(path):
|
||||||
|
raise Exception("path %s shouldn't exist" % (path, ))
|
||||||
|
path = os.path.join(self.tempSrcDir, "02", "03", "pyspi_0.6.1.orig.tar.gz")
|
||||||
|
if os.path.exists(path):
|
||||||
|
raise Exception("path %s shouldn't exist" % (path, ))
|
||||||
|
|
||||||
|
path = os.path.join(self.tempSrcDir, "02", "03", "other.file")
|
||||||
|
if not os.path.exists(path):
|
||||||
|
raise Exception("path %s doesn't exist" % (path, ))
|
||||||
|
|
||||||
|
shutil.rmtree(self.tempSrcDir)
|
||||||
|
|
||||||
|
|
||||||
|
class AddRepo5Test(BaseTest):
|
||||||
|
"""
|
||||||
|
add package to local repo: some source files missing
|
||||||
|
"""
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly repo create -comment=Repo5 repo5",
|
||||||
|
]
|
||||||
|
runCmd = "aptly repo add repo5 "
|
||||||
|
outputMatchPrepare = lambda self, s: s.replace(self.tempSrcDir, "")
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(AddRepo5Test, self).prepare()
|
||||||
|
|
||||||
|
self.tempSrcDir = tempfile.mkdtemp()
|
||||||
|
os.makedirs(os.path.join(self.tempSrcDir, "02", "03"), 0755)
|
||||||
|
|
||||||
|
shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1-1.3.dsc"),
|
||||||
|
os.path.join(self.tempSrcDir, "02", "03"))
|
||||||
|
shutil.copy(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "pyspi_0.6.1.orig.tar.gz"),
|
||||||
|
os.path.join(self.tempSrcDir, "02", "03"))
|
||||||
|
|
||||||
|
self.runCmd += self.tempSrcDir
|
||||||
|
|
||||||
|
def check(self):
|
||||||
|
self.check_output()
|
||||||
|
self.check_cmd_output("aptly repo show repo5", "repo_show")
|
||||||
|
|
||||||
|
shutil.rmtree(self.tempSrcDir)
|
||||||
|
|
||||||
|
|
||||||
|
class AddRepo6Test(BaseTest):
|
||||||
|
"""
|
||||||
|
add package to local repo: missing file
|
||||||
|
"""
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly repo create -comment=Repo6 repo6",
|
||||||
|
]
|
||||||
|
runCmd = "aptly repo add repo6 no-such-file"
|
||||||
|
|
||||||
|
|
||||||
|
class AddRepo7Test(BaseTest):
|
||||||
|
"""
|
||||||
|
add package to local repo: missing repo
|
||||||
|
"""
|
||||||
|
runCmd = "aptly repo add repo7 ${files}"
|
||||||
|
expectedCode = 1
|
||||||
|
|
||||||
|
|
||||||
|
class AddRepo8Test(BaseTest):
|
||||||
|
"""
|
||||||
|
add package to local repo: conflict in packages
|
||||||
|
"""
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly repo create -comment=Repo8 repo8",
|
||||||
|
"aptly repo add repo8 ${files}/pyspi_0.6.1-1.3.dsc",
|
||||||
|
]
|
||||||
|
runCmd = "aptly repo add repo8 ${testfiles}/pyspi_0.6.1-1.3.conflict.dsc"
|
||||||
|
|
||||||
|
def check(self):
|
||||||
|
self.check_output()
|
||||||
|
self.check_cmd_output("aptly repo show -with-packages repo8", "repo_show")
|
||||||
|
|
||||||
|
|
||||||
|
class AddRepo9Test(BaseTest):
|
||||||
|
"""
|
||||||
|
add package to local repo: conflict in files
|
||||||
|
"""
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly repo create -comment=Repo9 repo9",
|
||||||
|
]
|
||||||
|
runCmd = "aptly repo add repo9 ${files}/pyspi_0.6.1-1.3.dsc"
|
||||||
|
outputMatchPrepare = lambda self, s: s.replace(os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files"), "")
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
super(AddRepo9Test, self).prepare()
|
||||||
|
|
||||||
|
os.makedirs(os.path.join(os.environ["HOME"], ".aptly", "pool/de/f3/"))
|
||||||
|
with open(os.path.join(os.environ["HOME"], ".aptly", "pool/de/f3/pyspi_0.6.1.orig.tar.gz"), "w") as f:
|
||||||
|
f.write("abcd")
|
||||||
|
|
||||||
|
|
||||||
|
class AddRepo10Test(BaseTest):
|
||||||
|
"""
|
||||||
|
add package to local repo: double import
|
||||||
|
"""
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly repo create -comment=Repo10 repo10",
|
||||||
|
"aptly repo add repo10 ${files}",
|
||||||
|
]
|
||||||
|
runCmd = "aptly repo add repo10 ${files}/pyspi_0.6.1-1.3.dsc"
|
||||||
|
|
||||||
|
def check(self):
|
||||||
|
self.check_output()
|
||||||
|
self.check_cmd_output("aptly repo show -with-packages repo10", "repo_show")
|
||||||
@@ -13,7 +13,10 @@ class ShowRepo2Test(BaseTest):
|
|||||||
"""
|
"""
|
||||||
show local repo: -with-packages
|
show local repo: -with-packages
|
||||||
"""
|
"""
|
||||||
fixtureCmds = ["aptly repo create -comment=Cool repo2"]
|
fixtureCmds = [
|
||||||
|
"aptly repo create -comment=Cool repo2",
|
||||||
|
"aptly repo add repo2 ${files}"
|
||||||
|
]
|
||||||
runCmd = "aptly repo show -with-packages repo2"
|
runCmd = "aptly repo show -with-packages repo2"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user