From df811ff36a89f3a436d5453724f1d9486404b455 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 26 Feb 2014 21:17:10 +0400 Subject: [PATCH] Tests for aptly snapshot create from repo --- system/t05_snapshot/CreateSnapshot6Test_gold | 3 ++ .../CreateSnapshot6Test_snapshot_show | 7 ++++ system/t05_snapshot/CreateSnapshot7Test_gold | 1 + system/t05_snapshot/CreateSnapshot8Test_gold | 1 + system/t05_snapshot/create.py | 39 +++++++++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 system/t05_snapshot/CreateSnapshot6Test_gold create mode 100644 system/t05_snapshot/CreateSnapshot6Test_snapshot_show create mode 100644 system/t05_snapshot/CreateSnapshot7Test_gold create mode 100644 system/t05_snapshot/CreateSnapshot8Test_gold diff --git a/system/t05_snapshot/CreateSnapshot6Test_gold b/system/t05_snapshot/CreateSnapshot6Test_gold new file mode 100644 index 00000000..21cecd00 --- /dev/null +++ b/system/t05_snapshot/CreateSnapshot6Test_gold @@ -0,0 +1,3 @@ + +Snapshot snap6 successfully created. +You can run 'aptly publish snapshot snap6' to publish snapshot as Debian repository. diff --git a/system/t05_snapshot/CreateSnapshot6Test_snapshot_show b/system/t05_snapshot/CreateSnapshot6Test_snapshot_show new file mode 100644 index 00000000..005b97ee --- /dev/null +++ b/system/t05_snapshot/CreateSnapshot6Test_snapshot_show @@ -0,0 +1,7 @@ +Name: snap6 +Description: Snapshot from local repo [local-repo] +Number of packages: 3 +Packages: + libboost-program-options-dev-1.49.0.1_i386 + pyspi-0.6.1-1.3_source + pyspi-0.6.1-1.4_source diff --git a/system/t05_snapshot/CreateSnapshot7Test_gold b/system/t05_snapshot/CreateSnapshot7Test_gold new file mode 100644 index 00000000..d2676525 --- /dev/null +++ b/system/t05_snapshot/CreateSnapshot7Test_gold @@ -0,0 +1 @@ +ERROR: unable to create snapshot: local repo with name no-such-repo not found diff --git a/system/t05_snapshot/CreateSnapshot8Test_gold b/system/t05_snapshot/CreateSnapshot8Test_gold new file mode 100644 index 00000000..3cc7f5fe --- /dev/null +++ b/system/t05_snapshot/CreateSnapshot8Test_gold @@ -0,0 +1 @@ +ERROR: unable to add snapshot: snapshot with name snap8 already exists diff --git a/system/t05_snapshot/create.py b/system/t05_snapshot/create.py index 6c219ee6..f4ea1e1f 100644 --- a/system/t05_snapshot/create.py +++ b/system/t05_snapshot/create.py @@ -57,3 +57,42 @@ class CreateSnapshot5Test(BaseTest): fixtureCmds = ["aptly snapshot create snap5 empty"] runCmd = "aptly snapshot create snap5 empty" expectedCode = 1 + + +class CreateSnapshot6Test(BaseTest): + """ + create snapshot: from repo + """ + fixtureCmds = [ + "aptly repo create local-repo", + "aptly repo add local-repo ${files}" + ] + runCmd = "aptly snapshot create snap6 from repo local-repo" + + def check(self): + def remove_created_at(s): + return re.sub(r"Created At: [0-9:A-Za-z -]+\n", "", s) + + self.check_output() + self.check_cmd_output("aptly snapshot show -with-packages snap6", "snapshot_show", match_prepare=remove_created_at) + + +class CreateSnapshot7Test(BaseTest): + """ + create snapshot: no repo + """ + runCmd = "aptly snapshot create snap1 from repo no-such-repo" + expectedCode = 1 + + +class CreateSnapshot8Test(BaseTest): + """ + create snapshot: duplicate name from repo + """ + fixtureCmds = [ + "aptly repo create local-repo", + "aptly repo add local-repo ${files}", + "aptly snapshot create snap8 from repo local-repo" + ] + runCmd = "aptly snapshot create snap8 from repo local-repo" + expectedCode = 1