From 85f3d15e8c51370af35a4326541b05f4090a3498 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 26 Feb 2014 22:14:18 +0400 Subject: [PATCH] System tests for aptly repo drop. --- system/t09_repo/DropRepo1Test_gold | 1 + system/t09_repo/DropRepo1Test_repo-show | 1 + system/t09_repo/DropRepo2Test_gold | 3 ++ system/t09_repo/DropRepo3Test_gold | 1 + system/t09_repo/DropRepo4Test_gold | 1 + system/t09_repo/__init__.py | 1 + system/t09_repo/drop.py | 48 +++++++++++++++++++++++++ 7 files changed, 56 insertions(+) create mode 100644 system/t09_repo/DropRepo1Test_gold create mode 100644 system/t09_repo/DropRepo1Test_repo-show create mode 100644 system/t09_repo/DropRepo2Test_gold create mode 100644 system/t09_repo/DropRepo3Test_gold create mode 100644 system/t09_repo/DropRepo4Test_gold create mode 100644 system/t09_repo/drop.py diff --git a/system/t09_repo/DropRepo1Test_gold b/system/t09_repo/DropRepo1Test_gold new file mode 100644 index 00000000..eba27ffe --- /dev/null +++ b/system/t09_repo/DropRepo1Test_gold @@ -0,0 +1 @@ +Local repo `repo1` has been removed. diff --git a/system/t09_repo/DropRepo1Test_repo-show b/system/t09_repo/DropRepo1Test_repo-show new file mode 100644 index 00000000..01631ec5 --- /dev/null +++ b/system/t09_repo/DropRepo1Test_repo-show @@ -0,0 +1 @@ +ERROR: unable to show: local repo with name repo1 not found diff --git a/system/t09_repo/DropRepo2Test_gold b/system/t09_repo/DropRepo2Test_gold new file mode 100644 index 00000000..49fd5f44 --- /dev/null +++ b/system/t09_repo/DropRepo2Test_gold @@ -0,0 +1,3 @@ +Local repo `repo2` was used to create following snapshots: + * [local]: Snapshot from local repo [repo2] +ERROR: won't delete local repo with snapshots, use -force to override diff --git a/system/t09_repo/DropRepo3Test_gold b/system/t09_repo/DropRepo3Test_gold new file mode 100644 index 00000000..db9e12e9 --- /dev/null +++ b/system/t09_repo/DropRepo3Test_gold @@ -0,0 +1 @@ +Local repo `repo3` has been removed. diff --git a/system/t09_repo/DropRepo4Test_gold b/system/t09_repo/DropRepo4Test_gold new file mode 100644 index 00000000..ffa95b2c --- /dev/null +++ b/system/t09_repo/DropRepo4Test_gold @@ -0,0 +1 @@ +ERROR: unable to drop: local repo with name repo4 not found diff --git a/system/t09_repo/__init__.py b/system/t09_repo/__init__.py index d70fc443..1a637c71 100644 --- a/system/t09_repo/__init__.py +++ b/system/t09_repo/__init__.py @@ -4,5 +4,6 @@ Testing local repo management from .add import * from .create import * +from .drop import * from .show import * from .list import * diff --git a/system/t09_repo/drop.py b/system/t09_repo/drop.py new file mode 100644 index 00000000..30cb2ce3 --- /dev/null +++ b/system/t09_repo/drop.py @@ -0,0 +1,48 @@ +from lib import BaseTest + + +class DropRepo1Test(BaseTest): + """ + drop repo: regular drop + """ + fixtureCmds = [ + "aptly repo create repo1", + ] + runCmd = "aptly repo drop repo1" + + def check(self): + self.check_output() + self.check_cmd_output("aptly repo show repo1", "repo-show", expected_code=1) + + +class DropRepo2Test(BaseTest): + """ + drop repo: in use by snapshots + """ + fixtureCmds = [ + "aptly repo create repo2", + "aptly repo add repo2 ${files}", + "aptly snapshot create local from repo repo2", + ] + runCmd = "aptly repo drop repo2" + expectedCode = 1 + + +class DropRepo3Test(BaseTest): + """ + drop repo: force + """ + fixtureCmds = [ + "aptly repo create repo3", + "aptly repo add repo3 ${files}", + "aptly snapshot create local from repo repo3", + ] + runCmd = "aptly repo drop --force repo3" + + +class DropRepo4Test(BaseTest): + """ + drop repo: no such repo + """ + runCmd = "aptly repo drop repo4" + expectedCode = 1