Tests for aptly db recover. #25

This commit is contained in:
Andrey Smirnov
2014-04-05 17:01:16 +04:00
parent 4afa3126e4
commit 173dd775bc
5 changed files with 46 additions and 0 deletions

View File

@@ -192,6 +192,9 @@ class BaseTest(object):
with open(os.path.join(os.environ["HOME"], ".aptly", path), "r") as f:
return f.read()
def delete_file(self, path):
os.unlink(os.path.join(os.environ["HOME"], ".aptly", path))
def check_file_contents(self, path, gold_name, match_prepare=None):
contents = self.read_file(path)

View File

@@ -0,0 +1 @@
Recovering database...

View File

@@ -0,0 +1,15 @@
List of mirrors:
* [gnuplot-maverick-src]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick [src]
* [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick
* [wheezy-backports-src]: http://mirror.yandex.ru/debian/ wheezy-backports [src]
* [wheezy-backports]: http://mirror.yandex.ru/debian/ wheezy-backports
* [wheezy-contrib-src]: http://mirror.yandex.ru/debian/ wheezy [src]
* [wheezy-contrib]: http://mirror.yandex.ru/debian/ wheezy
* [wheezy-main-src]: http://mirror.yandex.ru/debian/ wheezy [src]
* [wheezy-main]: http://mirror.yandex.ru/debian/ wheezy
* [wheezy-non-free-src]: http://mirror.yandex.ru/debian/ wheezy [src]
* [wheezy-non-free]: http://mirror.yandex.ru/debian/ wheezy
* [wheezy-updates-src]: http://mirror.yandex.ru/debian/ wheezy-updates [src]
* [wheezy-updates]: http://mirror.yandex.ru/debian/ wheezy-updates
To get more information about mirror, run `aptly mirror show <name>`.

View File

@@ -3,3 +3,4 @@ Testing DB operations
"""
from .cleanup import *
from .recover import *

26
system/t08_db/recover.py Normal file
View File

@@ -0,0 +1,26 @@
from lib import BaseTest
# Waiting for PR
# class RecoverDB1Test(BaseTest):
# """
# recover db: no DB
# """
# runCmd = "aptly db recover"
class RecoverDB2Test(BaseTest):
"""
recover db: without CURRENT files
"""
fixtureDB = True
runCmd = "aptly db recover"
def prepare(self):
super(RecoverDB2Test, self).prepare()
self.delete_file("db/CURRENT")
def check(self):
self.check_output()
self.check_cmd_output("aptly mirror list", "mirror_list")