[DRE-commits] [librarian-puppet] 69/97: Split install tests for easier management

Stig Sandbeck Mathisen ssm at debian.org
Tue Mar 11 12:12:51 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository librarian-puppet.

commit 51fb900343398864adb5e4368ca28fee2d5ac66a
Author: Carlos Sanchez <csanchez at maestrodev.com>
Date:   Mon Jan 20 13:15:51 2014 +0100

    Split install tests for easier management
---
 features/install.feature                           | 254 ---------------------
 .../{install.feature => install/forge.feature}     | 118 +---------
 features/install/git.feature                       | 109 +++++++++
 3 files changed, 111 insertions(+), 370 deletions(-)

diff --git a/features/install.feature b/features/install.feature
index 7592045..75ff0dc 100644
--- a/features/install.feature
+++ b/features/install.feature
@@ -7,257 +7,3 @@ Feature: cli/install
     When I run `librarian-puppet install`
     Then the output should contain "Could not find Puppetfile"
     And the exit status should be 1
-
-  @veryslow
-  Scenario: Installing a module and its dependencies
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/apt'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/apt/Modulefile" should match /name *'puppetlabs-apt'/
-    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
-
-  @veryveryslow
-  Scenario: Installing an exact version of a module
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/apt', '0.0.4'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/apt/Modulefile" should match /name *'puppetlabs-apt'/
-    And the file "modules/apt/Modulefile" should match /version *'0\.0\.4'/
-    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
-
-  @veryslow
-  Scenario: Installing a module with invalid versions in the forge
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/apache', '0.4.0'
-    mod 'puppetlabs/postgresql', '2.0.1'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/apache/Modulefile" should match /name *'puppetlabs-apache'/
-    And the file "modules/apache/Modulefile" should match /version *'0\.4\.0'/
-    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
-    And the file "modules/postgresql/Modulefile" should match /version *'2\.0\.1'/
-
-  @veryslow
-  Scenario: Installing a module from git 
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/apache',
-        :git => 'https://github.com/puppetlabs/puppetlabs-apache.git', :ref => '0.6.0'
-
-    mod 'puppetlabs/stdlib',
-        :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => 'v2.2.1'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/apache/Modulefile" should match /name *'puppetlabs-apache'/
-    And the file "modules/apache/Modulefile" should match /version *'0\.6\.0'/
-    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
-    And the file "modules/stdlib/Modulefile" should match /version *'2\.2\.1'/
-
-  @slow
-  Scenario: Installing a module with invalid versions in git
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod "apache",
-      :git => "https://github.com/puppetlabs/puppetlabs-apache.git", :ref => "0.5.0-rc1"
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/apache/Modulefile" should match /name *'puppetlabs-apache'/
-    And the file "modules/apache/Modulefile" should match /version *'0\.5\.0-rc1'/
-
-  @slow
-  Scenario: Installing a module with several constraints
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/apt', '>=1.0.0', '<1.0.1'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/apt/Modulefile" should match /name *'puppetlabs-apt'/
-    And the file "modules/apt/Modulefile" should match /version *'1\.0\.0'/
-    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
-
-  @veryslow
-  Scenario: Switching a module from forge to git
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/postgresql', '1.0.0'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
-    And the file "modules/postgresql/Modulefile" should match /version *'1\.0\.0'/
-    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
-    When I overwrite "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/postgresql',
-      :git => 'https://github.com/puppetlabs/puppet-postgresql.git', :ref => '1.0.0'
-    """
-    And I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
-    And the file "modules/postgresql/Modulefile" should match /version *'1\.0\.0'/
-    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
-
-  @slow
-  Scenario: Changing the path
-    Given a directory named "puppet"
-    And a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/apt'
-    """
-    When I run `librarian-puppet install --path puppet/modules`
-    And I run `librarian-puppet config`
-    Then the exit status should be 0
-    And the output from "librarian-puppet config" should contain "path: puppet/modules"
-    And the file "puppet/modules/apt/Modulefile" should match /name *'puppetlabs-apt'/
-    And the file "puppet/modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
-
-  @veryslow
-  Scenario: Handle range version numbers
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/postgresql'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
-
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/postgresql', :git => 'git://github.com/puppetlabs/puppet-postgresql'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
-
-  Scenario: Installing a module that does not exist
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/xxxxx'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 1
-    And the output should contain "Unable to find module 'puppetlabs/xxxxx' on http://forge.puppetlabs.com"
-
-  @slow
-  Scenario: Install a module with dependencies specified in a Puppetfile
-    Given a file named "Puppetfile" with:
-    """
-    mod 'with_puppetfile', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/with_puppetfile'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/with_puppetfile/Modulefile" should match /name *'with-puppetfile'/
-    And the file "modules/test/Modulefile" should match /name *'librarian-test'/
-
-  @slow
-  Scenario: Install a module with dependencies specified in a Puppetfile and Modulefile
-    Given a file named "Puppetfile" with:
-    """
-    mod 'with_puppetfile', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/with_puppetfile_and_modulefile'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/with_puppetfile/Modulefile" should match /name *'with-puppetfile-and-modulefile'/
-    And the file "modules/test/Modulefile" should match /name *'maestrodev-test'/
-
-  Scenario: Install a module with conflicts
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/apache', '0.6.0'
-    mod 'puppetlabs/stdlib', '<2.2.1'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 1
-    And the output should contain "Could not resolve the dependencies"
-
-  @veryslow
-  Scenario: Install a module from git and using path
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'test', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/test'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/test/Modulefile" should match /version *'0\.0\.1'/
-    And a file named "modules/stdlib/Modulefile" should exist
-
-  @slow
-  Scenario: Install a module from the Forge with dependencies without version
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'sbadia/gitlab', '0.1.0'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/gitlab/Modulefile" should match /version *'0\.1\.0'/
-
-  @veryslow
-  Scenario: Install a module from git without version
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'test', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/dependency_without_version'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/test/Modulefile" should match /version *'0\.0\.1'/
-    And a file named "modules/stdlib/Modulefile" should exist
-
-  @veryslow
-  Scenario: Source dependencies from Modulefile
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    modulefile
-    """
-    And a file named "Modulefile" with:
-    """
-    name "random name"
-    dependency "puppetlabs/postgresql", "2.4.1"
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
diff --git a/features/install.feature b/features/install/forge.feature
similarity index 51%
copy from features/install.feature
copy to features/install/forge.feature
index 7592045..4c1919c 100644
--- a/features/install.feature
+++ b/features/install/forge.feature
@@ -1,12 +1,5 @@
-Feature: cli/install
-  In order to be worth anything
-  Puppet librarian needs to install modules properly
-
-  Scenario: Running install with no Puppetfile
-    Given there is no Puppetfile
-    When I run `librarian-puppet install`
-    Then the output should contain "Could not find Puppetfile"
-    And the exit status should be 1
+Feature: cli/install/forge
+  Puppet librarian needs to install modules from the Puppet Forge
 
   @veryslow
   Scenario: Installing a module and its dependencies
