Skip to content

Commit

Permalink
Merge pull request #92 from ekohl/fix-tests
Browse files Browse the repository at this point in the history
Actually run acceptance tests
  • Loading branch information
ekohl authored Jun 10, 2022
2 parents c325c61 + a46a1be commit 75af499
Show file tree
Hide file tree
Showing 16 changed files with 146 additions and 222 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Librarian-puppet

[![Build Status](https://travis-ci.org/voxpupuli/librarian-puppet.png?branch=master)](https://travis-ci.org/voxpupuli/librarian-puppet)

## Introduction

Librarian-puppet is a bundler for your puppet infrastructure. You can use
Expand Down
7 changes: 1 addition & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ CLOBBER.include('Gemfile.lock')

RSpec::Core::RakeTask.new
Cucumber::Rake::Task.new(:features) do |t|
require 'puppet'
puppet_version = Puppet::version.gsub("~>","").split(".").first.to_i
tags = (2..5).select {|i| i != puppet_version}.map{|i| "--tags '@puppet#{puppet_version} and not @puppet#{i}'"}
# don't run githubtarball scenarios in Travis, they easily fail with rate limit exceeded
tags << "--tags 'not @github'" if ENV['TRAVIS']=='true'
t.cucumber_opts = tags.join(" ")
t.cucumber_opts = ['--tags "not @puppet2"']
end

Rake::TestTask.new do |test|
Expand Down
3 changes: 1 addition & 2 deletions features/help.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ Feature: displays help if no subcommand is passed
And a useful help screen should be displayed

Scenario: App defaults to help subcommand
When I run `librarian-puppet`
Then the exit status should be 0
When I successfully run `librarian-puppet`
And the output should contain "librarian-puppet version"
3 changes: 1 addition & 2 deletions features/init.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ Feature: init subcommand should generate a Puppetfile


Scenario: init subcommand should generate a Puppetfile
When I run `librarian-puppet init`
Then the exit status should be 0
When I successfully run `librarian-puppet init`
Then a file named "Puppetfile" should exist
36 changes: 12 additions & 24 deletions features/install.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ Feature: cli/install
mod 'puppetlabs/stdlib', :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => '4.6.0'
mod 'librarian/test', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/test'
"""
When I run `librarian-puppet install --verbose`
Then the exit status should be 0
When I successfully run `librarian-puppet install --verbose`
And the file "modules/stdlib/metadata.json" should match /"version": "4\.6\.0"/
And the output should not match /Executing puppet module install for puppetlabs.stdlib/

Expand All @@ -49,8 +48,7 @@ Feature: cli/install
]
}
"""
When I run `librarian-puppet install --verbose`
Then the exit status should be 0
When I successfully run `librarian-puppet install --verbose`
And the file "modules/stdlib/metadata.json" should match /"version": "4\.6\.0"/
And the output should not match /Executing puppet module install for puppetlabs.stdlib/

Expand All @@ -62,8 +60,7 @@ Feature: cli/install
mod 'librarian-duplicated_dependencies', :path => '../../features/examples/duplicated_dependencies'
exclusion 'ripienaar-concat'
"""
When I run `librarian-puppet install --verbose`
Then the exit status should be 0
When I successfully run `librarian-puppet install --verbose`
And the file "modules/concat/metadata.json" should match /"name": "puppetlabs-concat"/
And the output should contain "Excluding dependency ripienaar-concat from"

Expand Down Expand Up @@ -110,15 +107,12 @@ Feature: cli/install
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I run `librarian-puppet config`
Then the exit status should be 0
When I successfully run `librarian-puppet config`
And the output should contain "rsync: true"
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
And a directory named "modules/test" should exist
And the file "modules/test" should have an inode and ctime
When I run `librarian-puppet install --clean`
Then the exit status should be 0
When I successfully run `librarian-puppet install --clean`
And a directory named "modules/test" should exist
And the file "modules/test" should not have the same inode or ctime as before

Expand All @@ -134,16 +128,13 @@ Feature: cli/install
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I run `librarian-puppet config`
Then the exit status should be 0
When I successfully run `librarian-puppet config`
And the output should contain "rsync: true"
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
And a directory named "modules/test" should exist
And the file "modules/test" should have an inode and ctime
Given I wait for 1 second
When I run `librarian-puppet install --destructive`
Then the exit status should be 0
When I successfully run `librarian-puppet install --destructive`
And a directory named "modules/test" should exist
And the file "modules/test" should not have the same inode or ctime as before

Expand All @@ -159,15 +150,12 @@ Feature: cli/install
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I run `librarian-puppet config`
Then the exit status should be 0
When I successfully run `librarian-puppet config`
And the output should contain "rsync: true"
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
And a directory named "modules/test" should exist
And the file "modules/test" should have an inode and ctime
Given I wait for 1 second
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
And a directory named "modules/test" should exist
And the file "modules/test" should have the same inode and ctime as before
68 changes: 31 additions & 37 deletions features/install/forge.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Feature: cli/install/forge
mod 'puppetlabs/ntp'
"""
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
And the file "modules/ntp/metadata.json" should match /"name": "puppetlabs-ntp"/
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/

Expand All @@ -27,8 +26,7 @@ Feature: cli/install/forge
]
}
"""
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/

Scenario: Running install with no Puppetfile and Modulefile
Expand Down Expand Up @@ -58,8 +56,7 @@ Feature: cli/install/forge
mod 'puppetlabs/apt', '0.0.4'
"""
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
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/metadata.json" should match /"name": "puppetlabs-stdlib"/
Expand All @@ -83,18 +80,18 @@ Feature: cli/install/forge
"""
forge "https://forgeapi.puppetlabs.com"
mod 'puppetlabs/apache', '0.4.0'
mod 'puppetlabs/postgresql', '2.0.1'
mod 'puppetlabs-firewall', '<= 1.9.0' # apache has an unqualified dependency on firewall, which in turn pulls in a too-new version of stdlib
mod 'puppetlabs/apt', '< 1.4.1' # 1.4.2 causes trouble in travis
mod 'puppetlabs/apache', '7.0.0' # compatible with stdlib 8
mod 'puppetlabs/postgresql', '7.4.0' # incompatible with stdlib 8
"""
When I run `librarian-puppet install --verbose`
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'/
# Default timeout is 15 seconds but this is too short in most cases
When I successfully run `librarian-puppet install --verbose` for up to 30 seconds
And the file "modules/apache/metadata.json" should match /"name": "puppetlabs-apache"/
And the file "modules/apache/metadata.json" should match /"version": "7\.0\.0"/
And the file "modules/postgresql/metadata.json" should match /"name": "puppetlabs-postgresql"/
And the file "modules/postgresql/metadata.json" should match /"version": "7\.4\.0"/
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/
And the file "modules/stdlib/metadata.json" should match /"version": "7\.1\.0"/

