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