@@ -51,39 +44,6 @@ Feature: cli/install
     And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
     And the file "modules/postgresql/Modulefile" should match /version *'2\.0\.1'/
 
-  @veryslow
-  Scenario: Installing a module from git 
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/apache',
-        :git => 'https://github.com/puppetlabs/puppetlabs-apache.git', :ref => '0.6.0'
-
-    mod 'puppetlabs/stdlib',
-        :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => 'v2.2.1'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/apache/Modulefile" should match /name *'puppetlabs-apache'/
-    And the file "modules/apache/Modulefile" should match /version *'0\.6\.0'/
-    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
-    And the file "modules/stdlib/Modulefile" should match /version *'2\.2\.1'/
-
-  @slow
-  Scenario: Installing a module with invalid versions in git
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod "apache",
-      :git => "https://github.com/puppetlabs/puppetlabs-apache.git", :ref => "0.5.0-rc1"
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/apache/Modulefile" should match /name *'puppetlabs-apache'/
-    And the file "modules/apache/Modulefile" should match /version *'0\.5\.0-rc1'/
-
   @slow
   Scenario: Installing a module with several constraints
     Given a file named "Puppetfile" with:
@@ -98,32 +58,6 @@ Feature: cli/install
     And the file "modules/apt/Modulefile" should match /version *'1\.0\.0'/
     And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
 