Scenario: Installing a module with several constraints
Given a file named "Puppetfile" with:
Expand All @@ -103,8 +100,7 @@ Feature: cli/install/forge
mod 'puppetlabs/apt', '>=1.0.0', '<1.0.1'
"""
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
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/metadata.json" should match /"name": "puppetlabs-stdlib"/
Expand All @@ -129,24 +125,26 @@ Feature: cli/install/forge
"""
forge "https://forgeapi.puppetlabs.com"
mod 'puppetlabs/postgresql', '3.2.0'
mod 'puppetlabs/apt', '< 1.4.1' # 1.4.2 causes trouble in travis
mod 'puppetlabs/postgresql', '7.4.1'
mod 'puppetlabs/apt', '< 8.4.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 '3\.2\.0'/
When I successfully run `librarian-puppet install`
And the file "modules/postgresql/metadata.json" should match /"name": "puppetlabs-postgresql"/
And the file "modules/postgresql/metadata.json" should match /"version": "7\.4\.1"/
And the file "modules/apt/metadata.json" should match /"name": "puppetlabs-apt"/
And the file "modules/apt/metadata.json" should match /"version": "8\.3\.0"/

Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppetlabs.com"
mod 'puppetlabs/postgresql', :git => 'git://github.com/puppetlabs/puppet-postgresql', :ref => '3.3.0'
mod 'puppetlabs/postgresql', :git => 'https://github.com/puppetlabs/puppet-postgresql', :ref => 'v7.5.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 '3\.3\.0'/
When I successfully run `librarian-puppet install`
And the file "modules/postgresql/metadata.json" should match /"name": "puppetlabs-postgresql"/
And the file "modules/postgresql/metadata.json" should match /"version": "7\.5\.0"/
And the file "modules/apt/metadata.json" should match /"name": "puppetlabs-apt"/
And the file "modules/apt/metadata.json" should not match /"version": "8\.3\.0"/

Scenario: Installing a module that does not exist
Given a file named "Puppetfile" with:
Expand Down Expand Up @@ -181,8 +179,7 @@ Feature: cli/install/forge
mod 'sbadia/gitlab', '0.1.0'
"""
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
And the file "modules/gitlab/Modulefile" should match /version *'0\.1\.0'/

Scenario: Source dependencies from Modulefile
Expand Down Expand Up @@ -220,8 +217,7 @@ Feature: cli/install/forge
]
}
"""
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
And the file "modules/postgresql/metadata.json" should match /"name": "puppetlabs-postgresql"/

Scenario: Source dependencies from Modulefile using dash instead of slash
Expand All @@ -247,8 +243,7 @@ Feature: cli/install/forge
mod 'pdxcat/collectd', '2.1.0'
"""
When I run `librarian-puppet install`
Then the exit status should be 0
When I successfully run `librarian-puppet install`
And the file "modules/collectd/Modulefile" should match /name *'pdxcat-collectd'/
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/

Expand All @@ -260,8 +255,7 @@ Feature: cli/install/forge
mod 'theforeman-dhcp', '4.0.0'
mod 'puppet-dhcp', '2.0.0'
"""
When I run `librarian-puppet install --verbose`
Then the exit status should be 0
When I successfully run `librarian-puppet install --verbose`
And the file "modules/dhcp/metadata.json" should match /"name": "theforeman-dhcp"/
And the output should contain "Dependency on module 'dhcp' is fullfilled by multiple modules and only one will be used"

Expand Down
Loading

0 comments on commit 75af499

Please sign in to comment.