forked from hashicorp/vagrant
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provisioning now generates a DNA JSON file and uploads it to the /tmp…
… directory for use. Fixed some issues with SCPing.
- Loading branch information
Showing
11 changed files
with
76 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ Hobofile | |
.hobo | ||
.bundle | ||
*.lock | ||
cookbooks/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,46 @@ | ||
require File.join(File.dirname(__FILE__), '..', 'test_helper') | ||
|
||
class ProvisioningTest < Test::Unit::TestCase | ||
setup do | ||
# Stub upload so nothing happens | ||
Hobo::SSH.stubs(:upload!) | ||
|
||
vm = mock("vm") | ||
vm.stubs(:share_folder) | ||
@prov = Hobo::Provisioning.new(vm) | ||
end | ||
|
||
context "initializing" do | ||
should "setup shared folder on VM" do | ||
should "setup shared folder on VM for the cookbooks" do | ||
File.expects(:expand_path).with(Hobo.config.chef.cookbooks_path, Hobo::Env.root_path).returns("foo") | ||
cookbooks_path = File.join(Hobo.config.chef.provisioning_path, "cookbooks") | ||
vm = mock("vm") | ||
vm.expects(:share_folder).with("hobo-provisioning", "foo", Hobo.config.chef.provisioning_path) | ||
vm.expects(:share_folder).with("hobo-provisioning", "foo", cookbooks_path) | ||
Hobo::Provisioning.new(vm) | ||
end | ||
end | ||
|
||
context "permissions on provisioning folder" do | ||
should "chown the folder to the ssh user" do | ||
ssh = mock("ssh") | ||
ssh.expects(:exec!).with("sudo chown #{Hobo.config.ssh.username} #{Hobo.config.chef.provisioning_path}") | ||
Hobo::SSH.expects(:execute).yields(ssh) | ||
@prov.chown_provisioning_folder | ||
end | ||
end | ||
|
||
context "generating and uploading json" do | ||
should "convert the JSON config to JSON" do | ||
Hobo.config.chef.json.expects(:to_json).once.returns("foo") | ||
@prov.setup_json | ||
end | ||
|
||
should "upload a StringIO to dna.json" do | ||
Hobo.config.chef.json.expects(:to_json).once.returns("foo") | ||
StringIO.expects(:new).with("foo").returns("bar") | ||
File.expects(:join).with(Hobo.config.chef.provisioning_path, "dna.json").once.returns("baz") | ||
Hobo::SSH.expects(:upload!).with("bar", "baz").once | ||
@prov.setup_json | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters