Merge pull request #9659 from chrisroberts/f-checkpoint-disable

Properly respect environment variable on checkpoint setup
This commit is contained in:
Chris Roberts 2018-04-05 11:55:49 -07:00 committed by GitHub
commit 53ed5948f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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