Testing Server Command Implementation in Kamal
This test suite validates the server command functionality in Kamal, focusing on configuration handling and directory management. The tests ensure proper initialization and execution of server-related operations within the deployment workflow.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
basecamp/kamal
test/commands/server_test.rb
require "test_helper"
class CommandsServerTest < ActiveSupport::TestCase
setup do
@config = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, servers: [ "1.1.1.1" ],
builder: { "arch" => "amd64" }
}
end
test "ensure run directory" do
assert_equal "mkdir -p .kamal", new_command.ensure_run_directory.join(" ")
end
private
def new_command(extra_config = {})
Kamal::Commands::Server.new(Kamal::Configuration.new(@config.merge(extra_config)))
end
end