Rename to Kamal
This commit is contained in:
@@ -2,22 +2,22 @@ require_relative "integration_test"
|
||||
|
||||
class AccessoryTest < IntegrationTest
|
||||
test "boot, stop, start, restart, logs, remove" do
|
||||
mrsk :accessory, :boot, :busybox
|
||||
kamal :accessory, :boot, :busybox
|
||||
assert_accessory_running :busybox
|
||||
|
||||
mrsk :accessory, :stop, :busybox
|
||||
kamal :accessory, :stop, :busybox
|
||||
assert_accessory_not_running :busybox
|
||||
|
||||
mrsk :accessory, :start, :busybox
|
||||
kamal :accessory, :start, :busybox
|
||||
assert_accessory_running :busybox
|
||||
|
||||
mrsk :accessory, :restart, :busybox
|
||||
kamal :accessory, :restart, :busybox
|
||||
assert_accessory_running :busybox
|
||||
|
||||
logs = mrsk :accessory, :logs, :busybox, capture: true
|
||||
logs = kamal :accessory, :logs, :busybox, capture: true
|
||||
assert_match /Starting busybox.../, logs
|
||||
|
||||
mrsk :accessory, :remove, :busybox, "-y"
|
||||
kamal :accessory, :remove, :busybox, "-y"
|
||||
assert_accessory_not_running :busybox
|
||||
end
|
||||
|
||||
@@ -31,6 +31,6 @@ class AccessoryTest < IntegrationTest
|
||||
end
|
||||
|
||||
def accessory_details(name)
|
||||
mrsk :accessory, :details, name, capture: true
|
||||
kamal :accessory, :details, name, capture: true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,52 +2,52 @@ require_relative "integration_test"
|
||||
|
||||
class AppTest < IntegrationTest
|
||||
test "stop, start, boot, logs, images, containers, exec, remove" do
|
||||
mrsk :deploy
|
||||
kamal :deploy
|
||||
|
||||
assert_app_is_up
|
||||
|
||||
mrsk :app, :stop
|
||||
kamal :app, :stop
|
||||
|
||||
# traefik is up and returns 404s when it can't match a route
|
||||
assert_app_not_found
|
||||
|
||||
mrsk :app, :start
|
||||
kamal :app, :start
|
||||
|
||||
# mrsk app start does not wait
|
||||
# kamal app start does not wait
|
||||
wait_for_app_to_be_up
|
||||
|
||||
mrsk :app, :boot
|
||||
kamal :app, :boot
|
||||
|
||||
wait_for_app_to_be_up
|
||||
|
||||
logs = mrsk :app, :logs, capture: true
|
||||
logs = kamal :app, :logs, capture: true
|
||||
assert_match /App Host: vm1/, logs
|
||||
assert_match /App Host: vm2/, logs
|
||||
assert_match /GET \/ HTTP\/1.1/, logs
|
||||
|
||||
images = mrsk :app, :images, capture: true
|
||||
images = kamal :app, :images, capture: true
|
||||
assert_match /App Host: vm1/, images
|
||||
assert_match /App Host: vm2/, images
|
||||
assert_match /registry:4443\/app\s+#{latest_app_version}/, images
|
||||
assert_match /registry:4443\/app\s+latest/, images
|
||||
|
||||
containers = mrsk :app, :containers, capture: true
|
||||
containers = kamal :app, :containers, capture: true
|
||||
assert_match /App Host: vm1/, containers
|
||||
assert_match /App Host: vm2/, containers
|
||||
assert_match /registry:4443\/app:#{latest_app_version}/, containers
|
||||
assert_match /registry:4443\/app:latest/, containers
|
||||
|
||||
exec_output = mrsk :app, :exec, :ps, capture: true
|
||||
exec_output = kamal :app, :exec, :ps, capture: true
|
||||
assert_match /App Host: vm1/, exec_output
|
||||
assert_match /App Host: vm2/, exec_output
|
||||
assert_match /1 root 0:\d\d ps/, exec_output
|
||||
|
||||
exec_output = mrsk :app, :exec, "--reuse", :ps, capture: true
|
||||
exec_output = kamal :app, :exec, "--reuse", :ps, capture: true
|
||||
assert_match /App Host: vm1/, exec_output
|
||||
assert_match /App Host: vm2/, exec_output
|
||||
assert_match /1 root 0:\d\d nginx/, exec_output
|
||||
|
||||
mrsk :app, :remove
|
||||
kamal :app, :remove
|
||||
|
||||
# traefik is up and returns 404s when it can't match a route
|
||||
assert_app_not_found
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: "3.7"
|
||||
name: "mrsk-test"
|
||||
name: "kamal-test"
|
||||
|
||||
volumes:
|
||||
shared:
|
||||
@@ -20,7 +20,7 @@ services:
|
||||
environment:
|
||||
- TEST_ID=${TEST_ID}
|
||||
volumes:
|
||||
- ../..:/mrsk
|
||||
- ../..:/kamal
|
||||
- shared:/shared
|
||||
- registry:/registry
|
||||
- deployer_bundle:/usr/local/bundle/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
install_mrsk() {
|
||||
cd /mrsk && gem build mrsk.gemspec -o /tmp/mrsk.gem && gem install /tmp/mrsk.gem
|
||||
install_kamal() {
|
||||
cd /kamal && gem build kamal.gemspec -o /tmp/kamal.gem && gem install /tmp/kamal.gem
|
||||
}
|
||||
|
||||
# Push the images to a persistent volume on the registry container
|
||||
@@ -17,7 +17,7 @@ push_image_to_registry_4443() {
|
||||
fi
|
||||
}
|
||||
|
||||
install_mrsk
|
||||
install_kamal
|
||||
push_image_to_registry_4443 nginx 1-alpine-slim
|
||||
push_image_to_registry_4443 traefik v2.9
|
||||
push_image_to_registry_4443 busybox 1.36.0
|
||||
|
||||
@@ -38,8 +38,8 @@ class IntegrationTest < ActiveSupport::TestCase
|
||||
docker_compose("exec deployer #{commands.join(" ")}", **options)
|
||||
end
|
||||
|
||||
def mrsk(*commands, **options)
|
||||
deployer_exec(:mrsk, *commands, **options)
|
||||
def kamal(*commands, **options)
|
||||
deployer_exec(:kamal, *commands, **options)
|
||||
end
|
||||
|
||||
def assert_app_is_down
|
||||
@@ -101,7 +101,7 @@ class IntegrationTest < ActiveSupport::TestCase
|
||||
code = response.code
|
||||
if code != "200"
|
||||
puts "Got response code #{code}, here are the traefik logs:"
|
||||
mrsk :traefik, :logs
|
||||
kamal :traefik, :logs
|
||||
puts "And here are the load balancer logs"
|
||||
docker_compose :logs, :load_balancer
|
||||
puts "Tried to get the response code again and got #{app_response.code}"
|
||||
@@ -129,7 +129,7 @@ class IntegrationTest < ActiveSupport::TestCase
|
||||
code = app_response.code
|
||||
if code != expected_code
|
||||
puts "Got response code #{code}, here are the traefik logs:"
|
||||
mrsk :traefik, :logs
|
||||
kamal :traefik, :logs
|
||||
puts "And here are the load balancer logs"
|
||||
docker_compose :logs, :load_balancer
|
||||
puts "Tried to get the response code again and got #{app_response.code}"
|
||||
|
||||
@@ -2,17 +2,17 @@ require_relative "integration_test"
|
||||
|
||||
class LockTest < IntegrationTest
|
||||
test "acquire, release, status" do
|
||||
mrsk :lock, :acquire, "-m 'Integration Tests'"
|
||||
kamal :lock, :acquire, "-m 'Integration Tests'"
|
||||
|
||||
status = mrsk :lock, :status, capture: true
|
||||
status = kamal :lock, :status, capture: true
|
||||
assert_match /Locked by: Deployer at .*\nVersion: #{latest_app_version}\nMessage: Integration Tests/m, status
|
||||
|
||||
error = mrsk :deploy, capture: true, raise_on_error: false
|
||||
error = kamal :deploy, capture: true, raise_on_error: false
|
||||
assert_match /Deploy lock found/m, error
|
||||
|
||||
mrsk :lock, :release
|
||||
kamal :lock, :release
|
||||
|
||||
status = mrsk :lock, :status, capture: true
|
||||
status = kamal :lock, :status, capture: true
|
||||
assert_match /There is no deploy lock/m, status
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,21 +6,21 @@ class MainTest < IntegrationTest
|
||||
|
||||
assert_app_is_down
|
||||
|
||||
mrsk :deploy
|
||||
kamal :deploy
|
||||
assert_app_is_up version: first_version
|
||||
assert_hooks_ran "pre-connect", "pre-build", "pre-deploy", "post-deploy"
|
||||
|
||||
second_version = update_app_rev
|
||||
|
||||
mrsk :redeploy
|
||||
kamal :redeploy
|
||||
assert_app_is_up version: second_version
|
||||
assert_hooks_ran "pre-connect", "pre-build", "pre-deploy", "post-deploy"
|
||||
|
||||
mrsk :rollback, first_version
|
||||
kamal :rollback, first_version
|
||||
assert_hooks_ran "pre-connect", "pre-deploy", "post-deploy"
|
||||
assert_app_is_up version: first_version
|
||||
|
||||
details = mrsk :details, capture: true
|
||||
details = kamal :details, capture: true
|
||||
assert_match /Traefik Host: vm1/, details
|
||||
assert_match /Traefik Host: vm2/, details
|
||||
assert_match /App Host: vm1/, details
|
||||
@@ -28,18 +28,18 @@ class MainTest < IntegrationTest
|
||||
assert_match /traefik:v2.9/, details
|
||||
assert_match /registry:4443\/app:#{first_version}/, details
|
||||
|
||||
audit = mrsk :audit, capture: true
|
||||
audit = kamal :audit, capture: true
|
||||
assert_match /Booted app version #{first_version}.*Booted app version #{second_version}.*Booted app version #{first_version}.*/m, audit
|
||||
end
|
||||
|
||||
test "envify" do
|
||||
mrsk :envify
|
||||
kamal :envify
|
||||
|
||||
assert_equal "SECRET_TOKEN=1234", deployer_exec("cat .env", capture: true)
|
||||
end
|
||||
|
||||
test "config" do
|
||||
config = YAML.load(mrsk(:config, capture: true))
|
||||
config = YAML.load(kamal(:config, capture: true))
|
||||
version = latest_app_version
|
||||
|
||||
assert_equal [ "web" ], config[:roles]
|
||||
|
||||
@@ -2,36 +2,36 @@ require_relative "integration_test"
|
||||
|
||||
class TraefikTest < IntegrationTest
|
||||
test "boot, reboot, stop, start, restart, logs, remove" do
|
||||
mrsk :traefik, :boot
|
||||
kamal :traefik, :boot
|
||||
assert_traefik_running
|
||||
|
||||
mrsk :traefik, :reboot
|
||||
kamal :traefik, :reboot
|
||||
assert_traefik_running
|
||||
|
||||
mrsk :traefik, :boot
|
||||
kamal :traefik, :boot
|
||||
assert_traefik_running
|
||||
|
||||
# Check booting when booted doesn't raise an error
|
||||
mrsk :traefik, :stop
|
||||
kamal :traefik, :stop
|
||||
assert_traefik_not_running
|
||||
|
||||
# Check booting when stopped works
|
||||
mrsk :traefik, :boot
|
||||
kamal :traefik, :boot
|
||||
assert_traefik_running
|
||||
|
||||
mrsk :traefik, :stop
|
||||
kamal :traefik, :stop
|
||||
assert_traefik_not_running
|
||||
|
||||
mrsk :traefik, :start
|
||||
kamal :traefik, :start
|
||||
assert_traefik_running
|
||||
|
||||
mrsk :traefik, :restart
|
||||
kamal :traefik, :restart
|
||||
assert_traefik_running
|
||||
|
||||
logs = mrsk :traefik, :logs, capture: true
|
||||
logs = kamal :traefik, :logs, capture: true
|
||||
assert_match /Traefik version [\d.]+ built on/, logs
|
||||
|
||||
mrsk :traefik, :remove
|
||||
kamal :traefik, :remove
|
||||
assert_traefik_not_running
|
||||
end
|
||||
|
||||
@@ -45,6 +45,6 @@ class TraefikTest < IntegrationTest
|
||||
end
|
||||
|
||||
def traefik_details
|
||||
mrsk :traefik, :details, capture: true
|
||||
kamal :traefik, :details, capture: true
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user