From 53e73c52a451e555d44fe1073d22df1138a492e4 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 26 Mar 2014 21:40:17 +0400 Subject: [PATCH] Tests for guessing publishing defaults from local repo params. #12 --- system/t06_publish/PublishRepo14Test_gold | 13 ++++ system/t06_publish/PublishSnapshot20Test_gold | 11 +++ system/t06_publish/PublishSnapshot21Test_gold | 1 + system/t06_publish/PublishSnapshot22Test_gold | 11 +++ system/t06_publish/PublishSnapshot23Test_gold | 11 +++ system/t06_publish/repo.py | 34 +++++++++ system/t06_publish/snapshot.py | 73 +++++++++++++++++++ 7 files changed, 154 insertions(+) create mode 100644 system/t06_publish/PublishRepo14Test_gold create mode 100644 system/t06_publish/PublishSnapshot20Test_gold create mode 100644 system/t06_publish/PublishSnapshot21Test_gold create mode 100644 system/t06_publish/PublishSnapshot22Test_gold create mode 100644 system/t06_publish/PublishSnapshot23Test_gold diff --git a/system/t06_publish/PublishRepo14Test_gold b/system/t06_publish/PublishRepo14Test_gold new file mode 100644 index 00000000..c4e1f06a --- /dev/null +++ b/system/t06_publish/PublishRepo14Test_gold @@ -0,0 +1,13 @@ +Loading packages... +Generating metadata files and linking package files... +Signing file '${HOME}/.aptly/public/dists/maverick/Release' with gpg, please enter your passphrase when prompted: +Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release' with gpg, please enter your passphrase when prompted: + +Local repo local-repo has been successfully published. +Please setup your webserver to serve directory '${HOME}/.aptly/public' with autoindexing. +Now you can add following line to apt sources: + deb http://your-server/ maverick contrib + deb-src http://your-server/ maverick contrib +Don't forget to add your GPG key to apt with apt-key. + +You can also use `aptly serve` to publish your repositories over HTTP quickly. diff --git a/system/t06_publish/PublishSnapshot20Test_gold b/system/t06_publish/PublishSnapshot20Test_gold new file mode 100644 index 00000000..1ff04477 --- /dev/null +++ b/system/t06_publish/PublishSnapshot20Test_gold @@ -0,0 +1,11 @@ +Loading packages... +Generating metadata files and linking package files... + +Snapshot snap3 has been successfully published. +Please setup your webserver to serve directory '${HOME}/.aptly/public' with autoindexing. +Now you can add following line to apt sources: + deb http://your-server/ maverick main + deb-src http://your-server/ maverick main +Don't forget to add your GPG key to apt with apt-key. + +You can also use `aptly serve` to publish your repositories over HTTP quickly. diff --git a/system/t06_publish/PublishSnapshot21Test_gold b/system/t06_publish/PublishSnapshot21Test_gold new file mode 100644 index 00000000..f6e05973 --- /dev/null +++ b/system/t06_publish/PublishSnapshot21Test_gold @@ -0,0 +1 @@ +ERROR: unable to publish: unable to guess distribution name, please specify explicitly diff --git a/system/t06_publish/PublishSnapshot22Test_gold b/system/t06_publish/PublishSnapshot22Test_gold new file mode 100644 index 00000000..1ff04477 --- /dev/null +++ b/system/t06_publish/PublishSnapshot22Test_gold @@ -0,0 +1,11 @@ +Loading packages... +Generating metadata files and linking package files... + +Snapshot snap3 has been successfully published. +Please setup your webserver to serve directory '${HOME}/.aptly/public' with autoindexing. +Now you can add following line to apt sources: + deb http://your-server/ maverick main + deb-src http://your-server/ maverick main +Don't forget to add your GPG key to apt with apt-key. + +You can also use `aptly serve` to publish your repositories over HTTP quickly. diff --git a/system/t06_publish/PublishSnapshot23Test_gold b/system/t06_publish/PublishSnapshot23Test_gold new file mode 100644 index 00000000..1ff04477 --- /dev/null +++ b/system/t06_publish/PublishSnapshot23Test_gold @@ -0,0 +1,11 @@ +Loading packages... +Generating metadata files and linking package files... + +Snapshot snap3 has been successfully published. +Please setup your webserver to serve directory '${HOME}/.aptly/public' with autoindexing. +Now you can add following line to apt sources: + deb http://your-server/ maverick main + deb-src http://your-server/ maverick main +Don't forget to add your GPG key to apt with apt-key. + +You can also use `aptly serve` to publish your repositories over HTTP quickly. diff --git a/system/t06_publish/repo.py b/system/t06_publish/repo.py index 904f3581..47de351c 100644 --- a/system/t06_publish/repo.py +++ b/system/t06_publish/repo.py @@ -306,3 +306,37 @@ class PublishRepo13Test(BaseTest): ] runCmd = "aptly publish repo --distribution=mars --skip-signing local-repo" expectedCode = 1 + + +class PublishRepo14Test(BaseTest): + """ + publish repo: publishing defaults from local repo + """ + fixtureCmds = [ + "aptly repo create -distribution=maverick -component=contrib local-repo", + "aptly repo add local-repo ${files}", + ] + runCmd = "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec local-repo" + gold_processor = BaseTest.expand_environ + + def check(self): + super(PublishRepo14Test, 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/contrib/binary-i386/Packages') + self.check_exists('public/dists/maverick/contrib/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/contrib/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/contrib/source/Sources') + self.check_exists('public/dists/maverick/contrib/source/Sources.gz') + self.check_exists('public/dists/maverick/contrib/source/Sources.bz2') + + self.check_exists('public/pool/contrib/p/pyspi/pyspi_0.6.1-1.3.dsc') + self.check_exists('public/pool/contrib/p/pyspi/pyspi_0.6.1-1.3.diff.gz') + self.check_exists('public/pool/contrib/p/pyspi/pyspi_0.6.1.orig.tar.gz') + self.check_exists('public/pool/contrib/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc') + self.check_exists('public/pool/contrib/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb') + + diff --git a/system/t06_publish/snapshot.py b/system/t06_publish/snapshot.py index 2b22a883..21d73415 100644 --- a/system/t06_publish/snapshot.py +++ b/system/t06_publish/snapshot.py @@ -483,3 +483,76 @@ class PublishSnapshot19Test(BaseTest): ] runCmd = "aptly publish snapshot -skip-signing snap5" gold_processor = BaseTest.expand_environ + + +class PublishSnapshot20Test(BaseTest): + """ + publish snapshot: guess distribution from long chain including local repo + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly repo create -distribution=maverick local-repo", + "aptly repo add local-repo ${files}", + "aptly snapshot create snap2 from repo local-repo", + "aptly snapshot merge snap3 snap1 snap2", + + ] + runCmd = "aptly publish snapshot -skip-signing snap3" + gold_processor = BaseTest.expand_environ + + +class PublishSnapshot21Test(BaseTest): + """ + publish snapshot: conflict in distributions + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly repo create -distribution=squeeze local-repo", + "aptly repo add local-repo ${files}", + "aptly snapshot create snap2 from repo local-repo", + "aptly snapshot merge snap3 snap1 snap2", + + ] + runCmd = "aptly publish snapshot -skip-signing snap3" + gold_processor = BaseTest.expand_environ + expectedCode = 1 + + +class PublishSnapshot22Test(BaseTest): + """ + publish snapshot: conflict in components + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly repo create -component=contrib -distribution=maverick local-repo", + "aptly repo add local-repo ${files}", + "aptly snapshot create snap2 from repo local-repo", + "aptly snapshot merge snap3 snap1 snap2", + + ] + runCmd = "aptly publish snapshot -skip-signing snap3" + gold_processor = BaseTest.expand_environ + + +class PublishSnapshot23Test(BaseTest): + """ + publish snapshot: distribution empty plus distribution maverick + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly repo create local-repo", + "aptly repo add local-repo ${files}", + "aptly snapshot create snap2 from repo local-repo", + "aptly snapshot merge snap3 snap1 snap2", + + ] + runCmd = "aptly publish snapshot -skip-signing snap3" + gold_processor = BaseTest.expand_environ