mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
System test for aptly db cleanup.
This commit is contained in:
@@ -56,6 +56,7 @@ class BaseTest(object):
|
||||
|
||||
longTest = False
|
||||
fixturePool = False
|
||||
fixturePoolCopy = False
|
||||
fixtureDB = False
|
||||
fixtureGpg = False
|
||||
fixtureWebServer = False
|
||||
@@ -111,6 +112,10 @@ class BaseTest(object):
|
||||
os.makedirs(os.path.join(os.environ["HOME"], ".aptly"), 0755)
|
||||
os.symlink(self.fixturePoolDir, os.path.join(os.environ["HOME"], ".aptly", "pool"))
|
||||
|
||||
if self.fixturePoolCopy:
|
||||
os.makedirs(os.path.join(os.environ["HOME"], ".aptly"), 0755)
|
||||
shutil.copytree(self.fixturePoolDir, os.path.join(os.environ["HOME"], ".aptly", "pool"), ignore=shutil.ignore_patterns(".git"))
|
||||
|
||||
if self.fixtureDB:
|
||||
shutil.copytree(self.fixtureDBDir, os.path.join(os.environ["HOME"], ".aptly", "db"))
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Loading mirrors and snapshots...
|
||||
Loading list of all packages...
|
||||
Deleting unreferenced packages (0)...
|
||||
Building list of files referenced by packages...
|
||||
Building list of files in package pool...
|
||||
Deleting unreferenced files (0)...
|
||||
@@ -0,0 +1,6 @@
|
||||
Loading mirrors and snapshots...
|
||||
Loading list of all packages...
|
||||
Deleting unreferenced packages (56484)...
|
||||
Building list of files referenced by packages...
|
||||
Building list of files in package pool...
|
||||
Deleting unreferenced files (0)...
|
||||
@@ -0,0 +1,7 @@
|
||||
Loading mirrors and snapshots...
|
||||
Loading list of all packages...
|
||||
Deleting unreferenced packages (6)...
|
||||
Building list of files referenced by packages...
|
||||
Building list of files in package pool...
|
||||
Deleting unreferenced files (6)...
|
||||
Disk space freed: 0.01 GiB...
|
||||
@@ -0,0 +1,6 @@
|
||||
Loading mirrors and snapshots...
|
||||
Loading list of all packages...
|
||||
Deleting unreferenced packages (0)...
|
||||
Building list of files referenced by packages...
|
||||
Building list of files in package pool...
|
||||
Deleting unreferenced files (0)...
|
||||
@@ -0,0 +1,7 @@
|
||||
Loading mirrors and snapshots...
|
||||
Loading list of all packages...
|
||||
Deleting unreferenced packages (6)...
|
||||
Building list of files referenced by packages...
|
||||
Building list of files in package pool...
|
||||
Deleting unreferenced files (6)...
|
||||
Disk space freed: 0.01 GiB...
|
||||
@@ -0,0 +1,5 @@
|
||||
"""
|
||||
Testing DB operations
|
||||
"""
|
||||
|
||||
from .cleanup import *
|
||||
@@ -0,0 +1,59 @@
|
||||
from lib import BaseTest
|
||||
|
||||
|
||||
class CleanupDB1Test(BaseTest):
|
||||
"""
|
||||
cleanup db: no DB
|
||||
"""
|
||||
runCmd = "aptly db cleanup"
|
||||
|
||||
|
||||
class CleanupDB2Test(BaseTest):
|
||||
"""
|
||||
cleanup db: deleting packages when mirrors are missing
|
||||
"""
|
||||
fixtureDB = True
|
||||
fixtureCmds = [
|
||||
"aptly mirror drop wheezy-main",
|
||||
"aptly mirror drop wheezy-contrib",
|
||||
]
|
||||
runCmd = "aptly db cleanup"
|
||||
|
||||
|
||||
class CleanupDB3Test(BaseTest):
|
||||
"""
|
||||
cleanup db: deleting packages and files
|
||||
"""
|
||||
fixtureDB = True
|
||||
fixturePoolCopy = True
|
||||
fixtureCmds = [
|
||||
"aptly mirror drop gnuplot-maverick",
|
||||
]
|
||||
runCmd = "aptly db cleanup"
|
||||
|
||||
|
||||
class CleanupDB4Test(BaseTest):
|
||||
"""
|
||||
cleanup db: deleting a mirror, but still referenced by snapshot
|
||||
"""
|
||||
fixtureDB = True
|
||||
fixturePoolCopy = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create gnuplot from mirror gnuplot-maverick",
|
||||
"aptly mirror drop -force gnuplot-maverick",
|
||||
]
|
||||
runCmd = "aptly db cleanup"
|
||||
|
||||
|
||||
class CleanupDB5Test(BaseTest):
|
||||
"""
|
||||
cleanup db: create/delete snapshot, drop mirror
|
||||
"""
|
||||
fixtureDB = True
|
||||
fixturePoolCopy = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create gnuplot from mirror gnuplot-maverick",
|
||||
"aptly snapshot drop gnuplot",
|
||||
"aptly mirror drop gnuplot-maverick",
|
||||
]
|
||||
runCmd = "aptly db cleanup"
|
||||
Reference in New Issue
Block a user