diff --git a/lib/uplink/packages/instance/upgrade.ex b/lib/uplink/packages/instance/upgrade.ex index 6b41b8ed..8adf40e5 100644 --- a/lib/uplink/packages/instance/upgrade.ex +++ b/lib/uplink/packages/instance/upgrade.ex @@ -222,6 +222,9 @@ defmodule Uplink.Packages.Instance.Upgrade do |> Oban.insert() end + defp handle_update_config(client, _instance, %Metadata{package_size: nil}), + do: client + defp handle_update_config(client, instance, metadata) do profile_name = Packages.profile_name(metadata) size_profile_name = Packages.get_or_create_size_profile(client, metadata) diff --git a/test/fixtures/lxd/instances/update.json b/test/fixtures/lxd/instances/update.json new file mode 100644 index 00000000..3be5f682 --- /dev/null +++ b/test/fixtures/lxd/instances/update.json @@ -0,0 +1,5 @@ +{ + "status": "Success", + "status_code": 200, + "type": "sync" +} \ No newline at end of file diff --git a/test/uplink/packages/instance/upgrade_test.exs b/test/uplink/packages/instance/upgrade_test.exs index f8b2d14e..1fb82e8f 100644 --- a/test/uplink/packages/instance/upgrade_test.exs +++ b/test/uplink/packages/instance/upgrade_test.exs @@ -783,6 +783,8 @@ defmodule Uplink.Packages.Instance.UpgradeTest do } describe "upgrade instance with size profile" do + setup [:setup_base_with_package_size] + setup %{app: app, metadata: metadata} do {:ok, first_deployment} = Packages.get_or_create_deployment(app, @first_deployment) @@ -871,6 +873,19 @@ defmodule Uplink.Packages.Instance.UpgradeTest do end ) + update_instance = File.read!("test/fixtures/lxd/instances/update.json") + + Bypass.expect_once( + bypass, + "PATCH", + "/1.0/instances/#{instance_slug}", + fn conn -> + conn + |> Plug.Conn.put_resp_header("content-type", "application/json") + |> Plug.Conn.resp(200, update_instance) + end + ) + Bypass.expect_once( bypass, "POST",