-  @veryslow
-  Scenario: Switching a module from forge to git
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/postgresql', '1.0.0'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
-    And the file "modules/postgresql/Modulefile" should match /version *'1\.0\.0'/
-    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
-    When I overwrite "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'puppetlabs/postgresql',
-      :git => 'https://github.com/puppetlabs/puppet-postgresql.git', :ref => '1.0.0'
-    """
-    And I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
-    And the file "modules/postgresql/Modulefile" should match /version *'1\.0\.0'/
-    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
-
   @slow
   Scenario: Changing the path
     Given a directory named "puppet"
@@ -173,28 +107,6 @@ Feature: cli/install
     Then the exit status should be 1
     And the output should contain "Unable to find module 'puppetlabs/xxxxx' on http://forge.puppetlabs.com"
 
-  @slow
-  Scenario: Install a module with dependencies specified in a Puppetfile
-    Given a file named "Puppetfile" with:
-    """
-    mod 'with_puppetfile', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/with_puppetfile'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/with_puppetfile/Modulefile" should match /name *'with-puppetfile'/
-    And the file "modules/test/Modulefile" should match /name *'librarian-test'/
-
-  @slow
-  Scenario: Install a module with dependencies specified in a Puppetfile and Modulefile
-    Given a file named "Puppetfile" with:
-    """
-    mod 'with_puppetfile', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/with_puppetfile_and_modulefile'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/with_puppetfile/Modulefile" should match /name *'with-puppetfile-and-modulefile'/
-    And the file "modules/test/Modulefile" should match /name *'maestrodev-test'/
-
   Scenario: Install a module with conflicts
     Given a file named "Puppetfile" with:
     """
@@ -207,19 +119,6 @@ Feature: cli/install
     Then the exit status should be 1
     And the output should contain "Could not resolve the dependencies"
 
-  @veryslow
-  Scenario: Install a module from git and using path
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'test', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/test'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/test/Modulefile" should match /version *'0\.0\.1'/
-    And a file named "modules/stdlib/Modulefile" should exist
-
   @slow
   Scenario: Install a module from the Forge with dependencies without version
     Given a file named "Puppetfile" with:
@@ -233,19 +132,6 @@ Feature: cli/install
     And the file "modules/gitlab/Modulefile" should match /version *'0\.1\.0'/
 
   @veryslow
