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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
|
Feature: cli/update
Puppet librarian needs to update modules properly
Scenario: Updating a module with no Puppetfile and with metadata.json
Given a file named "metadata.json" with:
"""
{
"name": "random name",
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": "3.1.x"
}
]
}
"""
And a file named "Puppetfile.lock" with:
"""
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
puppetlabs/stdlib (3.1.0)
DEPENDENCIES
puppetlabs/stdlib (~> 3.0)
"""
When I successfully run `librarian-puppet update puppetlabs/stdlib`
And the file "Puppetfile" should not exist
And the file "Puppetfile.lock" should match /puppetlabs.stdlib \(3\.1\.1\)/
And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/
And the file "modules/stdlib/Modulefile" should match /version *'3\.1\.1'/
Scenario: Updating a module
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppetlabs.com"
mod 'puppetlabs/stdlib', '3.1.x'
"""
And a file named "Puppetfile.lock" with:
"""
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
puppetlabs/stdlib (3.1.0)
DEPENDENCIES
puppetlabs/stdlib (~> 3.0)
"""
When I successfully run `librarian-puppet update puppetlabs-stdlib`
And the file "Puppetfile.lock" should match /puppetlabs.stdlib \(3\.1\.1\)/
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/
And the file "modules/stdlib/Modulefile" should match /version *'3\.1\.1'/
Scenario: Updating a module using organization/module
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppetlabs.com"
mod 'puppetlabs/stdlib', '3.1.x'
"""
And a file named "Puppetfile.lock" with:
"""
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
puppetlabs/stdlib (3.1.0)
DEPENDENCIES
puppetlabs/stdlib (~> 3.0)
"""
When I successfully run `librarian-puppet update --verbose puppetlabs/stdlib`
And the file "Puppetfile.lock" should match /puppetlabs.stdlib \(3\.1\.1\)/
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/
And the file "modules/stdlib/Modulefile" should match /version *'3\.1\.1'/
Scenario: Updating a module from git with a branch ref
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppetlabs.com"
mod "theforeman-dns",
:git => "https://github.com/theforeman/puppet-dns.git", :ref => "4.1-stable"
"""
And a file named "Puppetfile.lock" with:
"""
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
puppetlabs-concat (2.2.1)
puppetlabs-stdlib (>= 4.2.0, < 5.0.0)
puppetlabs-stdlib (4.25.1)
GIT
remote: https://github.com/theforeman/puppet-dns.git
ref: 4.1-stable
sha: 29150008f81c0be6de4d8913f60b9e014c3f398e
specs:
theforeman-dns (4.1.0)
puppetlabs-concat (>= 1.0.0, < 3.0.0)
puppetlabs-stdlib (>= 4.13.1, < 5.0.0)
DEPENDENCIES
theforeman-dns (>= 0)
"""
When I successfully run `librarian-puppet install`
And the git revision of module "dns" should be "29150008f81c0be6de4d8913f60b9e014c3f398e"
When I successfully run `librarian-puppet update`
And the git revision of module "dns" should be "e530ae8b1f0d85b37a69e779d1de51d054ecc9f1"
Scenario: Updating a module with invalid versions in git
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppetlabs.com"
mod "apache",
:git => "https://github.com/puppetlabs/puppetlabs-apache.git", :ref => "0.5.0-rc1"
"""
And a file named "Puppetfile.lock" with:
"""
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
puppetlabs/firewall (0.0.4)
puppetlabs/stdlib (3.2.0)
GIT
remote: https://github.com/puppetlabs/puppetlabs-apache.git
ref: 0.5.0-rc1
sha: 94ebca3aaaf2144a7b9ce7ca6a13837ec48a7e2a
specs:
apache ()
puppetlabs/firewall (>= 0.0.4)
puppetlabs/stdlib (>= 2.2.1)
DEPENDENCIES
apache (>= 0)
"""
When I successfully run `librarian-puppet update apache`
And the file "Puppetfile.lock" should match /sha: d81999533af54a6fe510575d3b143308184a5005/
And the file "modules/apache/Modulefile" should match /name *'puppetlabs-apache'/
And the file "modules/apache/Modulefile" should match /version *'0\.5\.0-rc1'/
Scenario: Updating a module that is not in the Puppetfile
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppetlabs.com"
mod 'puppetlabs/stdlib', '3.1.x'
"""
And a file named "Puppetfile.lock" with:
"""
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
puppetlabs/stdlib (3.1.0)
DEPENDENCIES
puppetlabs/stdlib (~> 3.0)
"""
When I run `librarian-puppet update stdlib`
Then the exit status should be 1
And the output should contain "Unable to find module stdlib"
Scenario: Updating a module to a .10 release to ensure versions are correctly ordered
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppetlabs.com"
mod 'maestrodev/test'
"""
And a file named "Puppetfile.lock" with:
"""
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
maestrodev/test (1.0.2)
DEPENDENCIES
maestrodev/test (>= 0)
"""
When I successfully run `librarian-puppet update --verbose`
And the file "Puppetfile.lock" should match /maestrodev.test \(1\.0\.[1-9][0-9]\)/
And the file "modules/test/Modulefile" should contain "name 'maestrodev-test'"
And the file "modules/test/Modulefile" should match /version '1\.0\.[1-9][0-9]'/
Scenario: Updating a forge module with the rsync configuration
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppetlabs.com"
mod 'maestrodev/test'
"""
And a file named "Puppetfile.lock" with:
"""
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
maestrodev/test (1.0.2)
DEPENDENCIES
maestrodev/test (>= 0)
"""
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 update --verbose`
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 update --verbose`
And a directory named "modules/test" should exist
And the file "modules/test" should have the same inode and ctime as before
Scenario: Updating a git module with the rsync configuration
Given a file named "Puppetfile" with:
"""
forge "https://forgeapi.puppetlabs.com"
mod "theforeman-dns",
:git => "https://github.com/theforeman/puppet-dns.git", :ref => "4.1-stable"
"""
And a file named "Puppetfile.lock" with:
"""
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
puppetlabs-concat (2.2.1)
puppetlabs-stdlib (>= 4.2.0, < 5.0.0)
puppetlabs-stdlib (4.25.1)
GIT
remote: https://github.com/theforeman/puppet-dns.git
ref: 4.1-stable
sha: 29150008f81c0be6de4d8913f60b9e014c3f398e
specs:
theforeman-dns (4.1.0)
puppetlabs-concat (>= 1.0.0, < 3.0.0)
puppetlabs-stdlib (>= 4.13.1, < 5.0.0)
DEPENDENCIES
theforeman-dns (>= 0)
"""
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 the file "Puppetfile.lock" should contain "29150008f81c0be6de4d8913f60b9e014c3f398e"
And the git revision of module "dns" should be "29150008f81c0be6de4d8913f60b9e014c3f398e"
And a directory named "modules/dns" should exist
When I successfully run `librarian-puppet update --verbose`
And a directory named "modules/dns" should exist
And the file "modules/dns" should have an inode and ctime
And the file "Puppetfile.lock" should contain "e530ae8b1f0d85b37a69e779d1de51d054ecc9f1"
And the git revision of module "dns" should be "e530ae8b1f0d85b37a69e779d1de51d054ecc9f1"
When I successfully run `librarian-puppet update --verbose`
And a directory named "modules/dns" should exist
And the file "modules/dns" should have the same inode and ctime as before
And the file "Puppetfile.lock" should contain "e530ae8b1f0d85b37a69e779d1de51d054ecc9f1"
And the git revision of module "dns" should be "e530ae8b1f0d85b37a69e779d1de51d054ecc9f1"
|