| 1 |
Feature: cli/install/git |
| 2 |
Puppet librarian needs to install modules from git repositories |
| 3 |
|
| 4 |
Scenario: Installing a module from git |
| 5 |
Given a file named "Puppetfile" with: |
| 6 |
""" |
| 7 |
forge "https://forgeapi.puppet.com" |
| 8 |
|
| 9 |
mod 'puppetlabs/apache', |
| 10 |
:git => 'https://github.com/puppetlabs/puppetlabs-apache.git', :ref => '1.4.0' |
| 11 |
|
| 12 |
mod 'puppetlabs/stdlib', |
| 13 |
:git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => '4.6.0' |
| 14 |
""" |
| 15 |
When I successfully run `librarian-puppet install` |
| 16 |
And the file "modules/apache/metadata.json" should match /"name": "puppetlabs-apache"/ |
| 17 |
And the file "modules/apache/metadata.json" should match /"version": "1\.4\.0"/ |
| 18 |
And the git revision of module "apache" should be "e4ec6d4985fdb23e26c809e0d5786823d0689f90" |
| 19 |
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/ |
| 20 |
And the file "modules/stdlib/metadata.json" should match /"version": "4\.6\.0"/ |
| 21 |
And the git revision of module "stdlib" should be "73474b00b5ae3cbccec6cd0711311d6450139e51" |
| 22 |
|
| 23 |
@spaces |
| 24 |
Scenario: Installing a module in a path with spaces |
| 25 |
Given a file named "Puppetfile" with: |
| 26 |
""" |
| 27 |
mod 'puppetlabs/stdlib', '4.6.0', :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => '4.6.0' |
| 28 |
""" |
| 29 |
When I successfully run `librarian-puppet install` |
| 30 |
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/ |
| 31 |
|
| 32 |
Scenario: Installing a module with invalid versions in git |
| 33 |
Given a file named "Puppetfile" with: |
| 34 |
""" |
| 35 |
forge "https://forgeapi.puppet.com" |
| 36 |
|
| 37 |
mod "apache", |
| 38 |
:git => "https://github.com/puppetlabs/puppetlabs-apache.git", :ref => "1.4.0" |
| 39 |
""" |
| 40 |
When I successfully run `librarian-puppet install` |
| 41 |
And the file "modules/apache/metadata.json" should match /"name": "puppetlabs-apache"/ |
| 42 |
And the file "modules/apache/metadata.json" should match /"version": "1\.4\.0"/ |
| 43 |
|
| 44 |
Scenario: Switching a module from forge to git |
| 45 |
Given a file named "Puppetfile" with: |
| 46 |
""" |
| 47 |
forge "https://forgeapi.puppet.com" |
| 48 |
|
| 49 |
mod 'puppetlabs/postgresql', '7.4.1' |
| 50 |
""" |
| 51 |
When I successfully run `librarian-puppet install` |
| 52 |
And the file "modules/postgresql/metadata.json" should match /"name": "puppetlabs-postgresql"/ |
| 53 |
And the file "modules/postgresql/metadata.json" should match /"version": "7\.4\.1"/ |
| 54 |
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/ |
| 55 |
When I overwrite "Puppetfile" with: |
| 56 |
""" |
| 57 |
forge "https://forgeapi.puppet.com" |
| 58 |
|
| 59 |
mod 'puppetlabs/postgresql', |
| 60 |
:git => 'https://github.com/puppetlabs/puppetlabs-postgresql.git', :ref => 'v7.5.0' |
| 61 |
""" |
| 62 |
And I run `librarian-puppet install` |
| 63 |
Then the exit status should be 0 |
| 64 |
And the file "modules/postgresql/metadata.json" should match /"name": "puppetlabs-postgresql"/ |
| 65 |
And the file "modules/postgresql/metadata.json" should match /"version": "7\.5\.0"/ |
| 66 |
And the file "modules/postgresql/.git/HEAD" should match /0a2cb69ccbbb0a55d42c5da33d44b0eaf33f9546/ |
| 67 |
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/ |
| 68 |
|
| 69 |
Scenario: Install a module with dependencies specified in metadata.json |
| 70 |
Given a file named "Puppetfile" with: |
| 71 |
""" |
| 72 |
mod 'puppetlabs-apt', :git => 'https://github.com/puppetlabs/puppetlabs-apt.git', :ref => '1.5.2' |
| 73 |
""" |
| 74 |
When I successfully run `librarian-puppet install` |
| 75 |
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/ |
| 76 |
And the file "modules/apt/metadata.json" should match /"name": "puppetlabs-apt"/ |
| 77 |
|
| 78 |
Scenario: Install a module with dependencies specified in a Puppetfile |
| 79 |
Given a file named "Puppetfile" with: |
| 80 |
""" |
| 81 |
mod 'librarian/with_puppetfile', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/with_puppetfile' |
| 82 |
""" |
| 83 |
When I successfully run `librarian-puppet install` |
| 84 |
And the file "modules/with_puppetfile/metadata.json" should match /"name": "librarian-with_puppetfile"/ |
| 85 |
And the file "modules/test/metadata.json" should match /"name": "librarian-test"/ |
| 86 |
|
| 87 |
Scenario: Install a module with dependencies specified in a Puppetfile and metadata.json |
| 88 |
Given a file named "Puppetfile" with: |
| 89 |
""" |
| 90 |
mod 'librarian/with_puppetfile', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/with_puppetfile_and_metadata_json' |
| 91 |
""" |
| 92 |
When I successfully run `librarian-puppet install` |
| 93 |
And the file "modules/with_puppetfile/metadata.json" should match /"name": "librarian-with_puppetfile_and_metadata_json"/ |
| 94 |
And the file "modules/test/metadata.json" should match /"name": "maestrodev-test"/ |
| 95 |
|
| 96 |
Scenario: Running install without metadata.json |
| 97 |
Given a file named "Puppetfile" with: |
| 98 |
""" |
| 99 |
forge "https://forgeapi.puppet.com" |
| 100 |
|
| 101 |
mod 'puppetlabs/stdlib', :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => '4.6.0' |
| 102 |
""" |
| 103 |
When I successfully run `librarian-puppet install` |
| 104 |
|
| 105 |
Scenario: Running install with metadata.json without dependencies |
| 106 |
Given a file named "Puppetfile" with: |
| 107 |
""" |
| 108 |
forge "https://forgeapi.puppet.com" |
| 109 |
|
| 110 |
mod 'puppetlabs/sqlite', :git => 'https://github.com/puppetlabs/puppetlabs-sqlite.git', :ref => '84a0a6' |
| 111 |
""" |
| 112 |
When I successfully run `librarian-puppet install` |
| 113 |
|
| 114 |
Scenario: Install a module using metadata syntax |
| 115 |
Given a file named "Puppetfile" with: |
| 116 |
""" |
| 117 |
mod 'librarian/metadata_syntax', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/metadata_syntax' |
| 118 |
""" |
| 119 |
When I successfully run `librarian-puppet install` |
| 120 |
And the file "modules/metadata_syntax/metadata.json" should match /"name": "librarian-metadata_syntax"/ |
| 121 |
And the file "modules/test/metadata.json" should match /"name": "maestrodev-test"/ |
| 122 |
|
| 123 |
Scenario: Install a module from git and using path |
| 124 |
Given a file named "Puppetfile" with: |
| 125 |
""" |
| 126 |
forge "https://forgeapi.puppet.com" |
| 127 |
|
| 128 |
mod 'librarian-test', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/test' |
| 129 |
""" |
| 130 |
When I successfully run `librarian-puppet install` |
| 131 |
And the file "modules/test/metadata.json" should match /"version": "0\.0\.1"/ |
| 132 |
And a file named "modules/stdlib/metadata.json" should exist |
| 133 |
|
| 134 |
Scenario: Install a module from git without version |
| 135 |
Given a file named "Puppetfile" with: |
| 136 |
""" |
| 137 |
forge "https://forgeapi.puppet.com" |
| 138 |
|
| 139 |
mod 'test', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/dependency_without_version' |
| 140 |
""" |
| 141 |
When I successfully run `librarian-puppet install` |
| 142 |
And the file "modules/test/metadata.json" should match /"version": "0\.0\.1"/ |
| 143 |
And a file named "modules/stdlib/metadata.json" should exist |
| 144 |
|
| 145 |
Scenario: Install from Puppetfile with duplicated entries |
| 146 |
Given a file named "Puppetfile" with: |
| 147 |
""" |
| 148 |
mod 'puppetlabs-stdlib', |
| 149 |
:git => 'git://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => 'main' |
| 150 |
|
| 151 |
mod 'puppetlabs-stdlib', |
| 152 |
:git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => 'main' |
| 153 |
""" |
| 154 |
When I successfully run `librarian-puppet install` |
| 155 |
And the output should contain "Dependency 'puppetlabs-stdlib' duplicated for module, merging" |
| 156 |
|
| 157 |
Scenario: Installing a module from git with the --strip-dot-git flag |
| 158 |
Given a file named "Puppetfile" with: |
| 159 |
""" |
| 160 |
mod 'puppetlabs-stdlib', |
| 161 |
:git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', |
| 162 |
:ref => 'main' |
| 163 |
""" |
| 164 |
When I successfully run `librarian-puppet install --strip-dot-git` for up to 60 seconds |
| 165 |
And a directory named "modules/stdlib/.git" should not exist |