[DRE-commits] [librarian-puppet] 101/153: Check git revision in tests with git rev-parse

Stig Sandbeck Mathisen ssm at debian.org
Wed Jun 1 20:30:50 UTC 2016


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

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

commit 61377abd49caf5330f53eaecf8fcb82c735197e4
Author: Carlos Sanchez <carlos at apache.org>
Date:   Thu Mar 5 16:10:57 2015 +0000

    Check git revision in tests with git rev-parse
---
 features/install/git.feature                   |  4 ++--
 features/step_definitions/convergence_steps.rb |  8 ++++++++
 features/update.feature                        | 10 +++++-----
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/features/install/git.feature b/features/install/git.feature
index 36d572d..ed60c68 100644
--- a/features/install/git.feature
+++ b/features/install/git.feature
@@ -16,10 +16,10 @@ Feature: cli/install/git
     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/apache/.git/HEAD" should match /b18fad908fe7cb8fbc6604fde1962c85540095f4/
+    And the git revision of module "apache" should be "b18fad908fe7cb8fbc6604fde1962c85540095f4"
     And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
     And the file "modules/stdlib/Modulefile" should match /version *'2\.2\.1'/
-    And the file "modules/stdlib/.git/HEAD" should match /a70b09d5de035de5254ebe6ad6e1519a6d7cf588/
+    And the git revision of module "stdlib" should be "a70b09d5de035de5254ebe6ad6e1519a6d7cf588"
 
   @spaces
   Scenario: Installing a module in a path with spaces
diff --git a/features/step_definitions/convergence_steps.rb b/features/step_definitions/convergence_steps.rb
index d6812c3..a05d71b 100644
--- a/features/step_definitions/convergence_steps.rb
+++ b/features/step_definitions/convergence_steps.rb
@@ -27,6 +27,14 @@ Then /^the file "([^"]*)" should not have the same inode or ctime as before$/ do
     end
 end
 
+Then /^the git revision of module "([^"]*)" should be "([0-9a-f]*)"$/ do |module_name, rev|
+    cd("modules/#{module_name}")
+    cmd = "git rev-parse HEAD"
+    run_simple(cmd)
+    assert_exact_output(rev, output_from(cmd).strip)
+    cd("../..")
+end
+
 Given /^I wait for (\d+) seconds?$/ do |n|
   sleep(n.to_i)
 end
diff --git a/features/update.feature b/features/update.feature
index 08db42b..ef209c0 100644
--- a/features/update.feature
+++ b/features/update.feature
@@ -122,10 +122,10 @@ Feature: cli/update
     """
     When I run `librarian-puppet install`
     Then the exit status should be 0
-    And the file "modules/stdlib/.git/HEAD" should match /614b3fbf6c15893e89ed8654fb85596223b5b7c5/
+    And the git revision of module "stdlib" should be "614b3fbf6c15893e89ed8654fb85596223b5b7c5"
     When I run `librarian-puppet update`
     Then the exit status should be 0
-    And the file "modules/stdlib/.git/HEAD" should match /a3c600d5f277f0c9d91c98ef67daf7efc9eed3c5/
+    And the git revision of module "stdlib" should be "a3c600d5f277f0c9d91c98ef67daf7efc9eed3c5"
 
   Scenario: Updating a module with invalid versions in git
     Given a file named "Puppetfile" with:
@@ -271,17 +271,17 @@ Feature: cli/update
     When I run `librarian-puppet install`
     Then the exit status should be 0
     And the file "Puppetfile.lock" should contain "614b3fbf6c15893e89ed8654fb85596223b5b7c5"
-    And the file "modules/stdlib/.git/HEAD" should match /614b3fbf6c15893e89ed8654fb85596223b5b7c5/
+    And the git revision of module "stdlib" should be "614b3fbf6c15893e89ed8654fb85596223b5b7c5"
     And a directory named "modules/stdlib" should exist
     When I run `librarian-puppet update --verbose`
     Then the exit status should be 0
     And a directory named "modules/stdlib" should exist
     And the file "modules/stdlib" should have an inode and ctime
     And the file "Puppetfile.lock" should contain "a3c600d5f277f0c9d91c98ef67daf7efc9eed3c5"
-    And the file "modules/stdlib/.git/HEAD" should match /a3c600d5f277f0c9d91c98ef67daf7efc9eed3c5/
+    And the git revision of module "stdlib" should be "a3c600d5f277f0c9d91c98ef67daf7efc9eed3c5"
     When I run `librarian-puppet update --verbose`
     Then the exit status should be 0
     And a directory named "modules/stdlib" should exist
     And the file "modules/stdlib" should have the same inode and ctime as before
     And the file "Puppetfile.lock" should contain "a3c600d5f277f0c9d91c98ef67daf7efc9eed3c5"
-    And the file "modules/stdlib/.git/HEAD" should match /a3c600d5f277f0c9d91c98ef67daf7efc9eed3c5/
+    And the git revision of module "stdlib" should be "a3c600d5f277f0c9d91c98ef67daf7efc9eed3c5"

-- 
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