Bootstrap: use multi-platform installer

* Limit auto-install to root users; otherwise, give manual install guidance
* Support non-Debian/Ubuntu with the multi-OS get.docker.com installer
This commit is contained in:
Jeremy Daer
2023-04-10 10:42:29 -07:00
committed by Jeremy Daer
parent 4fa6a6c06d
commit e85bd5ff63
7 changed files with 88 additions and 22 deletions

View File

@@ -0,0 +1,26 @@
require "test_helper"
class CommandsDockerTest < ActiveSupport::TestCase
setup do
@config = {
service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, servers: [ "1.1.1.1" ]
}
@docker = Mrsk::Commands::Docker.new(Mrsk::Configuration.new(@config))
end
test "install" do
assert_equal "curl -fsSL https://get.docker.com | sh", @docker.install.join(" ")
end
test "installed?" do
assert_equal "docker -v", @docker.installed?.join(" ")
end
test "running?" do
assert_equal "docker version", @docker.running?.join(" ")
end
test "superuser?" do
assert_equal '[ "${EUID:-$(id -u)}" -eq 0 ]', @docker.superuser?.join(" ")
end
end