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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
Feature: cli/install/git
Puppet librarian needs to install modules from git repositories
Scenario: Installing a module from git
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'puppetlabs/apache',
:git => 'https://github.com/puppetlabs/puppetlabs-apache.git', :ref => '1.4.0'
mod 'puppetlabs/stdlib',
:git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => '4.6.0'
"""
When I successfully run `librarian-puppet install`
And the file "modules/apache/metadata.json" should match /"name": "puppetlabs-apache"/
And the file "modules/apache/metadata.json" should match /"version": "1\.4\.0"/
And the git revision of module "apache" should be "e4ec6d4985fdb23e26c809e0d5786823d0689f90"
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/
And the file "modules/stdlib/metadata.json" should match /"version": "4\.6\.0"/
And the git revision of module "stdlib" should be "73474b00b5ae3cbccec6cd0711311d6450139e51"
@spaces
Scenario: Installing a module in a path with spaces
Given a file named "Puppetfile" with:
"""
mod 'puppetlabs/stdlib', '4.6.0', :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => '4.6.0'
"""
When I successfully run `librarian-puppet install`
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/
Scenario: Installing a module with invalid versions in git
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod "apache",
:git => "https://github.com/puppetlabs/puppetlabs-apache.git", :ref => "1.4.0"
"""
When I successfully run `librarian-puppet install`
And the file "modules/apache/metadata.json" should match /"name": "puppetlabs-apache"/
And the file "modules/apache/metadata.json" should match /"version": "1\.4\.0"/
Scenario: Switching a module from forge to git
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'puppetlabs/postgresql', '7.4.1'
"""
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/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/
When I overwrite "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'puppetlabs/postgresql',
:git => 'https://github.com/puppetlabs/puppetlabs-postgresql.git', :ref => 'v7.5.0'
"""
And I run `librarian-puppet install`
Then the exit status should be 0
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/postgresql/.git/HEAD" should match /0a2cb69ccbbb0a55d42c5da33d44b0eaf33f9546/
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/
Scenario: Install a module with dependencies specified in metadata.json
Given a file named "Puppetfile" with:
"""
mod 'puppetlabs-apt', :git => 'https://github.com/puppetlabs/puppetlabs-apt.git', :ref => '1.5.2'
"""
When I successfully run `librarian-puppet install`
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/
And the file "modules/apt/metadata.json" should match /"name": "puppetlabs-apt"/
Scenario: Install a module with dependencies specified in a Puppetfile
Given a file named "Puppetfile" with:
"""
mod 'librarian/with_puppetfile', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/with_puppetfile'
"""
When I successfully run `librarian-puppet install`
And the file "modules/with_puppetfile/metadata.json" should match /"name": "librarian-with_puppetfile"/
And the file "modules/test/metadata.json" should match /"name": "librarian-test"/
Scenario: Install a module with dependencies specified in a Puppetfile and metadata.json
Given a file named "Puppetfile" with:
"""
mod 'librarian/with_puppetfile', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/with_puppetfile_and_metadata_json'
"""
When I successfully run `librarian-puppet install`
And the file "modules/with_puppetfile/metadata.json" should match /"name": "librarian-with_puppetfile_and_metadata_json"/
And the file "modules/test/metadata.json" should match /"name": "maestrodev-test"/
Scenario: Running install without metadata.json
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'
"""
When I successfully run `librarian-puppet install`
Scenario: Running install with metadata.json without dependencies
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'puppetlabs/sqlite', :git => 'https://github.com/puppetlabs/puppetlabs-sqlite.git', :ref => '84a0a6'
"""
When I successfully run `librarian-puppet install`
Scenario: Install a module using metadata syntax
Given a file named "Puppetfile" with:
"""
mod 'librarian/metadata_syntax', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/metadata_syntax'
"""
When I successfully run `librarian-puppet install`
And the file "modules/metadata_syntax/metadata.json" should match /"name": "librarian-metadata_syntax"/
And the file "modules/test/metadata.json" should match /"name": "maestrodev-test"/
Scenario: Install a module from git and using path
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'librarian-test', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/test'
"""
When I successfully run `librarian-puppet install`
And the file "modules/test/metadata.json" should match /"version": "0\.0\.1"/
And a file named "modules/stdlib/metadata.json" should exist
Scenario: Install a module from git without version
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppet.com"
mod 'test', :git => 'https://github.com/voxpupuli/librarian-puppet.git', :path => 'features/examples/dependency_without_version'
"""
When I successfully run `librarian-puppet install`
And the file "modules/test/metadata.json" should match /"version": "0\.0\.1"/
And a file named "modules/stdlib/metadata.json" should exist
Scenario: Install from Puppetfile with duplicated entries
Given a file named "Puppetfile" with:
"""
mod 'puppetlabs-stdlib',
:git => 'git://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => 'main'
mod 'puppetlabs-stdlib',
:git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => 'main'
"""
When I successfully run `librarian-puppet install`
And the output should contain "Dependency 'puppetlabs-stdlib' duplicated for module, merging"
Scenario: Installing a module from git with the --strip-dot-git flag
Given a file named "Puppetfile" with:
"""
mod 'puppetlabs-stdlib',
:git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git',
:ref => 'main'
"""
When I successfully run `librarian-puppet install --strip-dot-git` for up to 60 seconds
And a directory named "modules/stdlib/.git" should not exist
|