Closed bvis closed 9 years ago
thanks for the detailed report, can you create a test case in https://github.com/rodjek/librarian-puppet/blob/master/features/install/forge.feature? it should be easy with the examples already there
I can add these test cases:
@other-forge
Scenario: Installing a module from another forge
Given a file named "Puppetfile" with:
"""
forge "http://172.20.0.238"
mod 'tester/tester'
"""
When I run `librarian-puppet install`
Then the exit status should be 0
And the file "modules/tester/metadata.json" should match /"name": "tester-tester"/
And the file "modules/tester_dependency1/metadata.json" should match /"name": "tester-tester_dependency1"/
@other-forge
Scenario: Installing a module from another forge with local reference
Given a file named "Puppetfile" with:
"""
forge "http://172.20.0.238"
mod 'tester/tester',
:path => './tester-tester'
"""
And a file named "tester-tester/metadata.json" with:
"""
{
"name": "tester-tester",
"version": "0.1.0",
"author": "Basilio Vera",
"summary": "Just our own test",
"license": "MIT",
"dependencies": [
{ "name": "puppetlabs/inifile" },
{ "name": "tester/tester_dependency1" }
]
}
"""
When I run `librarian-puppet install`
Then the exit status should be 0
And the file "modules/tester/metadata.json" should match /"name": "tester-tester"/
And the file "modules/tester_dependency1/metadata.json" should match /"name": "tester-tester_dependency1"/
I already have tried them with the expected result:
$ cucumber --tag @other-forge
Feature: cli/install/forge
Puppet librarian needs to install modules from the Puppet Forge
@other-forge
Scenario: Installing a module from another forge # features/install/forge.feature:254
Given a file named "Puppetfile" with: # aruba-0.6.1/lib/aruba/cucumber.rb:29
"""
forge "http://172.20.0.238"
mod 'tester/tester'
"""
When I run `librarian-puppet install` # aruba-0.6.1/lib/aruba/cucumber.rb:93
Then the exit status should be 0 # aruba-0.6.1/lib/aruba/cucumber.rb:197
And the file "modules/tester/metadata.json" should match /"name": "tester-tester"/ # aruba-0.6.1/lib/aruba/cucumber.rb:359
And the file "modules/tester_dependency1/metadata.json" should match /"name": "tester-tester_dependency1"/ # aruba-0.6.1/lib/aruba/cucumber.rb:359
@other-forge
Scenario: Installing a module from another forge with local reference # features/install/forge.feature:267
Given a file named "Puppetfile" with: # aruba-0.6.1/lib/aruba/cucumber.rb:29
"""
forge "http://172.20.0.238"
mod 'tester/tester',
:path => './tester-tester'
"""
And a file named "tester-tester/metadata.json" with: # aruba-0.6.1/lib/aruba/cucumber.rb:29
"""
{
"name": "tester-tester",
"version": "0.1.0",
"author": "Basilio Vera",
"summary": "Just our own test",
"license": "MIT",
"dependencies": [
{ "name": "puppetlabs/inifile" },
{ "name": "tester/tester_dependency1" }
]
}
"""
When I run `librarian-puppet install` # aruba-0.6.1/lib/aruba/cucumber.rb:93
Then the exit status should be 0 # aruba-0.6.1/lib/aruba/cucumber.rb:197
Exit status was 1 but expected it to be 0. Output:
Unable to find module 'tester-tester_dependency1' on https://forgeapi.puppetlabs.com
(RSpec::Expectations::ExpectationNotMetError)
features/install/forge.feature:291:in `Then the exit status should be 0'
And the file "modules/tester/metadata.json" should match /"name": "tester-tester"/ # aruba-0.6.1/lib/aruba/cucumber.rb:359
And the file "modules/tester_dependency1/metadata.json" should match /"name": "tester-tester_dependency1"/ # aruba-0.6.1/lib/aruba/cucumber.rb:359
Failing Scenarios:
cucumber features/install/forge.feature:267 # Scenario: Installing a module from another forge with local reference
2 scenarios (1 failed, 1 passed)
11 steps (1 failed, 2 skipped, 8 passed)
0m30.776s
But this means that you need a forge proxy configured at this IP with this modules inside. I did it following these easy steps:
mkdir modules
gem install puppet-forge-server
puppet-forge-server -m modules/ -x https://forgeapi.puppetlabs.com --port 80 --bind-host 0.0.0.0
But this makes these tests to not to be portable, at least if you do not create this server under a public and widely accessible IP. How would you like to proceed?
One possible option would be to remove the first test and check that the error obtained in the second test is related with the non existing "local" forge instead of the _Unable to find module 'tester-testerdependency1' on https://forgeapi.puppetlabs.com
Could try just checking the librarian-puppet install --verbose
output, it shouldn't include forgeapi.puppetlabs.com even if the command fails.
There are testing modules already in git
As you may see I've created a pull request with your suggestion.
I found how to reproduce the bug. This is detected when you are using a Puppet forge mirror, because there you'll have your own modules and a mirror of the original Puppet forge.
How to reproduce
Create two puppet modules with a simple structure
metadata.json [tester/tester]
metadata.json [tester/tester_dependency1]
Upload them to your Forge, in this case named puppet-library.redtonic
Create a Puppetfile
Execute the install
It works correctly!
Try the same with local/git paths
Re-install the packages using the local reference (the same happens when using ":git" references)
Install again with local reference with a clean installation.