From bf02e2e167fd7fd18818aa048c5ec9b67d8f2eb0 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Thu, 22 Jun 2023 10:22:29 -0700 Subject: [PATCH 1/7] Discovering why Berkshelf is busted Signed-off-by: John McCrae --- Gemfile | 9 ++++++--- features/support/env.rb | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 730ac41cd..0a6239ef4 100644 --- a/Gemfile +++ b/Gemfile @@ -7,9 +7,12 @@ group :build do end group :development do - gem "aruba", "~> 0.10" # Stay below 1 until aruba/in_process monkeypatching stops - gem "cucumber", "< 4.0" # until we identify what is generating the ~@no_run tag in CI - gem "cucumber-expressions", "= 5.0.13" + gem 'aruba', '~> 2.1' + # gem "aruba", "~> 0.10" # Stay below 1 until aruba/in_process monkeypatching stops + gem "cucumber", "~> 8.0" + gem "cucumber-expressions", "~> 8.3" + # gem "cucumber", "< 4.0" # until we identify what is generating the ~@no_run tag in CI + # gem "cucumber-expressions", "= 5.0.13" gem "chef-zero", ">= 4.0" gem "dep_selector", ">= 1.0" gem "fuubar", ">= 2.0" diff --git a/features/support/env.rb b/features/support/env.rb index 75d4f665a..0e38b207b 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -3,8 +3,9 @@ def windows? end require "aruba/cucumber" -require "aruba/in_process" -require "aruba/spawn_process" +require 'aruba/processes/spawn_process' +# require "aruba/in_process" +# require "aruba/spawn_process" require "cucumber/rspec/doubles" Dir["spec/support/**/*.rb"].each { |f| require File.expand_path(f) } From 9c9c99e6e8a1fe52d92e2e51c2d227d97f8d50c0 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Thu, 22 Jun 2023 13:29:28 -0700 Subject: [PATCH 2/7] Discovering why Berkshelf is busted Signed-off-by: John McCrae --- Gemfile | 9 +++------ features/support/env.rb | 5 ++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 0a6239ef4..b959c12a2 100644 --- a/Gemfile +++ b/Gemfile @@ -7,12 +7,9 @@ group :build do end group :development do - gem 'aruba', '~> 2.1' - # gem "aruba", "~> 0.10" # Stay below 1 until aruba/in_process monkeypatching stops - gem "cucumber", "~> 8.0" - gem "cucumber-expressions", "~> 8.3" - # gem "cucumber", "< 4.0" # until we identify what is generating the ~@no_run tag in CI - # gem "cucumber-expressions", "= 5.0.13" + gem "aruba", "~> 0.10" # Stay below 1 until aruba/in_process monkeypatching stops + gem "cucumber", "= 3.1.0" # until we identify what is generating the ~@no_run tag in CI + gem "cucumber-expressions", "= 5.0.13" gem "chef-zero", ">= 4.0" gem "dep_selector", ">= 1.0" gem "fuubar", ">= 2.0" diff --git a/features/support/env.rb b/features/support/env.rb index 0e38b207b..75d4f665a 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -3,9 +3,8 @@ def windows? end require "aruba/cucumber" -require 'aruba/processes/spawn_process' -# require "aruba/in_process" -# require "aruba/spawn_process" +require "aruba/in_process" +require "aruba/spawn_process" require "cucumber/rspec/doubles" Dir["spec/support/**/*.rb"].each { |f| require File.expand_path(f) } From 5f30361a196fa26e0a3f12b22aee93838bb0d61f Mon Sep 17 00:00:00 2001 From: John McCrae Date: Wed, 30 Aug 2023 16:42:11 -0700 Subject: [PATCH 3/7] refactoring networking objects in spec file Signed-off-by: John McCrae --- spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb b/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb index de4132998..da57aba74 100644 --- a/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb +++ b/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb @@ -1,4 +1,5 @@ require "spec_helper" +require "pry-byebug" describe Berkshelf::APIClient::Connection do let(:instance) { described_class.new("http://supermarket.getchef.com") } @@ -130,6 +131,7 @@ end it "raises Berkshelf::APIClient::ServiceUnavailable for 500s" do + binding.pry stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: [500, "Internal Server Error"]) expect { subject }.to raise_error(Berkshelf::APIClient::ServiceUnavailable) end From f517b1128074bda3e3eb568529954ad4e1b6dac7 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Fri, 1 Sep 2023 07:22:54 -0700 Subject: [PATCH 4/7] updating fixes Signed-off-by: John McCrae --- .../berkshelf/berkshelf/api_client/connection_spec.rb | 8 +++----- spec/unit/berkshelf/community_rest_spec.rb | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb b/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb index da57aba74..7f79f7b26 100644 --- a/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb +++ b/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb @@ -1,5 +1,4 @@ require "spec_helper" -require "pry-byebug" describe Berkshelf::APIClient::Connection do let(:instance) { described_class.new("http://supermarket.getchef.com") } @@ -131,18 +130,17 @@ end it "raises Berkshelf::APIClient::ServiceUnavailable for 500s" do - binding.pry - stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: [500, "Internal Server Error"]) + stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: 500, body: "Internal Server Error") expect { subject }.to raise_error(Berkshelf::APIClient::ServiceUnavailable) end it "raises Berkshelf::APIClient::ServiceNotFound for 404s" do - stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: [404, "Not Found"]) + stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: 404, body: "Not Found") expect { subject }.to raise_error(Berkshelf::APIClient::ServiceNotFound) end it "raises Net::HTTPBadRequest for 400s" do - stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: [400, "Bad Request"]) + stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: 400, body: "Bad Request") expect { subject }.to raise_error(Berkshelf::APIClient::BadResponse) end diff --git a/spec/unit/berkshelf/community_rest_spec.rb b/spec/unit/berkshelf/community_rest_spec.rb index 9c8d438b6..ced7aa90a 100644 --- a/spec/unit/berkshelf/community_rest_spec.rb +++ b/spec/unit/berkshelf/community_rest_spec.rb @@ -107,7 +107,7 @@ it "raises a CookbookNotFound error on a 404 response for a non-existent cookbook" do stub_request(:get, "#{api_uri}/cookbooks/not_real/versions/1_0_0").to_return( status: 404, - body: nil + body: "Not Found" ) expect do @@ -142,7 +142,7 @@ it "raises a CookbookNotFound error on a 404 response" do stub_request(:get, "#{api_uri}/cookbooks/not_real").to_return( status: 404, - body: nil + body: "Not Found" ) expect do @@ -177,7 +177,7 @@ it "raises a CookbookNotFound error on a 404 response" do stub_request(:get, "#{api_uri}/cookbooks/not_real").to_return( status: 404, - body: nil + body: "Not Found" ) expect do From 1beab0bc3c56ef23b11087b85c39bebbee8d623a Mon Sep 17 00:00:00 2001 From: John McCrae Date: Wed, 6 Sep 2023 07:29:13 -0700 Subject: [PATCH 5/7] Removing accidental updates Signed-off-by: John McCrae --- spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb | 6 +++--- spec/unit/berkshelf/community_rest_spec.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb b/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb index 7f79f7b26..de4132998 100644 --- a/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb +++ b/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb @@ -130,17 +130,17 @@ end it "raises Berkshelf::APIClient::ServiceUnavailable for 500s" do - stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: 500, body: "Internal Server Error") + stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: [500, "Internal Server Error"]) expect { subject }.to raise_error(Berkshelf::APIClient::ServiceUnavailable) end it "raises Berkshelf::APIClient::ServiceNotFound for 404s" do - stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: 404, body: "Not Found") + stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: [404, "Not Found"]) expect { subject }.to raise_error(Berkshelf::APIClient::ServiceNotFound) end it "raises Net::HTTPBadRequest for 400s" do - stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: 400, body: "Bad Request") + stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: [400, "Bad Request"]) expect { subject }.to raise_error(Berkshelf::APIClient::BadResponse) end diff --git a/spec/unit/berkshelf/community_rest_spec.rb b/spec/unit/berkshelf/community_rest_spec.rb index ced7aa90a..9c8d438b6 100644 --- a/spec/unit/berkshelf/community_rest_spec.rb +++ b/spec/unit/berkshelf/community_rest_spec.rb @@ -107,7 +107,7 @@ it "raises a CookbookNotFound error on a 404 response for a non-existent cookbook" do stub_request(:get, "#{api_uri}/cookbooks/not_real/versions/1_0_0").to_return( status: 404, - body: "Not Found" + body: nil ) expect do @@ -142,7 +142,7 @@ it "raises a CookbookNotFound error on a 404 response" do stub_request(:get, "#{api_uri}/cookbooks/not_real").to_return( status: 404, - body: "Not Found" + body: nil ) expect do @@ -177,7 +177,7 @@ it "raises a CookbookNotFound error on a 404 response" do stub_request(:get, "#{api_uri}/cookbooks/not_real").to_return( status: 404, - body: "Not Found" + body: nil ) expect do From dcdb969402137cc86be9c6cd598e536254fd650c Mon Sep 17 00:00:00 2001 From: John Date: Wed, 13 Sep 2023 20:23:22 +0000 Subject: [PATCH 6/7] Updating Berkshelf to refactor tests Signed-off-by: John --- .../berkshelf/berkshelf/api_client/connection_spec.rb | 8 ++++---- spec/unit/berkshelf/community_rest_spec.rb | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb b/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb index de4132998..2b73c4e2b 100644 --- a/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb +++ b/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb @@ -130,17 +130,17 @@ end it "raises Berkshelf::APIClient::ServiceUnavailable for 500s" do - stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: [500, "Internal Server Error"]) + stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: 500, body: "Internal Server Error") expect { subject }.to raise_error(Berkshelf::APIClient::ServiceUnavailable) end it "raises Berkshelf::APIClient::ServiceNotFound for 404s" do - stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: [404, "Not Found"]) + stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: 404, body: "Not Found") expect { subject }.to raise_error(Berkshelf::APIClient::ServiceNotFound) end it "raises Net::HTTPBadRequest for 400s" do - stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: [400, "Bad Request"]) + stub_request(:get, "http://supermarket.getchef.com/universe").to_return(status: 400, body: "Bad Request") expect { subject }.to raise_error(Berkshelf::APIClient::BadResponse) end @@ -154,4 +154,4 @@ expect { subject }.to raise_error(Berkshelf::APIClient::ServiceUnavailable) end end -end +end \ No newline at end of file diff --git a/spec/unit/berkshelf/community_rest_spec.rb b/spec/unit/berkshelf/community_rest_spec.rb index 9c8d438b6..bdb769a83 100644 --- a/spec/unit/berkshelf/community_rest_spec.rb +++ b/spec/unit/berkshelf/community_rest_spec.rb @@ -107,7 +107,7 @@ it "raises a CookbookNotFound error on a 404 response for a non-existent cookbook" do stub_request(:get, "#{api_uri}/cookbooks/not_real/versions/1_0_0").to_return( status: 404, - body: nil + body: "Not Found" ) expect do @@ -142,7 +142,7 @@ it "raises a CookbookNotFound error on a 404 response" do stub_request(:get, "#{api_uri}/cookbooks/not_real").to_return( status: 404, - body: nil + body: "Not Found" ) expect do @@ -177,7 +177,7 @@ it "raises a CookbookNotFound error on a 404 response" do stub_request(:get, "#{api_uri}/cookbooks/not_real").to_return( status: 404, - body: nil + body: "Not Found" ) expect do @@ -213,4 +213,4 @@ describe "#stream" do skip end -end +end \ No newline at end of file From e1ff9ba9b61d7ea658162874a1c954d4b844ece3 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Fri, 9 Aug 2024 19:27:28 +0000 Subject: [PATCH 7/7] Updating dependencies and minitar version Signed-off-by: John McCrae --- berkshelf.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/berkshelf.gemspec b/berkshelf.gemspec index 8857f4f77..d9e451929 100644 --- a/berkshelf.gemspec +++ b/berkshelf.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |s| s.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0" s.add_dependency "cleanroom", "~> 1.0" - s.add_dependency "minitar", ">= 0.6" + s.add_dependency "minitar", ">= 0.6", "< 0.12" s.add_dependency "retryable", ">= 2.0", "< 4.0" s.add_dependency "solve", "~> 4.0" s.add_dependency "thor", ">= 0.20" @@ -43,7 +43,7 @@ Gem::Specification.new do |s| s.add_dependency "mixlib-archive", ">= 1.1.4", "< 2.0" # needed for ruby 3.0 / Dir.chdir removal s.add_dependency "concurrent-ruby", "~> 1.0" if RUBY_VERSION.match?(/3.0/) - s.add_dependency "chef", "~> 17.0" # needed for --skip-syntax-check + s.add_dependency "chef", "~> 17.10.122" # needed for --skip-syntax-check elsif s.add_dependency "chef", ">= 15.7.32" end