features/install_command.feature in berkshelf-1.4.6 vs features/install_command.feature in berkshelf-2.0.0.beta
- old
+ new
@@ -1,77 +1,92 @@
Feature: install cookbooks from a Berksfile
As a user with a Berksfile
I want to be able to run knife berkshelf install to install my cookbooks
So that I don't have to download my cookbooks and their dependencies manually
+ Scenario: installing with the old lockfile format
+ Given I write to "Berksfile" with:
+ """
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0'
+ """
+ Given I write to "Berksfile.lock" with:
+ """
+ cookbook 'berkshelf-cookbook-fixture', :locked_version => '1.0.0'
+ """
+ When I successfully run `berks install`
+ Then the output should contain "You are using the old lockfile format. Attempting to convert..."
+ Then the file "Berksfile.lock" should contain JSON:
+ """
+ {
+ "sha":"bfb1de046fdc2a0c38cd5bbaddddce8bc1cd3c24",
+ "sources":{
+ "berkshelf-cookbook-fixture":{
+ "locked_version":"1.0.0",
+ "constraint":"= 1.0.0"
+ }
+ }
+ }
+ """
+
Scenario: installing a Berksfile that contains a source with a default location
Given I write to "Berksfile" with:
"""
- cookbook "mysql", "1.2.4"
- cookbook "openssl", "1.0.0"
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0'
"""
When I successfully run `berks install`
Then the cookbook store should have the cookbooks:
- | mysql | 1.2.4 |
- | openssl | 1.0.0 |
+ | berkshelf-cookbook-fixture | 1.0.0 |
And the output should contain:
"""
- Installing mysql (1.2.4) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
- Installing openssl (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
+ Installing berkshelf-cookbook-fixture (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
"""
And the exit status should be 0
Scenario: installing a Berksfile that contains the cookbook explicitly desired by a source
Given the cookbook store has the cookbooks:
- | mysql | 1.2.4 |
+ | berkshelf-cookbook-fixture | 1.0.0 |
And I write to "Berksfile" with:
"""
- cookbook "mysql", "= 1.2.4"
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0'
"""
When I successfully run `berks install`
Then the output should contain:
"""
- Using mysql (1.2.4)
+ Using berkshelf-cookbook-fixture (1.0.0)
"""
And the exit status should be 0
Scenario: installing a Berksfile that has multiple cookbooks in different groups
Given the cookbook store has the cookbooks:
- | build-essential | 1.1.2 |
+ | berkshelf-cookbook-fixture | 1.0.0 |
And I write to "Berksfile" with:
"""
group :a do
- cookbook "build-essential", "1.1.2"
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0'
end
group :b do
- cookbook "build-essential", "1.1.2"
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0'
end
"""
When I successfully run `berks install`
- Then the output should contain "Using build-essential (1.1.2)"
+ Then the output should contain "Using berkshelf-cookbook-fixture (1.0.0)"
And the exit status should be 0
Scenario: installing a Berksfile that contains a source with dependencies, all of which already have been installed
- Given the cookbook store contains a cookbook "mysql" "1.2.4" with dependencies:
- | openssl | = 1.0.0 |
- | windows | = 1.3.0 |
- | chef_handler | = 1.0.6 |
+ Given the cookbook store contains a cookbook "berkshelf-cookbook-fixture" "1.0.0" with dependencies:
+ | hostsfile | = 1.0.1 |
And the cookbook store has the cookbooks:
- | openssl | 1.0.0 |
- | windows | 1.3.0 |
+ | hostsfile | 1.0.1 |
And I write to "Berksfile" with:
"""
- cookbook "mysql", "~> 1.2.0"
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'deps'
"""
When I successfully run `berks install`
Then the output should contain:
"""
- Using mysql (1.2.4)
- Using openssl (1.0.0)
- Using windows (1.3.0)
- Installing chef_handler (1.0.6) from site:
+ Using hostsfile (1.0.1)
"""
And the exit status should be 0
Scenario: installing a Berksfile that contains a path location
Given a Berksfile with path location sources to fixtures:
@@ -84,88 +99,87 @@
And the exit status should be 0
Scenario: installing a Berksfile that contains a Git location
Given I write to "Berksfile" with:
"""
- cookbook "artifact", git: "git://github.com/RiotGames/artifact-cookbook.git"
+ cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git"
"""
When I successfully run `berks install`
Then the cookbook store should have the git cookbooks:
- | artifact | 1.7.0 | master |
+ | berkshelf-cookbook-fixture | 1.0.0 | a97b9447cbd41a5fe58eee2026e48ccb503bd3bc |
And the output should contain:
"""
- Installing artifact (1.7.0) from git: 'git://github.com/RiotGames/artifact-cookbook.git' with branch: 'master'
+ Installing berkshelf-cookbook-fixture (1.0.0) from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'master'
"""
And the exit status should be 0
- Scenario: installing a Berksfile that contains a Git location with a ref
+ Scenario: installing a Berksfile that contains a Git location with a tag
Given I write to "Berksfile" with:
"""
- cookbook "artifact", git: "git://github.com/RiotGames/artifact-cookbook.git", ref: "0.9.8"
+ cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v0.2.0"
"""
When I successfully run `berks install`
Then the cookbook store should have the git cookbooks:
- | artifact | 0.9.8 | 0.9.8 |
+ | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
And the output should contain:
"""
- Installing artifact (0.9.8) from git: 'git://github.com/RiotGames/artifact-cookbook.git' with branch: '0.9.8'
+ Installing berkshelf-cookbook-fixture (0.2.0) from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v0.2.0'
"""
And the exit status should be 0
Scenario: installing a Berksfile that contains a GitHub location
Given I write to "Berksfile" with:
"""
- cookbook "artifact", github: "RiotGames/artifact-cookbook", ref: "0.9.8"
+ cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0"
"""
When I successfully run `berks install`
Then the cookbook store should have the git cookbooks:
- | artifact | 0.9.8 | 0.9.8 |
+ | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
And the output should contain:
"""
- Installing artifact (0.9.8) from github: 'RiotGames/artifact-cookbook' with branch: '0.9.8'
+ Installing berkshelf-cookbook-fixture (0.2.0) from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v0.2.0'
"""
And the exit status should be 0
Scenario: installing a Berksfile that contains a Github location and the default protocol
Given I write to "Berksfile" with:
"""
- cookbook "artifact", github: "RiotGames/artifact-cookbook", ref: "0.9.8"
+ cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0"
"""
When I successfully run `berks install`
Then the cookbook store should have the git cookbooks:
- | artifact | 0.9.8 | 0.9.8 |
+ | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
And the output should contain:
"""
- Installing artifact (0.9.8) from github: 'RiotGames/artifact-cookbook' with branch: '0.9.8' over protocol: 'git'
+ Installing berkshelf-cookbook-fixture (0.2.0) from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v0.2.0' over protocol: 'git'
"""
And the exit status should be 0
Scenario Outline: installing a Berksfile that contains a Github location and specific protocol
Given I write to "Berksfile" with:
"""
- cookbook "artifact", github: "RiotGames/artifact-cookbook", ref: "0.9.8", protocol: "<protocol>"
+ cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v1.0.0", protocol: "<protocol>"
"""
When I successfully run `berks install`
Then the cookbook store should have the git cookbooks:
- | artifact | 0.9.8 | 0.9.8 |
+ | berkshelf-cookbook-fixture | 1.0.0 | b4f968c9001ad8de30f564a2107fab9cfa91f771 |
And the output should contain:
"""
- Installing artifact (0.9.8) from github: 'RiotGames/artifact-cookbook' with branch: '0.9.8' over protocol: '<protocol>'
+ Installing berkshelf-cookbook-fixture (1.0.0) from github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v1.0.0' over protocol: '<protocol>'
"""
And the exit status should be 0
Examples:
| protocol |
- # GitHub over ssh requires push authorization. Nonpushers will
- # get a test failure here.
- # | ssh |
+ # | ssh | # GitHub over ssh requires push authorization. Nonpushers will get a test failure here.
+ | git |
| https |
Scenario: installing a Berksfile that contains a Github location and an unsupported protocol
Given I write to "Berksfile" with:
"""
- cookbook "artifact", github: "RiotGames/artifact-cookbook", ref: "0.9.8", protocol: "somethingabsurd"
+ cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0", protocol: "somethingabsurd"
"""
When I run `berks install`
Then the output should contain:
"""
'somethingabsurd' is not a supported Git protocol for the 'github' location key. Please use 'git' instead.
@@ -173,21 +187,18 @@
And the exit status should be 110
Scenario: installing a Berksfile that contains an explicit site location
Given I write to "Berksfile" with:
"""
- cookbook "mysql", "1.2.4", site: "http://cookbooks.opscode.com/api/v1/cookbooks"
- cookbook "openssl", "1.0.0", site: "http://cookbooks.opscode.com/api/v1/cookbooks"
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0', site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
"""
When I successfully run `berks install`
Then the cookbook store should have the cookbooks:
- | mysql | 1.2.4 |
- | openssl | 1.0.0 |
+ | berkshelf-cookbook-fixture | 1.0.0 |
And the output should contain:
"""
- Installing mysql (1.2.4) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
- Installing openssl (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
+ Installing berkshelf-cookbook-fixture (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
"""
And the exit status should be 0
Scenario: running install when current project is a cookbook and the 'metadata' is specified
Given a cookbook named "sparkle_motion"
@@ -214,11 +225,11 @@
And the CLI should exit with the status code for error "BerksfileNotFound"
Scenario: running install when the Cookbook is not found on the remote site
Given I write to "Berksfile" with:
"""
- cookbook "doesntexist"
+ cookbook 'doesntexist'
"""
And I run `berks install`
Then the output should contain:
"""
Cookbook 'doesntexist' not found in any of the default locations
@@ -226,11 +237,11 @@
And the CLI should exit with the status code for error "CookbookNotFound"
Scenario: installing a Berksfile that has a Git location source with an invalid Git URI
Given I write to "Berksfile" with:
"""
- cookbook "nginx", git: "/something/on/disk"
+ cookbook 'nginx', git: '/something/on/disk'
"""
When I run `berks install`
Then the output should contain:
"""
'/something/on/disk' is not a valid Git URI.
@@ -238,50 +249,56 @@
And the CLI should exit with the status code for error "InvalidGitURI"
Scenario: installing when there are sources with duplicate names defined in the same group
Given I write to "Berksfile" with:
"""
- cookbook "artifact"
- cookbook "artifact"
+ cookbook 'berkshelf-cookbook-fixture'
+ cookbook 'berkshelf-cookbook-fixture'
"""
When I run `berks install`
Then the output should contain:
"""
- Berksfile contains multiple sources named 'artifact'. Use only one, or put them in different groups.
+ Berksfile contains multiple sources named 'berkshelf-cookbook-fixture'. Use only one, or put them in different groups.
"""
And the CLI should exit with the status code for error "DuplicateSourceDefined"
Scenario: installing when a git source defines a branch that does not satisfy the version constraint
Given I write to "Berksfile" with:
"""
- cookbook "artifact", "= 0.9.8", git: "git://github.com/RiotGames/artifact-cookbook.git", ref: "0.10.0"
+ cookbook "berkshelf-cookbook-fixture", "= 1.0.0", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v0.2.0"
"""
When I run `berks install`
- Then the output should contain:
+ Then the output should match multiline:
"""
- Cookbook downloaded for 'artifact' from git: 'git://github.com/RiotGames/artifact-cookbook.git' with branch: '0.10.0' does not satisfy the version constraint (= 0.9.8)
+ The cookbook downloaded from git: 'git://github\.com/RiotGames/berkshelf-cookbook-fixture\.git' with branch: 'v0\.2\.0' at ref: '.+':
+ berkshelf-cookbook-fixture \(.+\)
+
+ does not satisfy the version constraint:
+ berkshelf-cookbook-fixture \(= 1.0.0\)
+
+ This occurs when the Chef Server has a cookbook with a missing/mis-matched version number in its `metadata.rb`\.
"""
And the CLI should exit with the status code for error "CookbookValidationFailure"
Scenario: when a git location source is defined and a cookbook of the same name is already cached in the cookbook store
Given I write to "Berksfile" with:
"""
- cookbook "artifact", git: "git://github.com/RiotGames/artifact-cookbook.git", ref: "0.10.0"
+ cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v1.0.0"
"""
And the cookbook store has the cookbooks:
- | artifact | 0.10.0 |
+ | berkshelf-cookbook-fixture | 1.0.0 |
When I successfully run `berks install`
Then the output should contain:
"""
- Installing artifact (0.10.0) from git: 'git://github.com/RiotGames/artifact-cookbook.git' with branch: '0.10.0'
+ Installing berkshelf-cookbook-fixture (1.0.0) from git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v1.0.0' at ref:
"""
And the exit status should be 0
Scenario: with a cookbook definition containing an invalid option
Given I write to "Berksfile" with:
"""
- cookbook "artifact", whatisthis: "I don't even know", anotherwat: "isthat"
+ cookbook "berkshelf-cookbook-fixture", whatisthis: "I don't even know", anotherwat: "isthat"
"""
When I run `berks install`
Then the output should contain:
"""
Invalid options for Cookbook Source: 'whatisthis', 'anotherwat'.
@@ -290,41 +307,27 @@
@chef_server
Scenario: with a cookbook definition containing a chef_api source location
Given I write to "Berksfile" with:
"""
- cookbook "cuke-test", "= 1.0.0", chef_api: :config
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0', chef_api: :config
"""
And the Chef server has cookbooks:
- | cuke-test | 1.0.0 |
+ | berkshelf-cookbook-fixture | 1.0.0 |
When I successfully run `berks install`
Then the output should contain:
"""
- Installing cuke-test (1.0.0) from chef_api:
+ Installing berkshelf-cookbook-fixture (1.0.0) from chef_api:
"""
And the cookbook store should have the cookbooks:
- | cuke-test | 1.0.0 |
- And the exit status should be 0
-
- Scenario: when the :site is not defined
- Given I write to "Berksfile" with:
- """
- cookbook 'berkshelf-cookbook-fixture', '1.0.0', site: nil
- """
- When I successfully run `berks install`
- Then the output should contain:
- """
- Installing berkshelf-cookbook-fixture (1.0.0) from site:
- """
- And the cookbook store should have the cookbooks:
| berkshelf-cookbook-fixture | 1.0.0 |
And the exit status should be 0
Scenario: with a chef_api source location specifying :config when a Berkshelf config is not found at the given path
Given I write to "Berksfile" with:
"""
- cookbook "artifact", chef_api: :config
+ cookbook 'berkshelf-cookbook-fixture', chef_api: :config
"""
When I run the install command with flags:
| -c /tmp/notthere.lol |
Then the output should contain:
"""
@@ -333,26 +336,26 @@
And the CLI should exit with the status code for error "BerksConfigNotFound"
Scenario: with a git error during download
Given I write to "Berksfile" with:
"""
- cookbook "ohai", "1.1.4"
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0'
cookbook "doesntexist", git: "git://github.com/asdjhfkljashflkjashfakljsf"
"""
When I run `berks install`
Then the output should contain:
"""
- Installing ohai (1.1.4) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
+ Installing berkshelf-cookbook-fixture (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
Failed to download 'doesntexist' from git: 'git://github.com/asdjhfkljashflkjashfakljsf' with branch: 'master'
An error occured during Git execution:
"""
And the CLI should exit with the status code for error "GitError"
Scenario: invalid site symbol
Given I write to "Berksfile" with:
"""
site :somethingabsurd
- cookbook "ohai"
+ cookbook 'berkshelf-cookbook-fixture'
"""
When I run `berks install`
Then the output should contain:
"""
Unknown site shortname: :somethingabsurd. Supported shortnames are: :opscode