Permalink
Browse files

Don't install when uploading

This commit fixes #1037 by removing the Berksfile#install procedure
from the Berksfile#upload method. Instead, the uploader now relies
entirely on the lockfile and universe to upload dependencies.

The airity of Berksfile#upload is now changed to accept the list of
cookbook names as strings, or an options hash, or both.
  • Loading branch information...
1 parent 38ef8df commit 506da0ee3707b2c287b21c86f4e964b448a74cdf @sethvargo sethvargo committed Mar 4, 2014
@@ -1,6 +1,5 @@
Feature: berks upload
Background:
- * the Berkshelf API server's cache is empty
* the Chef Server is empty
* the cookbook store has the cookbooks:
| fake | 1.0.0 |
@@ -13,6 +12,16 @@ Feature: berks upload
cookbook 'fake', '1.0.0'
cookbook 'ekaf', '2.0.0'
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ fake (= 1.0.0)
+ ekaf (= 2.0.0)
+
+ GRAPH
+ fake (1.0.0)
+ ekaf (2.0.0)
+ """
When I successfully run `berks upload`
Then the Chef Server should have the cookbooks:
| fake | 1.0.0 |
@@ -24,6 +33,15 @@ Feature: berks upload
"""
cookbook 'fake', path: './fake'
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ fake
+ path: ./fake
+
+ GRAPH
+ fake (0.0.0)
+ """
When I successfully run `berks upload`
Then the Chef Server should have the cookbooks:
| fake | 0.0.0 |
@@ -33,10 +51,23 @@ Feature: berks upload
| fake | = 1.0.0 |
And I have a Berksfile pointing at the local Berkshelf API with:
"""
- cookbook 'fake', '1.0.0'
- cookbook 'ekaf', '2.0.0'
+ cookbook 'fake', '1.0.0'
+ cookbook 'ekaf', '2.0.0'
cookbook 'reset', '3.4.5'
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ ekaf (= 2.0.0)
+ fake (= 1.0.0)
+ reset (= 3.4.5)
+
+ GRAPH
+ ekaf (2.0.0)
+ fake (1.0.0)
+ reset (3.4.5)
+ fake (= 1.0.0)
+ """
When I successfully run `berks upload reset`
Then the Chef Server should have the cookbooks:
| reset | 3.4.5 |
@@ -46,6 +77,14 @@ Feature: berks upload
Scenario: specifying a dependency not defined in the Berksfile
Given I have a Berksfile pointing at the local Berkshelf API
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ fake (= 1.0.0)
+
+ GRAPH
+ fake (1.0.0)
+ """
When I run `berks upload reset`
Then the output should contain:
"""
@@ -60,19 +99,69 @@ Feature: berks upload
cookbook 'ekaf', '2.0.0'
cookbook 'oops', '3.0.0'
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ ekaf (= 2.0.0)
+ fake (= 1.0.0)
+ oops (= 3.0.0)
+
+ GRAPH
+ ekaf (2.0.0)
+ fake (1.0.0)
+ oops (3.0.0)
+ """
When I successfully run `berks upload fake ekaf`
Then the Chef Server should have the cookbooks:
| fake |
| ekaf |
And the Chef Server should not have the cookbooks:
| oops |
+ Scenario: uploading a filter does not change the lockfile
+ Given I have a Berksfile pointing at the local Berkshelf API with:
+ """
+ cookbook 'fake', group: :take_me
+ cookbook 'ekaf', group: :not_me
+ """
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ ekaf
+ fake
+
+ GRAPH
+ ekaf (2.0.0)
+ fake (1.0.0)
+ """
+ When I run `berks upload --only take_me`
+ Then the file "Berksfile.lock" should contain:
+ """
+ DEPENDENCIES
+ ekaf
+ fake
+
+ GRAPH
+ ekaf (2.0.0)
+ fake (1.0.0)
+ """
+
Scenario: uploading a single groups of demands with the --only flag
Given I have a Berksfile pointing at the local Berkshelf API with:
"""
cookbook 'fake', group: :take_me
cookbook 'ekaf', group: :not_me
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ ekaf
+ fake
+
+ GRAPH
+ ekaf (2.0.0)
+ fake (1.0.0)
+ """
When I successfully run `berks upload --only take_me`
Then the Chef Server should have the cookbooks:
| fake | 1.0.0 |
@@ -85,6 +174,16 @@ Feature: berks upload
cookbook 'fake', group: :take_me
cookbook 'ekaf', group: :not_me
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ ekaf
+ fake
+
+ GRAPH
+ ekaf (2.0.0)
+ fake (1.0.0)
+ """
When I successfully run `berks upload --only take_me not_me`
And the Chef Server should have the cookbooks:
| fake | 1.0.0 |
@@ -96,6 +195,16 @@ Feature: berks upload
cookbook 'fake', group: :take_me
cookbook 'ekaf', group: :not_me
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ ekaf
+ fake
+
+ GRAPH
+ ekaf (2.0.0)
+ fake (1.0.0)
+ """
When I successfully run `berks upload --except not_me`
And the Chef Server should have the cookbooks:
| fake | 1.0.0 |
@@ -108,6 +217,16 @@ Feature: berks upload
cookbook 'fake', group: :take_me
cookbook 'ekaf', group: :not_me
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ ekaf
+ fake
+
+ GRAPH
+ ekaf (2.0.0)
+ fake (1.0.0)
+ """
When I successfully run `berks upload --except take_me not_me`
And the Chef Server should not have the cookbooks:
| fake | 1.0.0 |
@@ -119,6 +238,15 @@ Feature: berks upload
"""
cookbook 'cookbook with spaces', path: './cookbook with spaces'
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ cookbook with spaces
+ path: ./cookbook with spaces
+
+ GRAPH
+ cookbook with spaces (0.0.0)
+ """
When I run `berks upload`
Then the output should contain:
"""
@@ -140,6 +268,16 @@ Feature: berks upload
"""
metadata
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ fake
+ path: .
+ metadata: true
+
+ GRAPH
+ fake (0.0.0)
+ """
When I successfully run `berks upload fake`
Then the output should contain:
"""
@@ -153,6 +291,14 @@ Feature: berks upload
"""
cookbook 'fake', '1.0.0'
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ fake (= 1.0.0)
+
+ GRAPH
+ fake (1.0.0)
+ """
When I successfully run `berks upload`
Then the output should contain:
"""
@@ -169,12 +315,21 @@ Feature: berks upload
Given a cookbook named "fake"
And the cookbook "fake" has the file "Berksfile" with:
"""
- source 'https://api.berkshelf.com'
metadata
"""
- And the Chef Server has frozen cookbooks:
- | fake | 0.0.0 |
And I cd to "fake"
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ fake
+ path: .
+ metadata: true
+
+ GRAPH
+ fake (0.0.0)
+ """
+ And the Chef Server has frozen cookbooks:
+ | fake | 0.0.0 |
When I successfully run `berks upload`
Then the output should contain:
"""
@@ -205,6 +360,16 @@ Feature: berks upload
source 'https://api.berkshelf.com'
metadata
"""
+ And the cookbook "fake" has the file "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ fake
+ path: .
+ metadata: true
+
+ GRAPH
+ fake (0.0.0)
+ """
And I cd to "fake"
When I successfully run `berks upload --skip-syntax-check`
Then the Chef Server should have the cookbooks:
@@ -97,6 +97,15 @@ Feature: --format json
"""
cookbook 'example_cookbook', path: '../../fixtures/cookbooks/example_cookbook-0.5.0'
"""
+ And I write to "Berksfile.lock" with:
+ """
+ DEPENDENCIES
+ example_cookbook
+ path: ../../fixtures/cookbooks/example_cookbook-0.5.0
+
+ GRAPH
+ example_cookbook (0.5.0)
+ """
When I successfully run `berks upload --format json`
Then the output should contain JSON:
"""
@@ -105,14 +114,11 @@ Feature: --format json
{
"name": "example_cookbook",
"version": "0.5.0",
- "location": "../../fixtures/cookbooks/example_cookbook-0.5.0",
"uploaded_to": "http://localhost:26310/"
}
],
"errors": [],
- "messages": [
- "Fetching cookbook index from http://0.0.0.0:26210..."
- ],
+ "messages": [],
"warnings": []
}
"""
Oops, something went wrong.

0 comments on commit 506da0e

Please sign in to comment.