1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
Feature: cli/install
In order to be worth anything
Puppet librarian needs to install modules properly
Scenario: Running install with no Puppetfile nor metadata.json
Given there is no Puppetfile
When I run `librarian-puppet install`
Then the output should match /^Metadata file does not exist: .*metadata.json$/
And the exit status should be 1
Scenario: Running install with bad metadata.json
Given a file named "metadata.json" with:
"""
"""
When I run `librarian-puppet install`
Then the output should match /^Unable to parse json file .*metadata.json: .*$/
And the exit status should be 1
Scenario: Install a module transitive dependency from git and forge should be deterministic
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
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 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/
Scenario: Install duplicated dependencies from git and forge, last one wins
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
metadata
mod 'puppetlabs-stdlib', :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => '4.6.0'
"""
And a file named "metadata.json" with:
"""
{
"name": "random name",
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 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/
Scenario: Installing two modules with same name and using exclusions
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'librarian-duplicated_dependencies', :path => '../../features/examples/duplicated_dependencies'
exclusion 'ripienaar-concat'
"""
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"
Scenario: Installing two modules with same name and using exclusions, apply transitively
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'librarian-duplicated_dependencies_transitive', :path => '../../features/examples/duplicated_dependencies_transitive'
"""
When PENDING I run `librarian-puppet install --verbose`
Then the exit status should be 0
And the file "modules/concat/metadata.json" should match /"name": "puppetlabs-concat"/
Scenario: Install a module with the rsync configuration using the --clean flag
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'maestrodev/test'
"""
And a file named ".librarian/puppet/config" with:
"""
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I successfully run `librarian-puppet config`
And the output should contain "rsync: true"
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 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
Scenario: Install a module with the rsync configuration using the --destructive flag
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'maestrodev/test'
"""
And a file named ".librarian/puppet/config" with:
"""
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I successfully run `librarian-puppet config`
And the output should contain "rsync: true"
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 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
Scenario: Install a module with the rsync configuration
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'maestrodev/test'
"""
And a file named ".librarian/puppet/config" with:
"""
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I successfully run `librarian-puppet config`
And the output should contain "rsync: true"
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 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
|