Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rescue CookbookNotFound in lockfile#load! #727

Merged
merged 1 commit into from
Jul 8, 2013
Merged

Conversation

sethvargo
Copy link
Contributor

It's possible that a source is locked that contains a path location, and that path location was renamed or no longer exists. When loading the lockfile, Berkshelf will throw an error if it can't find a cookbook that previously existed at a path location.

This was never an issue before, because the lockfile was not trusted if the SHAs did not match. Now that we always evaluate, it's possible for the lockfile to contain stale entries.

reset added a commit that referenced this pull request Jul 8, 2013
Rescue CookbookNotFound in lockfile#load!
@reset reset merged commit 7e0d0b0 into master Jul 8, 2013
@reset reset deleted the lockfile_load-master branch July 8, 2013 21:07
@ryansouza
Copy link

This pull request may have broken master

daisy-and-violet:...elf(expand-berksfile-eval✗)$ b cucumber features/lockfile.feature:109
Resolving dependencies...
The Gemfile's dependencies are satisfied
Feature: Creating and reading the Berkshelf lockfile
  As a user
  I want my versions to be locked even when I don't specify versions in my Berksfile
  So when I share my repository, all other developers get the same versions that I did when I installed.

  Scenario: Reading the Berksfile.lock when it contains an invalid path location # features/lockfile.feature:109
    Given the cookbook store has the cookbooks:                                  # features/step_definitions/filesystem_steps.rb:18
      | fake | 1.0.0 |
    And I write to "Berksfile" with:                                             # aruba-0.5.3/lib/aruba/cucumber.rb:31
      """
      cookbook 'fake'
      """
    And I write to "Berksfile.lock" with:                                        # aruba-0.5.3/lib/aruba/cucumber.rb:31
      """
      {
        "sources":{
          "non-existent":{
            "path":"/this/path/does/not/exist"
          }
        }
      }
      """
    When I successfully run `berks install`                                      # aruba-0.5.3/lib/aruba/cucumber.rb:71
    Then the file "Berksfile.lock" should contain JSON:                          # features/step_definitions/json_steps.rb:15
      """
      {
        "sources":{
          "fake":{
            "locked_version":"1.0.0"
          }
        }
      }
      """

      expected: "{\n  \"sources\": {\n    \"fake\": {\n      \"locked_version\": \"1.0.0\"\n    }\n  }\n}"
           got: "{\n  \"dependencies\": {\n    \"fake\": {\n      \"locked_version\": \"1.0.0\"\n    }\n  }\n}"

      (compared using ==)

      Diff:
      @@ -1,5 +1,5 @@
       {
      -  "sources": {
      +  "dependencies": {
           "fake": {
             "locked_version": "1.0.0"
           }
       (RSpec::Expectations::ExpectationNotMetError)
      ./features/step_definitions/json_steps.rb:19:in `/^the file "(.*?)" should contain JSON:$/'
      features/lockfile.feature:127:in `Then the file "Berksfile.lock" should contain JSON:'
    And the exit status should be 0                                              # aruba-0.5.3/lib/aruba/cucumber.rb:154

Failing Scenarios:
cucumber features/lockfile.feature:109 # Scenario: Reading the Berksfile.lock when it contains an invalid path location

1 scenario (1 failed)
6 steps (1 failed, 1 skipped, 4 passed)
0m0.052s

It appears travis-ci didn't pick up on this pull request or merge commit, the last build was 6 days ago

@sethvargo
Copy link
Contributor Author

@ryansouza 7e0d0b0..4aebc15

@ryansouza
Copy link

👏

@berkshelf berkshelf locked and limited conversation to collaborators Jun 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants