This commit is contained in:
Donal McBreen
2024-03-28 14:16:36 +00:00
parent 00061ce7aa
commit d47912572c
11 changed files with 29 additions and 37 deletions

View File

@@ -1,3 +0,0 @@
#!/bin/sh
echo "Rebooted Traefik on ${KAMAL_HOSTS}"
mkdir -p /tmp/${TEST_ID} && touch /tmp/${TEST_ID}/post-traefik-reboot

View File

@@ -1,3 +0,0 @@
#!/bin/sh
echo "Rebooting Traefik on ${KAMAL_HOSTS}..."
mkdir -p /tmp/${TEST_ID} && touch /tmp/${TEST_ID}/pre-traefik-reboot

View File

@@ -6,4 +6,4 @@ ARG COMMIT_SHA
RUN echo $COMMIT_SHA > /usr/share/nginx/html/version
RUN mkdir -p /usr/share/nginx/html/versions && echo "version" > /usr/share/nginx/html/versions/$COMMIT_SHA
RUN mkdir -p /usr/share/nginx/html/versions && echo "hidden" > /usr/share/nginx/html/versions/.hidden
RUN echo "Up!" > /usr/share/nginx/html/up

View File

@@ -22,11 +22,8 @@ builder:
COMMIT_SHA: <%= `git rev-parse HEAD` %>
healthcheck:
cmd: wget -qO- http://localhost > /dev/null || exit 1
traefik:
args:
accesslog: true
accesslog.format: json
image: registry:4443/traefik:v2.10
proxy:
image: registry:4443/dmcbreen/mproxy:latest
accessories:
busybox:
service: custom-busybox

View File

@@ -125,9 +125,9 @@ class IntegrationTest < ActiveSupport::TestCase
code = app_response.code
if code != expected_code
puts "Got response code #{code}, here are the proxy logs:"
kamal :proxy, :logs
kamal :proxy, :logs, raise_on_error: false
puts "And here are the load balancer logs"
docker_compose :logs, :load_balancer
docker_compose :logs, :load_balancer, raise_on_error: false
puts "Tried to get the response code again and got #{app_response.code}"
end
end

View File

@@ -49,11 +49,12 @@ class IntegrationMainTest < IntegrationTest
test "app with roles" do
@app = "app_with_roles"
kamal :server, :bootstrap
kamal :envify
version = latest_app_version
assert_app_is_down
assert_app_is_down response_code: "502"
kamal :deploy

View File

@@ -8,13 +8,13 @@ class IntegrationProxyTest < IntegrationTest
kamal :proxy, :boot
assert_proxy_running
output = kamal :proxy, :reboot, capture: true
output = kamal :proxy, :reboot, "-y", capture: true
assert_proxy_running
assert_hooks_ran "pre-proxy-reboot", "post-proxy-reboot"
assert_match /Rebooting proxy on vm1,vm2.../, output
assert_match /Rebooted proxy on vm1,vm2/, output
output = kamal :proxy, :reboot, :"--rolling", capture: true
output = kamal :proxy, :reboot, "--rolling", "-y", capture: true
assert_proxy_running
assert_hooks_ran "pre-proxy-reboot", "post-proxy-reboot"
assert_match /Rebooting proxy on vm1.../, output
@@ -43,7 +43,7 @@ class IntegrationProxyTest < IntegrationTest
assert_proxy_running
logs = kamal :proxy, :logs, capture: true
assert_match %r["level":"INFO","msg":"Server started","http":80,"https":443], logs
assert_match %r{"level":"INFO","msg":"Server started","http":80,"https":443}, logs
kamal :proxy, :remove
assert_proxy_not_running
@@ -53,11 +53,11 @@ class IntegrationProxyTest < IntegrationTest
private
def assert_proxy_running
assert_match %r[registry:4443/dmcbreen/mproxy:latest "mproxy run"], proxy_details
assert_match %r{registry:4443/dmcbreen/mproxy:latest "mproxy run"}, proxy_details
end
def assert_proxy_not_running
refute_match %r[registry:4443/dmcbreen/mproxy:latest "mproxy run"], proxy_details
assert_no_match %r{registry:4443/dmcbreen/mproxy:latest "mproxy run"}, proxy_details
end
def proxy_details