Global option for designating primary host only
This commit is contained in:
@@ -13,17 +13,24 @@ class CommanderTest < ActiveSupport::TestCase
|
||||
test "overwriting hosts" do
|
||||
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" ], @mrsk.hosts
|
||||
|
||||
@mrsk.hosts = [ "1.2.3.4", "1.2.3.5" ]
|
||||
@mrsk.specific_hosts = [ "1.2.3.4", "1.2.3.5" ]
|
||||
assert_equal [ "1.2.3.4", "1.2.3.5" ], @mrsk.hosts
|
||||
end
|
||||
|
||||
test "overwriting hosts with roles" do
|
||||
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" ], @mrsk.hosts
|
||||
|
||||
@mrsk.roles = [ "workers", "web" ]
|
||||
@mrsk.specific_roles = [ "workers", "web" ]
|
||||
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" ], @mrsk.hosts
|
||||
|
||||
@mrsk.roles = [ "workers" ]
|
||||
@mrsk.specific_roles = [ "workers" ]
|
||||
assert_equal [ "1.1.1.3", "1.1.1.4" ], @mrsk.hosts
|
||||
end
|
||||
|
||||
test "overwriting hosts with primary" do
|
||||
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" ], @mrsk.hosts
|
||||
|
||||
@mrsk.specific_primary!
|
||||
assert_equal [ "1.1.1.1" ], @mrsk.hosts
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,9 +48,9 @@ class ConfigurationTest < ActiveSupport::TestCase
|
||||
assert_equal [ "1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4" ], @config_with_roles.all_hosts
|
||||
end
|
||||
|
||||
test "primary host" do
|
||||
assert_equal "1.1.1.1", @config.primary_host
|
||||
assert_equal "1.1.1.1", @config_with_roles.primary_host
|
||||
test "primary web host" do
|
||||
assert_equal "1.1.1.1", @config.primary_web_host
|
||||
assert_equal "1.1.1.1", @config_with_roles.primary_web_host
|
||||
end
|
||||
|
||||
test "traefik hosts" do
|
||||
@@ -123,4 +123,8 @@ class ConfigurationTest < ActiveSupport::TestCase
|
||||
config = Mrsk::Configuration.create_from dest_config_file, destination: "missing"
|
||||
end
|
||||
end
|
||||
|
||||
test "to_h" do
|
||||
assert_equal({ :roles=>["web"], :hosts=>["1.1.1.1", "1.1.1.2"], :primary_host=>"1.1.1.1", :version=>"123", :repository=>"dhh/app", :absolute_image=>"dhh/app:123", :service_with_version=>"app-123", :env_args=>["-e", "REDIS_URL=redis://x/y"], :ssh_options=>{:user=>"root", :auth_methods=>["publickey"]} }, @config.to_h)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user