diff options
author | Marc A. Paradise <marc.paradise@gmail.com> | 2019-04-30 17:44:48 -0400 |
---|---|---|
committer | Marc A. Paradise <marc.paradise@gmail.com> | 2019-05-03 17:30:07 -0400 |
commit | ba50ae6d20ef86ab39b9fa2eee982f929cd70c7e (patch) | |
tree | 56f5d03eef665e65fa6611ee236cc52bb59a9c97 /spec | |
parent | 58db2c3f47e86d539d21f9365adb135726719e38 (diff) | |
download | chef-ba50ae6d20ef86ab39b9fa2eee982f929cd70c7e.tar.gz |
Restore bootstrap pre-release support
It was originally removed after discussion in community slack,
but it turns out to have a little more utility than we thought.
When enabled, it will cause the package to be downloaded from
the `current` channel.
Option description has been updated from 'install prerelease gem'
to 'install from current channel'.
This commit otherwise restores the original behavior and adds some tests.
Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/knife/core/bootstrap_context_spec.rb | 21 | ||||
-rw-r--r-- | spec/unit/knife/core/windows_bootstrap_context_spec.rb | 27 |
2 files changed, 47 insertions, 1 deletions
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb index 2ed8b6bc51..e72acf9b7a 100644 --- a/spec/unit/knife/core/bootstrap_context_spec.rb +++ b/spec/unit/knife/core/bootstrap_context_spec.rb @@ -166,6 +166,27 @@ describe Chef::Knife::Core::BootstrapContext do it "should send the full version to the installer" do expect(bootstrap_context.latest_current_chef_version_string).to eq("-v 11.12.4") end + + describe "and it is a prerelease version" do + let(:chef_config) do + { + knife: { bootstrap_version: "11.12.4.xyz" }, + } + end + + it "should set the version and set -p" do + expect(bootstrap_context.latest_current_chef_version_string).to eq("-v 11.12.4.xyz -p") + end + end + + end + + describe "when prerelease is specified" do + let(:config) { { prerelease: true } } + + it "should send -p to the installer" do + expect(bootstrap_context.latest_current_chef_version_string).to eq("-p") + end end describe "when a bootstrap_version is not specified" do diff --git a/spec/unit/knife/core/windows_bootstrap_context_spec.rb b/spec/unit/knife/core/windows_bootstrap_context_spec.rb index a19ad11247..a39a3a9242 100644 --- a/spec/unit/knife/core/windows_bootstrap_context_spec.rb +++ b/spec/unit/knife/core/windows_bootstrap_context_spec.rb @@ -177,11 +177,36 @@ describe Chef::Knife::Core::WindowsBootstrapContext do end describe "latest_current_windows_chef_version_query" do - it "returns the major version of the current version of Chef" do + it "includes the major version of the current version of Chef" do stub_const("Chef::VERSION", "15.1.2") expect(bootstrap_context.latest_current_windows_chef_version_query).to eq("&v=15") end + context "when bootstrap_version is given" do + before do + Chef::Config[:knife][:bootstrap_version] = "15.1.2" + end + it "includes the requested version" do + expect(bootstrap_context.latest_current_windows_chef_version_query).to eq("&v=15.1.2") + end + end + + context "when prerelease is true" do + let(:config) { { prerelease: true } } + it "includes prerelease indicator " do + expect(bootstrap_context.latest_current_windows_chef_version_query).to eq("&prerelease=true") + end + end + + context "when a prerelease bootstrap_version is specified" do + before do + Chef::Config[:knife][:bootstrap_version] = "15.1.2.xyz" + end + it "includes prerelease indicator and the given version" do + expect(bootstrap_context.latest_current_windows_chef_version_query).to eq("&v=15.1.2.xyz&prerelease=true") + end + end + end describe "msi_url" do |