| 1 |
Feature: cli/update |
| 2 |
Puppet librarian needs to update modules properly |
| 3 |
|
| 4 |
Scenario: Updating a module with no Puppetfile and with metadata.json |
| 5 |
Given a file named "metadata.json" with: |
| 6 |
""" |
| 7 |
{ |
| 8 |
"name": "random name", |
| 9 |
"dependencies": [ |
| 10 |
{ |
| 11 |
"name": "puppetlabs/stdlib", |
| 12 |
"version_requirement": "3.1.x" |
| 13 |
} |
| 14 |
] |
| 15 |
} |
| 16 |
""" |
| 17 |
And a file named "Puppetfile.lock" with: |
| 18 |
""" |
| 19 |
FORGE |
| 20 |
remote: https://forgeapi.puppet.com |
| 21 |
specs: |
| 22 |
puppetlabs/stdlib (3.1.0) |
| 23 |
|
| 24 |
DEPENDENCIES |
| 25 |
puppetlabs/stdlib (~> 3.0) |
| 26 |
""" |
| 27 |
When I successfully run `librarian-puppet update puppetlabs/stdlib` |
| 28 |
And the file "Puppetfile" should not exist |
| 29 |
And the file "Puppetfile.lock" should match /puppetlabs.stdlib \(3\.1\.1\)/ |
| 30 |
And the file "modules/stdlib/Modulefile" should match /name *'puppetlabs-stdlib'/ |
| 31 |
And the file "modules/stdlib/Modulefile" should match /version *'3\.1\.1'/ |
| 32 |
|
| 33 |
Scenario: Updating a module |
| 34 |
Given a file named "Puppetfile" with: |
| 35 |
""" |
| 36 |
forge "https://forgeapi.puppet.com" |
| 37 |
|
| 38 |
mod 'puppetlabs/stdlib', '3.1.x' |
| 39 |
""" |
| 40 |
And a file named "Puppetfile.lock" with: |
| 41 |
""" |
| 42 |
FORGE |
| 43 |
remote: https://forgeapi.puppet.com |
| 44 |
specs: |
| 45 |
puppetlabs/stdlib (3.1.0) |
| 46 |
|
| 47 |
DEPENDENCIES |
| 48 |
puppetlabs/stdlib (~> 3.0) |
| 49 |
""" |
| 50 |
When I successfully run `librarian-puppet update puppetlabs-stdlib` |
| 51 |
And the file "Puppetfile.lock" should match /puppetlabs.stdlib \(3\.1\.1\)/ |
| 52 |
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/ |
| 53 |
And the file "modules/stdlib/Modulefile" should match /version *'3\.1\.1'/ |
| 54 |
|
| 55 |
Scenario: Updating a module using organization/module |
| 56 |
Given a file named "Puppetfile" with: |
| 57 |
""" |
| 58 |
forge "https://forgeapi.puppet.com" |
| 59 |
|
| 60 |
mod 'puppetlabs/stdlib', '3.1.x' |
| 61 |
""" |
| 62 |
And a file named "Puppetfile.lock" with: |
| 63 |
""" |
| 64 |
FORGE |
| 65 |
remote: https://forgeapi.puppet.com |
| 66 |
specs: |
| 67 |
puppetlabs/stdlib (3.1.0) |
| 68 |
|
| 69 |
DEPENDENCIES |
| 70 |
puppetlabs/stdlib (~> 3.0) |
| 71 |
""" |
| 72 |
When I successfully run `librarian-puppet update --verbose puppetlabs/stdlib` |
| 73 |
And the file "Puppetfile.lock" should match /puppetlabs.stdlib \(3\.1\.1\)/ |
| 74 |
And the file "modules/stdlib/metadata.json" should match /"name": "puppetlabs-stdlib"/ |
| 75 |
And the file "modules/stdlib/Modulefile" should match /version *'3\.1\.1'/ |
| 76 |
|
| 77 |
Scenario: Updating a module from git with a branch ref |
| 78 |
Given a file named "Puppetfile" with: |
| 79 |
""" |
| 80 |
forge "https://forgeapi.puppet.com" |
| 81 |
|
| 82 |
mod "theforeman-dns", |
| 83 |
:git => "https://github.com/theforeman/puppet-dns.git", :ref => "4.1-stable" |
| 84 |
""" |
| 85 |
And a file named "Puppetfile.lock" with: |
| 86 |
""" |
| 87 |
FORGE |
| 88 |
remote: https://forgeapi.puppet.com |
| 89 |
specs: |
| 90 |
puppetlabs-concat (2.2.1) |
| 91 |
puppetlabs-stdlib (>= 4.2.0, < 5.0.0) |
| 92 |
puppetlabs-stdlib (4.25.1) |
| 93 |
|
| 94 |
GIT |
| 95 |
remote: https://github.com/theforeman/puppet-dns.git |
| 96 |
ref: 4.1-stable |
| 97 |
sha: 29150008f81c0be6de4d8913f60b9e014c3f398e |
| 98 |
specs: |
| 99 |
theforeman-dns (4.1.0) |
| 100 |
puppetlabs-concat (>= 1.0.0, < 3.0.0) |
| 101 |
puppetlabs-stdlib (>= 4.13.1, < 5.0.0) |
| 102 |
|
| 103 |
DEPENDENCIES |
| 104 |
theforeman-dns (>= 0) |
| 105 |
""" |
| 106 |
When I successfully run `librarian-puppet install` |
| 107 |
And the git revision of module "dns" should be "29150008f81c0be6de4d8913f60b9e014c3f398e" |
| 108 |
When I successfully run `librarian-puppet update` |
| 109 |
And the git revision of module "dns" should be "e530ae8b1f0d85b37a69e779d1de51d054ecc9f1" |
| 110 |
|
| 111 |
Scenario: Updating a module with invalid versions in git |
| 112 |
Given a file named "Puppetfile" with: |
| 113 |
""" |
| 114 |
forge "https://forgeapi.puppet.com" |
| 115 |
|
| 116 |
mod "apache", |
| 117 |
:git => "https://github.com/puppetlabs/puppetlabs-apache.git", :ref => "0.5.0-rc1" |
| 118 |
""" |
| 119 |
And a file named "Puppetfile.lock" with: |
| 120 |
""" |
| 121 |
FORGE |
| 122 |
remote: https://forgeapi.puppet.com |
| 123 |
specs: |
| 124 |
puppetlabs/firewall (0.0.4) |
| 125 |
puppetlabs/stdlib (3.2.0) |
| 126 |
|
| 127 |
GIT |
| 128 |
remote: https://github.com/puppetlabs/puppetlabs-apache.git |
| 129 |
ref: 0.5.0-rc1 |
| 130 |
sha: 94ebca3aaaf2144a7b9ce7ca6a13837ec48a7e2a |
| 131 |
specs: |
| 132 |
apache () |
| 133 |
puppetlabs/firewall (>= 0.0.4) |
| 134 |
puppetlabs/stdlib (>= 2.2.1) |
| 135 |
|
| 136 |
DEPENDENCIES |
| 137 |
apache (>= 0) |
| 138 |
""" |
| 139 |
When I successfully run `librarian-puppet update apache` |
| 140 |
And the file "Puppetfile.lock" should match /sha: d81999533af54a6fe510575d3b143308184a5005/ |
| 141 |
And the file "modules/apache/Modulefile" should match /name *'puppetlabs-apache'/ |
| 142 |
And the file "modules/apache/Modulefile" should match /version *'0\.5\.0-rc1'/ |
| 143 |
|
| 144 |
Scenario: Updating a module that is not in the Puppetfile |
| 145 |
Given a file named "Puppetfile" with: |
| 146 |
""" |
| 147 |
forge "https://forgeapi.puppet.com" |
| 148 |
|
| 149 |
mod 'puppetlabs/stdlib', '3.1.x' |
| 150 |
""" |
| 151 |
And a file named "Puppetfile.lock" with: |
| 152 |
""" |
| 153 |
FORGE |
| 154 |
remote: https://forgeapi.puppet.com |
| 155 |
specs: |
| 156 |
puppetlabs/stdlib (3.1.0) |
| 157 |
|
| 158 |
DEPENDENCIES |
| 159 |
puppetlabs/stdlib (~> 3.0) |
| 160 |
""" |
| 161 |
When I run `librarian-puppet update stdlib` |
| 162 |
Then the exit status should be 1 |
| 163 |
And the output should contain "Unable to find module stdlib" |
| 164 |
|
| 165 |
Scenario: Updating a module to a .10 release to ensure versions are correctly ordered |
| 166 |
Given a file named "Puppetfile" with: |
| 167 |
""" |
| 168 |
forge "https://forgeapi.puppet.com" |
| 169 |
|
| 170 |
mod 'maestrodev/test' |
| 171 |
""" |
| 172 |
And a file named "Puppetfile.lock" with: |
| 173 |
""" |
| 174 |
FORGE |
| 175 |
remote: https://forgeapi.puppet.com |
| 176 |
specs: |
| 177 |
maestrodev/test (1.0.2) |
| 178 |
|
| 179 |
DEPENDENCIES |
| 180 |
maestrodev/test (>= 0) |
| 181 |
""" |
| 182 |
When I successfully run `librarian-puppet update --verbose` |
| 183 |
And the file "Puppetfile.lock" should match /maestrodev.test \(1\.0\.[1-9][0-9]\)/ |
| 184 |
And the file "modules/test/Modulefile" should contain "name 'maestrodev-test'" |
| 185 |
And the file "modules/test/Modulefile" should match /version '1\.0\.[1-9][0-9]'/ |
| 186 |
|
| 187 |
Scenario: Updating a forge module with the rsync configuration |
| 188 |
Given a file named "Puppetfile" with: |
| 189 |
""" |
| 190 |
forge "https://forgeapi.puppet.com" |
| 191 |
|
| 192 |
mod 'maestrodev/test' |
| 193 |
""" |
| 194 |
And a file named "Puppetfile.lock" with: |
| 195 |
""" |
| 196 |
FORGE |
| 197 |
remote: https://forgeapi.puppet.com |
| 198 |
specs: |
| 199 |
maestrodev/test (1.0.2) |
| 200 |
|
| 201 |
DEPENDENCIES |
| 202 |
maestrodev/test (>= 0) |
| 203 |
""" |
| 204 |
And a file named ".librarian/puppet/config" with: |
| 205 |
""" |
| 206 |
--- |
| 207 |
LIBRARIAN_PUPPET_RSYNC: 'true' |
| 208 |
""" |
| 209 |
When I successfully run `librarian-puppet config` |
| 210 |
And the output should contain "rsync: true" |
| 211 |
When I successfully run `librarian-puppet update --verbose` |
| 212 |
And a directory named "modules/test" should exist |
| 213 |
And the file "modules/test" should have an inode and ctime |
| 214 |
When I successfully run `librarian-puppet update --verbose` |
| 215 |
And a directory named "modules/test" should exist |
| 216 |
And the file "modules/test" should have the same inode and ctime as before |
| 217 |
|
| 218 |
Scenario: Updating a git module with the rsync configuration |
| 219 |
Given a file named "Puppetfile" with: |
| 220 |
""" |
| 221 |
forge "https://forgeapi.puppet.com" |
| 222 |
|
| 223 |
mod "theforeman-dns", |
| 224 |
:git => "https://github.com/theforeman/puppet-dns.git", :ref => "4.1-stable" |
| 225 |
""" |
| 226 |
And a file named "Puppetfile.lock" with: |
| 227 |
""" |
| 228 |
FORGE |
| 229 |
remote: https://forgeapi.puppet.com |
| 230 |
specs: |
| 231 |
puppetlabs-concat (2.2.1) |
| 232 |
puppetlabs-stdlib (>= 4.2.0, < 5.0.0) |
| 233 |
puppetlabs-stdlib (4.25.1) |
| 234 |
|
| 235 |
GIT |
| 236 |
remote: https://github.com/theforeman/puppet-dns.git |
| 237 |
ref: 4.1-stable |
| 238 |
sha: 29150008f81c0be6de4d8913f60b9e014c3f398e |
| 239 |
specs: |
| 240 |
theforeman-dns (4.1.0) |
| 241 |
puppetlabs-concat (>= 1.0.0, < 3.0.0) |
| 242 |
puppetlabs-stdlib (>= 4.13.1, < 5.0.0) |
| 243 |
|
| 244 |
DEPENDENCIES |
| 245 |
theforeman-dns (>= 0) |
| 246 |
""" |
| 247 |
And a file named ".librarian/puppet/config" with: |
| 248 |
""" |
| 249 |
--- |
| 250 |
LIBRARIAN_PUPPET_RSYNC: 'true' |
| 251 |
""" |
| 252 |
When I successfully run `librarian-puppet config` |
| 253 |
And the output should contain "rsync: true" |
| 254 |
When I successfully run `librarian-puppet install` |
| 255 |
And the file "Puppetfile.lock" should contain "29150008f81c0be6de4d8913f60b9e014c3f398e" |
| 256 |
And the git revision of module "dns" should be "29150008f81c0be6de4d8913f60b9e014c3f398e" |
| 257 |
And a directory named "modules/dns" should exist |
| 258 |
When I successfully run `librarian-puppet update --verbose` |
| 259 |
And a directory named "modules/dns" should exist |
| 260 |
And the file "modules/dns" should have an inode and ctime |
| 261 |
And the file "Puppetfile.lock" should contain "e530ae8b1f0d85b37a69e779d1de51d054ecc9f1" |
| 262 |
And the git revision of module "dns" should be "e530ae8b1f0d85b37a69e779d1de51d054ecc9f1" |
| 263 |
When I successfully run `librarian-puppet update --verbose` |
| 264 |
And a directory named "modules/dns" should exist |
| 265 |
And the file "modules/dns" should have the same inode and ctime as before |
| 266 |
And the file "Puppetfile.lock" should contain "e530ae8b1f0d85b37a69e779d1de51d054ecc9f1" |
| 267 |
And the git revision of module "dns" should be "e530ae8b1f0d85b37a69e779d1de51d054ecc9f1" |