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

View File

@@ -1 +1,3 @@
Test
Adding component "test" with source "snap2" [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1 +1,4 @@
Test
Adding component "test" with source "snap2" [snapshot]...
Adding component "other-test" with source "snap3" [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1 +1 @@
Test
ERROR: unable to add: component "main" has already been added

View File

@@ -1 +1 @@
Test
Source changes have been removed successfully.

View File

@@ -1 +1,3 @@
Test
Sources:
main: snap1 [snapshot]
test: snap2 [snapshot]

View File

@@ -0,0 +1,10 @@
[
{
"Component": "main",
"Name": "snap1"
},
{
"Component": "test",
"Name": "snap2"
}
]

View File

@@ -0,0 +1 @@
ERROR: unable to list: no source changes exist

View File

@@ -1 +1,3 @@
Test
Removing component "test" with source "snap2" [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1 +1,4 @@
Test
Removing component "test" with source "snap2" [snapshot]...
Removing component "other-test" with source "snap3" [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1 +1 @@
Test
ERROR: unable to remove: component "not-existent" does not exist

View File

@@ -1 +1,3 @@
Test
Updating component "main" with source "snap2" [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1 +1,4 @@
Test
Updating component "main" with source "snap2" [snapshot]...
Updating component "test" with source "snap3" [snapshot]...
You can run 'aptly publish update maverick .' to update the content of the published repository.

View File

@@ -1 +1 @@
Test
ERROR: unable to update: component "not-existent" does not exist

View File

@@ -1 +1 @@
ERROR: unable to switch: local repo with name snap1 not found
ERROR: unable to switch: not a published snapshot repository

View File

@@ -0,0 +1,8 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components ...
Published snapshot repository ./maverick (origin: LP-PPA-gladky-anton-gnuplot) [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {other-test: [snap3]: Created as empty}, {test: [snap2]: Created as empty} has been successfully updated.

View File

@@ -0,0 +1,8 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components ...
Published snapshot repository ./maverick [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been successfully updated.

View File

@@ -0,0 +1,8 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components other-test, test...
Published snapshot repository ./maverick [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {other-test: [snap5]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {test: [snap4]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been successfully updated.

View File

@@ -0,0 +1,8 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components test...
Published snapshot repository ./maverick [i386] publishes {other-test: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {test: [snap3]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick} has been successfully updated.

View File

@@ -3,4 +3,4 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Cleaning up prefix "." components contrib, main...
Publish for local repo ./squeeze [i386] publishes {contrib: [repo2]}, {main: [repo1]} has been successfully updated.
Published local repository ./squeeze [i386] publishes {contrib: [repo2]}, {main: [repo1]} has been successfully updated.

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

View File

@@ -175,39 +175,6 @@ class PublishUpdate3Test(BaseTest):
self.check_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')
#class PublishUpdate4Test(BaseTest):
# """
# publish update: added some packages, but list of published archs doesn't change
# """
# fixtureCmds = [
# "aptly repo create local-repo",
# "aptly repo add local-repo ${files}/pyspi_0.6.1-1.3.dsc",
# "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick local-repo",
# "aptly repo add local-repo ${files}/libboost-program-options-dev_1.49.0.1_i386.deb"
# ]
# runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
# gold_processor = BaseTest.expand_environ
#
# def check(self):
# super(PublishUpdate4Test, self).check()
#
# self.check_exists('public/dists/maverick/InRelease')
# self.check_exists('public/dists/maverick/Release')
# self.check_exists('public/dists/maverick/Release.gpg')
#
# self.check_not_exists('public/dists/maverick/main/binary-i386/Packages')
# self.check_not_exists('public/dists/maverick/main/binary-i386/Packages.gz')
# self.check_not_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
# self.check_exists('public/dists/maverick/main/source/Sources')
# self.check_exists('public/dists/maverick/main/source/Sources.gz')
# self.check_exists('public/dists/maverick/main/source/Sources.bz2')
#
# self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc')
# self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz')
# self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz')
# self.check_not_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')
class PublishUpdate5Test(BaseTest):
"""
publish update: no such publish
@@ -216,20 +183,6 @@ class PublishUpdate5Test(BaseTest):
expectedCode = 1
class PublishUpdate6Test(BaseTest):
"""
publish update: not a local repo
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1",
]
runCmd = "aptly publish update maverick"
expectedCode = 1
class PublishUpdate7Test(BaseTest):
"""
publish update: multiple components, add some packages
@@ -487,3 +440,169 @@ class PublishUpdate14Test(BaseTest):
self.check_exists('public/dists/bookworm/main/binary-i386/Packages.gz')
self.check_exists('public/pool/bookworm/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')
class PublishUpdate15Test(BaseTest):
"""
publish update: source added
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"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 -architectures=i386 -component=main snap1",
"aptly publish source add -component=test,other-test maverick snap2 snap3"
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishUpdate15Test, self).check()
self.check_exists('public/dists/maverick/InRelease')
self.check_exists('public/dists/maverick/Release')
self.check_exists('public/dists/maverick/Release.gpg')
self.check_exists('public/dists/maverick/main/binary-i386/Packages')
self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz')
self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/test/binary-i386/Packages')
self.check_exists('public/dists/maverick/test/binary-i386/Packages.gz')
self.check_exists('public/dists/maverick/test/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/other-test/binary-i386/Packages')
self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.gz')
self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.bz2')
release = self.read_file('public/dists/maverick/Release').split('\n')
components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None)
components = sorted(components.split(' '))
if ['main', 'other-test', 'test'] != components:
raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'main other-test test'))
class PublishUpdate16Test(BaseTest):
"""
publish update: source removed
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"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 -architectures=i386 -component=main,test,other-test snap1 snap2 snap3",
"aptly publish source remove -component=test,other-test maverick"
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishUpdate16Test, self).check()
self.check_exists('public/dists/maverick/InRelease')
self.check_exists('public/dists/maverick/Release')
self.check_exists('public/dists/maverick/Release.gpg')
self.check_exists('public/dists/maverick/main/binary-i386/Packages')
self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz')
self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/main/Contents-i386.gz')
release = self.read_file('public/dists/maverick/Release').split('\n')
components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None)
components = sorted(components.split(' '))
if ['main'] != components:
raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'main'))
class PublishUpdate17Test(BaseTest):
"""
publish update: source updated
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly snapshot create snap3 empty",
"aptly snapshot create snap4 from mirror gnuplot-maverick",
"aptly snapshot create snap5 from mirror gnuplot-maverick",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -architectures=i386 -component=main,test,other-test snap1 snap2 snap3",
"aptly publish source update -component=test,other-test maverick snap4 snap5"
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishUpdate17Test, self).check()
self.check_exists('public/dists/maverick/InRelease')
self.check_exists('public/dists/maverick/Release')
self.check_exists('public/dists/maverick/Release.gpg')
self.check_exists('public/dists/maverick/main/binary-i386/Packages')
self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz')
self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/main/Contents-i386.gz')
self.check_exists('public/dists/maverick/test/binary-i386/Packages')
self.check_exists('public/dists/maverick/test/binary-i386/Packages.gz')
self.check_exists('public/dists/maverick/test/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/test/Contents-i386.gz')
self.check_exists('public/dists/maverick/other-test/binary-i386/Packages')
self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.gz')
self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/other-test/Contents-i386.gz')
release = self.read_file('public/dists/maverick/Release').split('\n')
components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None)
components = sorted(components.split(' '))
if ['main', 'other-test', 'test'] != components:
raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'main other-test test'))
class PublishUpdate18Test(BaseTest):
"""
publish update: source added, updated and removed
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly snapshot create snap3 from mirror gnuplot-maverick",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -architectures=i386 -component=main,test snap1 snap2",
"aptly publish source remove -component=main maverick",
"aptly publish source update -component=test maverick snap3",
"aptly publish source add -component=other-test maverick snap1"
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishUpdate18Test, self).check()
self.check_exists('public/dists/maverick/InRelease')
self.check_exists('public/dists/maverick/Release')
self.check_exists('public/dists/maverick/Release.gpg')
self.check_exists('public/dists/maverick/test/binary-i386/Packages')
self.check_exists('public/dists/maverick/test/binary-i386/Packages.gz')
self.check_exists('public/dists/maverick/test/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/test/Contents-i386.gz')
self.check_exists('public/dists/maverick/other-test/binary-i386/Packages')
self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.gz')
self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/other-test/Contents-i386.gz')
release = self.read_file('public/dists/maverick/Release').split('\n')
components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None)
components = sorted(components.split(' '))
if ['other-test', 'test'] != components:
raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'other-test test'))

View File

@@ -905,6 +905,58 @@ class PublishSwitchAPISkipCleanupTestRepo(APITest):
self.check_exists("public/" + prefix + "/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc")
class PublishShowAPITestRepo(APITest):
"""
GET /publish/:prefix/:distribution
"""
def check(self):
repo1_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo1_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(
self.upload("/api/files/" + d,
"pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
self.check_equal(self.post_task("/api/repos/" + repo1_name + "/file/" + d).status_code, 200)
# publishing under prefix, default distribution
prefix = self.random_name()
self.check_equal(self.post(
"/api/publish/" + prefix,
json={
"Architectures": ["i386", "source"],
"SourceKind": "local",
"Sources": [{"Component": "main", "Name": repo1_name}],
"Signing": DefaultSigningOptions,
}
).status_code, 201)
repo_expected = {
'AcquireByHash': False,
'Architectures': ['i386', 'source'],
'Codename': '',
'Distribution': 'wheezy',
'Label': '',
'NotAutomatic': '',
'ButAutomaticUpgrades': '',
'Origin': '',
'Path': prefix + '/' + 'wheezy',
'Prefix': prefix,
'SkipContents': False,
'MultiDist': False,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo1_name}],
'Storage': '',
'Suite': ''}
repo = self.get("/api/publish/" + prefix + "/wheezy")
self.check_equal(repo.status_code, 200)
self.check_equal(repo_expected, repo.json())
class ServePublishedListTestRepo(APITest):
"""
GET /repos
@@ -1036,3 +1088,420 @@ class ServePublishedNotFoundTestRepo(APITest):
get = self.get("/repos/apiandserve/pool/main/b/boost-defaults/i-dont-exist")
if get.status_code != 404:
raise Exception(f"Expected status 404 != {get.status_code}")
class PublishSourcesAddAPITestRepo(APITest):
"""
POST /publish/:prefix/:distribution/sources
"""
fixtureGpg = True
def check(self):
repo1_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo1_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo1_name + "/file/" + d).status_code, 200)
# publishing under prefix, default distribution
prefix = self.random_name()
self.check_equal(self.post(
"/api/publish/" + prefix,
json={
"SourceKind": "local",
"Sources": [{"Component": "main", "Name": repo1_name}],
"Signing": DefaultSigningOptions,
}
).status_code, 201)
repo2_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo2_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo2_name + "/file/" + d).status_code, 200)
# Actual test
self.check_equal(self.post(
"/api/publish/" + prefix + "/wheezy/sources",
json={"Component": "test", "Name": repo2_name}
).status_code, 201)
sources_expected = [{"Component": "main", "Name": repo1_name}, {"Component": "test", "Name": repo2_name}]
sources = self.get("/api/publish/" + prefix + "/wheezy/sources")
self.check_equal(sources.status_code, 200)
self.check_equal(sources_expected, sources.json())
class PublishSourceUpdateAPITestRepo(APITest):
"""
PUT /publish/:prefix/:distribution/sources/main
"""
fixtureGpg = True
def check(self):
repo1_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo1_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo1_name + "/file/" + d).status_code, 200)
# publishing under prefix, default distribution
prefix = self.random_name()
self.check_equal(self.post(
"/api/publish/" + prefix,
json={
"SourceKind": "local",
"Sources": [{"Component": "main", "Name": repo1_name}],
"Signing": DefaultSigningOptions,
}
).status_code, 201)
repo2_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo2_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo2_name + "/file/" + d).status_code, 200)
# Actual test
self.check_equal(self.put(
"/api/publish/" + prefix + "/wheezy/sources/main",
json={"Component": "main", "Name": repo2_name}
).status_code, 200)
sources_expected = [{"Component": "main", "Name": repo2_name}]
sources = self.get("/api/publish/" + prefix + "/wheezy/sources")
self.check_equal(sources.status_code, 200)
self.check_equal(sources_expected, sources.json())
class PublishSourcesUpdateAPITestRepo(APITest):
"""
PUT /publish/:prefix/:distribution/sources
"""
fixtureGpg = True
def check(self):
repo1_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo1_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo1_name + "/file/" + d).status_code, 200)
repo2_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo2_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo2_name + "/file/" + d).status_code, 200)
# publishing under prefix, default distribution
prefix = self.random_name()
self.check_equal(self.post(
"/api/publish/" + prefix,
json={
"SourceKind": "local",
"Sources": [{"Component": "main", "Name": repo1_name}],
"Signing": DefaultSigningOptions,
}
).status_code, 201)
# Actual test
self.check_equal(self.put(
"/api/publish/" + prefix + "/wheezy/sources",
json=[{"Component": "test", "Name": repo1_name}, {"Component": "other-test", "Name": repo2_name}]
).status_code, 200)
sources_expected = [{"Component": "other-test", "Name": repo2_name}, {"Component": "test", "Name": repo1_name}]
sources = self.get("/api/publish/" + prefix + "/wheezy/sources")
self.check_equal(sources.status_code, 200)
self.check_equal(sources_expected, sources.json())
class PublishSourceRemoveAPITestRepo(APITest):
"""
DELETE /publish/:prefix/:distribution/sources/test
"""
fixtureGpg = True
def check(self):
repo1_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo1_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo1_name + "/file/" + d).status_code, 200)
repo2_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo2_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo2_name + "/file/" + d).status_code, 200)
# publishing under prefix, default distribution
prefix = self.random_name()
self.check_equal(self.post(
"/api/publish/" + prefix,
json={
"SourceKind": "local",
"Sources": [{"Component": "main", "Name": repo1_name}, {"Component": "test", "Name": repo2_name}],
"Signing": DefaultSigningOptions,
}
).status_code, 201)
# Actual test
self.check_equal(self.delete("/api/publish/" + prefix + "/wheezy/sources/test").status_code, 200)
sources_expected = [{"Component": "main", "Name": repo1_name}]
sources = self.get("/api/publish/" + prefix + "/wheezy/sources")
self.check_equal(sources.status_code, 200)
self.check_equal(sources_expected, sources.json())
class PublishSourcesDropAPITestRepo(APITest):
"""
DELETE /publish/:prefix/:distribution/sources
"""
fixtureGpg = True
def check(self):
repo1_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo1_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo1_name + "/file/" + d).status_code, 200)
repo2_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo2_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo2_name + "/file/" + d).status_code, 200)
# publishing under prefix, default distribution
prefix = self.random_name()
self.check_equal(self.post(
"/api/publish/" + prefix,
json={
"SourceKind": "local",
"Sources": [{"Component": "main", "Name": repo1_name}, {"Component": "test", "Name": repo2_name}],
"Signing": DefaultSigningOptions,
}
).status_code, 201)
self.check_equal(self.delete("/api/publish/" + prefix + "/wheezy/sources/test").status_code, 200)
# Actual test
self.check_equal(self.delete("/api/publish/" + prefix + "/wheezy/sources").status_code, 200)
self.check_equal(self.get("/api/publish/" + prefix + "/wheezy/sources").status_code, 404)
class PublishSourcesListAPITestRepo(APITest):
"""
GET /publish/:prefix/:distribution/sources
"""
fixtureGpg = True
def check(self):
repo1_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo1_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo1_name + "/file/" + d).status_code, 200)
repo2_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo2_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo2_name + "/file/" + d).status_code, 200)
# publishing under prefix, default distribution
prefix = self.random_name()
self.check_equal(self.post(
"/api/publish/" + prefix,
json={
"SourceKind": "local",
"Sources": [{"Component": "main", "Name": repo1_name}],
"Signing": DefaultSigningOptions,
}
).status_code, 201)
# Actual test
self.check_equal(self.post(
"/api/publish/" + prefix + "/wheezy/sources",
json={"Component": "test", "Name": repo1_name}
).status_code, 201)
self.check_equal(self.put(
"/api/publish/" + prefix + "/wheezy/sources/main",
json={"Component": "main", "Name": repo2_name}
).status_code, 200)
self.check_equal(self.delete("/api/publish/" + prefix + "/wheezy/sources/main").status_code, 200)
sources_expected = [{"Component": "test", "Name": repo1_name}]
sources = self.get("/api/publish/" + prefix + "/wheezy/sources")
self.check_equal(sources.status_code, 200)
self.check_equal(sources_expected, sources.json())
class PublishUpdateSourcesAPITestRepo(APITest):
"""
POST /publish/:prefix/:distribution/update
"""
fixtureGpg = True
def check(self):
repo1_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo1_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo1_name + "/file/" + d).status_code, 200)
repo2_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo2_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo2_name + "/file/" + d).status_code, 200)
repo3_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo3_name, "DefaultDistribution": "wheezy"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200)
self.check_equal(self.post("/api/repos/" + repo3_name + "/file/" + d).status_code, 200)
# publishing under prefix, default distribution
prefix = self.random_name()
self.check_equal(self.post(
"/api/publish/" + prefix,
json={
"Signing": DefaultSigningOptions,
"SourceKind": "local",
"Sources": [{"Component": "main", "Name": repo1_name}, {"Component": "test", "Name": repo2_name}],
}
).status_code, 201)
# remove 'main' component
self.check_equal(self.delete("/api/publish/" + prefix + "/wheezy/sources/main").status_code, 200)
# update 'test' component
self.check_equal(self.put(
"/api/publish/" + prefix + "/wheezy/sources/test",
json={"Component": "test", "Name": repo1_name}
).status_code, 200)
# add 'other-test' component
self.check_equal(self.post(
"/api/publish/" + prefix + "/wheezy/sources",
json={"Component": "other-test", "Name": repo3_name}
).status_code, 201)
sources_expected = [{"Component": "other-test", "Name": repo3_name}, {"Component": "test", "Name": repo1_name}]
sources = self.get("/api/publish/" + prefix + "/wheezy/sources")
self.check_equal(sources.status_code, 200)
self.check_equal(sources_expected, sources.json())
# update published repository and publish new content
self.check_equal(self.post(
"/api/publish/" + prefix + "/wheezy/update",
json={
"AcquireByHash": True,
"MultiDist": False,
"Signing": DefaultSigningOptions,
"SkipBz2": True,
"SkipContents": True,
}
).status_code, 200)
repo_expected = {
'AcquireByHash': True,
'Architectures': ['i386', 'source'],
'Codename': '',
'Distribution': 'wheezy',
'Label': '',
'Origin': '',
'NotAutomatic': '',
'ButAutomaticUpgrades': '',
'Path': prefix + '/' + 'wheezy',
'Prefix': prefix,
'SkipContents': True,
'MultiDist': False,
'SourceKind': 'local',
'Sources': [{"Component": "other-test", "Name": repo3_name}, {"Component": "test", "Name": repo1_name}],
'Storage': '',
'Suite': ''}
all_repos = self.get("/api/publish")
self.check_equal(all_repos.status_code, 200)
self.check_in(repo_expected, all_repos.json())