Fix test cases.

Signed-off-by: Christoph Fiehe <c.fiehe@eurodata.de>
This commit is contained in:
Christoph Fiehe
2024-10-10 16:14:25 +02:00
committed by André Roth
parent 9dffe791ad
commit d87d8bac92
30 changed files with 942 additions and 300 deletions
+77 -98
View File
@@ -8,32 +8,13 @@ class PublishSourceAdd1Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly snapshot create snap2 from mirror wheezy-contrib",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1",
"aptly publish source add -component=contrib wheezy snap2"
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1",
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec"
runCmd = "aptly publish source add -component=test maverick snap2"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishSourceAdd1Test, self).check()
self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages')
self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages.gz')
self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages.bz2')
self.check_exists('public/dists/wheezy/contrib/Contents-i386.gz')
self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages')
self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages.gz')
self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages.bz2')
self.check_exists('public/dists/wheezy/contrib/Contents-amd64.gz')
release = self.read_file('public/dists/wheezy/Release').split('\n')
components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None)
components = sorted(components.split(' '))
if ['contrib', 'main'] != components:
raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'contrib main'))
class PublishSourceAdd2Test(BaseTest):
"""
@@ -42,42 +23,14 @@ class PublishSourceAdd2Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly snapshot create snap2 from mirror wheezy-contrib",
"aptly snapshot create snap3 from mirror wheezy-non-free",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1",
"aptly publish source add -component=contrib,non-free wheezy snap2 snap3"
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly snapshot create snap3 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1",
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec"
runCmd = "aptly publish source add -component=test,other-test maverick snap2 snap3"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishSourceAdd2Test, self).check()
self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages')
self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages.gz')
self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages.bz2')
self.check_exists('public/dists/wheezy/contrib/Contents-i386.gz')
self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages')
self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages.gz')
self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages.bz2')
self.check_exists('public/dists/wheezy/contrib/Contents-amd64.gz')
self.check_exists('public/dists/wheezy/non-free/binary-i386/Packages')
self.check_exists('public/dists/wheezy/non-free/binary-i386/Packages.gz')
self.check_exists('public/dists/wheezy/non-free/binary-i386/Packages.bz2')
self.check_exists('public/dists/wheezy/non-free/Contents-i386.gz')
self.check_exists('public/dists/wheezy/non-free/binary-amd64/Packages')
self.check_exists('public/dists/wheezy/non-free/binary-amd64/Packages.gz')
self.check_exists('public/dists/wheezy/non-free/binary-amd64/Packages.bz2')
self.check_exists('public/dists/wheezy/non-free/Contents-amd64.gz')
release = self.read_file('public/dists/wheezy/Release').split('\n')
components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None)
components = sorted(components.split(' '))
if ['contrib', 'main', 'non-free'] != components:
raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'contrib main non-free'))
class PublishSourceAdd3Test(BaseTest):
"""
@@ -86,11 +39,11 @@ class PublishSourceAdd3Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly snapshot create snap2 from mirror gnuplot-maverick",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1",
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1",
]
runCmd = "aptly publish add -component=main wheezy snap2"
runCmd = "aptly publish source add -component=main maverick snap2"
expectedCode = 1
gold_processor = BaseTest.expand_environ
@@ -102,12 +55,44 @@ class PublishSourceList1Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly snapshot create snap2 from mirror wheezy-contrib",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1",
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1",
"aptly publish source add -component=test maverick snap2",
]
runCmd = "aptly publish source list"
runCmd = "aptly publish source list maverick"
gold_processor = BaseTest.expand_environ
class PublishSourceList2Test(BaseTest):
"""
publish source list: show source changes as JSON
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1",
"aptly publish source add -component=test maverick snap2",
]
runCmd = "aptly publish source list -json maverick"
gold_processor = BaseTest.expand_environ
class PublishSourceList3Test(BaseTest):
"""
publish source list: show source changes (empty)
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1",
]
runCmd = "aptly publish source list maverick"
expectedCode = 1
gold_processor = BaseTest.expand_environ
@@ -118,12 +103,11 @@ class PublishSourceDrop1Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly snapshot create snap2 from mirror wheezy-contrib",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1",
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1",
]
runCmd = "aptly publish source drop"
runCmd = "aptly publish source drop maverick"
gold_processor = BaseTest.expand_environ
@@ -134,12 +118,11 @@ class PublishSourceUpdate1Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly snapshot create snap2 from mirror gnuplot-maverick",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1",
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1",
]
runCmd = "aptly publish source update -component=main wheezy snap2"
runCmd = "aptly publish source update -component=main maverick snap2"
gold_processor = BaseTest.expand_environ
@@ -150,13 +133,12 @@ class PublishSourceUpdate2Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly snapshot create snap2 from mirror wheezy-main",
"aptly snapshot create snap3 from mirror gnuplot-maverick",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main,test snap1 snap2",
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly snapshot create snap3 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main,test snap1 snap2",
]
runCmd = "aptly publish source update -component=main,test wheezy snap2 snap3"
runCmd = "aptly publish source update -component=main,test maverick snap2 snap3"
gold_processor = BaseTest.expand_environ
@@ -167,11 +149,10 @@ class PublishSourceUpdate3Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1",
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1",
]
runCmd = "aptly publish source update -component=not-existent wheezy snap1"
runCmd = "aptly publish source update -component=not-existent maverick snap1"
gold_processor = BaseTest.expand_environ
@@ -182,12 +163,11 @@ class PublishSourceRemove1Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly snapshot create snap2 from mirror wheezy-contrib",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main,contrib snap1 snap2",
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main,test snap1 snap2",
]
runCmd = "aptly publish source remove -component=contrib wheezy"
runCmd = "aptly publish source remove -component=test maverick"
gold_processor = BaseTest.expand_environ
@@ -198,13 +178,12 @@ class PublishSourceRemove2Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly snapshot create snap2 from mirror wheezy-contrib",
"aptly snapshot create snap3 from mirror wheezy-non-free",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main,contrib,non-free snap1 snap2 snap3",
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly snapshot create snap3 empty",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main,test,other-test snap1 snap2 snap3",
]
runCmd = "aptly publish source remove -component=contrib,non-free wheezy"
runCmd = "aptly publish source remove -component=test,other-test maverick"
gold_processor = BaseTest.expand_environ
@@ -215,9 +194,9 @@ class PublishSourceRemove3Test(BaseTest):
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror wheezy-main",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1",
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1",
]
runCmd = "aptly publish source remove -component=not-existent wheezy"
runCmd = "aptly publish source remove -component=not-existent maverick"
expectedCode = 1
gold_processor = BaseTest.expand_environ