Add option for two-part configs with the destination option
This commit is contained in:
@@ -111,7 +111,25 @@ class ConfigurationTest < ActiveSupport::TestCase
|
||||
|
||||
|
||||
test "erb evaluation of yml config" do
|
||||
config = Mrsk::Configuration.load_file Pathname.new(File.expand_path("fixtures/deploy.erb.yml", __dir__))
|
||||
config = Mrsk::Configuration.create_from Pathname.new(File.expand_path("fixtures/deploy.erb.yml", __dir__))
|
||||
assert_equal "my-user", config.registry["username"]
|
||||
end
|
||||
|
||||
test "destination yml config merge" do
|
||||
dest_config_file = Pathname.new(File.expand_path("fixtures/deploy_for_dest.yml", __dir__))
|
||||
|
||||
config = Mrsk::Configuration.create_from dest_config_file, destination: "world"
|
||||
assert_equal "1.1.1.1", config.hosts.first
|
||||
|
||||
config = Mrsk::Configuration.create_from dest_config_file, destination: "mars"
|
||||
assert_equal "1.1.1.3", config.hosts.first
|
||||
end
|
||||
|
||||
test "destination yml config file missing" do
|
||||
dest_config_file = Pathname.new(File.expand_path("fixtures/deploy_for_dest.yml", __dir__))
|
||||
|
||||
assert_raises(RuntimeError) do
|
||||
config = Mrsk::Configuration.create_from dest_config_file, destination: "missing"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
5
test/fixtures/deploy_for_dest.mars.yml
vendored
Normal file
5
test/fixtures/deploy_for_dest.mars.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
servers:
|
||||
- 1.1.1.3
|
||||
- 1.1.1.4
|
||||
env:
|
||||
REDIS_URL: redis://a/b
|
||||
5
test/fixtures/deploy_for_dest.world.yml
vendored
Normal file
5
test/fixtures/deploy_for_dest.world.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
servers:
|
||||
- 1.1.1.1
|
||||
- 1.1.1.2
|
||||
env:
|
||||
REDIS_URL: redis://x/y
|
||||
6
test/fixtures/deploy_for_dest.yml
vendored
Normal file
6
test/fixtures/deploy_for_dest.yml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
service: app
|
||||
image: dhh/app
|
||||
registry:
|
||||
server: registry.digitalocean.com
|
||||
username: <%= "my-user" %>
|
||||
password: <%= "my-password" %>
|
||||
Reference in New Issue
Block a user