Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed kamal-proxy remove command #988

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/kamal/cli/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def stop
version = capture_with_info(*app.current_running_version, raise_on_non_zero_exit: false).strip
endpoint = capture_with_info(*app.container_id_for_version(version)).strip
if endpoint.present?
execute *app.remove(target: endpoint), raise_on_non_zero_exit: false
execute *app.remove, raise_on_non_zero_exit: false
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/kamal/commands/app/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def deploy(target:)
proxy_exec :deploy, role.container_prefix, *role.proxy.deploy_command_args(target: target)
end

def remove(target:)
proxy_exec :remove, role.container_prefix, *role.proxy.remove_command_args(target: target)
def remove
proxy_exec :remove, role.container_prefix
end

private
Expand Down
4 changes: 0 additions & 4 deletions lib/kamal/configuration/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ def deploy_command_args(target:)
optionize ({ target: "#{target}:#{app_port}" }).merge(deploy_options)
end

def remove_command_args(target:)
optionize({ target: "#{target}:#{app_port}" })
end

def merge(other)
self.class.new config: config, proxy_config: proxy_config.deep_merge(other.proxy_config)
end
Expand Down
4 changes: 2 additions & 2 deletions test/commands/app_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ class CommandsAppTest < ActiveSupport::TestCase

test "remove" do
assert_equal \
"docker exec kamal-proxy kamal-proxy remove app-web --target \"172.1.0.2:80\"",
new_command.remove(target: "172.1.0.2").join(" ")
"docker exec kamal-proxy kamal-proxy remove app-web",
new_command.remove.join(" ")
end


Expand Down
4 changes: 2 additions & 2 deletions test/integration/app_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AppTest < IntegrationTest

kamal :app, :stop

assert_app_is_down
assert_app_not_found

kamal :app, :start

Expand Down Expand Up @@ -48,7 +48,7 @@ class AppTest < IntegrationTest

kamal :app, :remove

assert_app_is_down
assert_app_not_found
assert_app_directory_removed
end
end
6 changes: 6 additions & 0 deletions test/integration/integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ def assert_app_is_down
assert_equal "502", response.code
end

def assert_app_not_found
response = app_response
debug_response_code(response, "404")
assert_equal "404", response.code
end

def assert_app_is_up(version: nil, app: @app)
response = app_response(app: app)
debug_response_code(response, "200")
Expand Down
Loading