-  Scenario: Install a module from git without version
-    Given a file named "Puppetfile" with:
-    """
-    forge "http://forge.puppetlabs.com"
-
-    mod 'test', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/dependency_without_version'
-    """
-    When I run `librarian-puppet install`
-    Then the exit status should be 0
-    And the file "modules/test/Modulefile" should match /version *'0\.0\.1'/
-    And a file named "modules/stdlib/Modulefile" should exist
-
-  @veryslow
   Scenario: Source dependencies from Modulefile
     Given a file named "Puppetfile" with:
     """
diff --git a/features/install/git.feature b/features/install/git.feature
new file mode 100644
index 0000000..111b1bd
--- /dev/null
+++ b/features/install/git.feature
@@ -0,0 +1,109 @@
+Feature: cli/install/git
+  Puppet librarian needs to install modules from git repositories
+
+  @veryslow
+  Scenario: Installing a module from git 
+    Given a file named "Puppetfile" with:
+    """
+    forge "http://forge.puppetlabs.com"
+
+    mod 'puppetlabs/apache',
+        :git => 'https://github.com/puppetlabs/puppetlabs-apache.git', :ref => '0.6.0'
+
+    mod 'puppetlabs/stdlib',
+        :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => 'v2.2.1'
+    """
+    When I run `librarian-puppet install`
+    Then the exit status should be 0
+    And the file "modules/apache/Modulefile" should match /name *'puppetlabs-apache'/
+    And the file "modules/apache/Modulefile" should match /version *'0\.6\.0'/
+    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
+    And the file "modules/stdlib/Modulefile" should match /version *'2\.2\.1'/
+
+  @slow
+  Scenario: Installing a module with invalid versions in git
+    Given a file named "Puppetfile" with:
+    """
+    forge "http://forge.puppetlabs.com"
+
+    mod "apache",
+      :git => "https://github.com/puppetlabs/puppetlabs-apache.git", :ref => "0.5.0-rc1"
+    """
+    When I run `librarian-puppet install`
+    Then the exit status should be 0
+    And the file "modules/apache/Modulefile" should match /name *'puppetlabs-apache'/
+    And the file "modules/apache/Modulefile" should match /version *'0\.5\.0-rc1'/
+
+  @veryslow
+  Scenario: Switching a module from forge to git
+    Given a file named "Puppetfile" with:
+    """
+    forge "http://forge.puppetlabs.com"
+
+    mod 'puppetlabs/postgresql', '1.0.0'
+    """
+    When I run `librarian-puppet install`
+    Then the exit status should be 0
+    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
+    And the file "modules/postgresql/Modulefile" should match /version *'1\.0\.0'/
+    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
+    When I overwrite "Puppetfile" with:
+    """
+    forge "http://forge.puppetlabs.com"
+
+    mod 'puppetlabs/postgresql',
+      :git => 'https://github.com/puppetlabs/puppet-postgresql.git', :ref => '1.0.0'
+    """
+    And I run `librarian-puppet install`
+    Then the exit status should be 0
+    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
+    And the file "modules/postgresql/Modulefile" should match /version *'1\.0\.0'/
+    And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
+
+  @slow
+  Scenario: Install a module with dependencies specified in a Puppetfile
+    Given a file named "Puppetfile" with:
+    """
+    mod 'with_puppetfile', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/with_puppetfile'
+    """
+    When I run `librarian-puppet install`
+    Then the exit status should be 0
+    And the file "modules/with_puppetfile/Modulefile" should match /name *'with-puppetfile'/
+    And the file "modules/test/Modulefile" should match /name *'librarian-test'/
+
+  @slow
+  Scenario: Install a module with dependencies specified in a Puppetfile and Modulefile
+    Given a file named "Puppetfile" with:
+    """
+    mod 'with_puppetfile', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/with_puppetfile_and_modulefile'
+    """
+    When I run `librarian-puppet install`
+    Then the exit status should be 0
+    And the file "modules/with_puppetfile/Modulefile" should match /name *'with-puppetfile-and-modulefile'/
+    And the file "modules/test/Modulefile" should match /name *'maestrodev-test'/
+
+  @veryslow
+  Scenario: Install a module from git and using path
+    Given a file named "Puppetfile" with:
+    """
+    forge "http://forge.puppetlabs.com"
+
+    mod 'test', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/test'
+    """
+    When I run `librarian-puppet install`
+    Then the exit status should be 0
+    And the file "modules/test/Modulefile" should match /version *'0\.0\.1'/
+    And a file named "modules/stdlib/Modulefile" should exist
+
+  @veryslow
+  Scenario: Install a module from git without version
+    Given a file named "Puppetfile" with:
+    """
+    forge "http://forge.puppetlabs.com"
+
+    mod 'test', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/dependency_without_version'
+    """
+    When I run `librarian-puppet install`
+    Then the exit status should be 0
+    And the file "modules/test/Modulefile" should match /version *'0\.0\.1'/
+    And a file named "modules/stdlib/Modulefile" should exist

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/librarian-puppet.git



More information about the Pkg-ruby-extras-commits mailing list