Properly respect environment variable on checkpoint setup

The checkpoint update missed the environment variable check for
disabling the checks so this adds in the check and properly
disables checks when requested.
This commit is contained in:
Chris Roberts 2018-04-05 10:47:28 -07:00
parent 0a061238ae
commit 8391abc63a
2 changed files with 14 additions and 1 deletions

View File

@ -39,6 +39,10 @@ module Vagrant
rescue LoadError
@logger.warn("checkpoint library not found. disabling.")
end
if ENV["VAGRANT_CHECKPOINT_DISABLE"]
@logger.debug("checkpoint disabled via explicit user request")
@enabled = false
end
@files = {
signature: env.data_dir.join("checkpoint_signature"),
cache: env.data_dir.join("checkpoint_cache")

View File

@ -23,7 +23,8 @@ describe Vagrant::Util::CheckpointClient do
end
describe "#setup" do
before{ subject.setup(env) }
let(:environment){ {} }
before{ with_temp_env(environment){ subject.setup(env) } }
it "should enable after setup" do
expect(subject.enabled).to be(true)
@ -32,6 +33,14 @@ describe Vagrant::Util::CheckpointClient do
it "should generate required paths" do
expect(subject.files).not_to be_empty
end
context "with VAGRANT_CHECKPOINT_DISABLE set" do
let(:environment){ {"VAGRANT_CHECKPOINT_DISABLE" => "1"} }
it "should not be enabled after setup" do
expect(subject.enabled).to be(false)
end
end
end
describe "#check" do