Skip to content

Commit

Permalink
Finalize now sends hash
Browse files Browse the repository at this point in the history
  • Loading branch information
zacksiri committed Oct 7, 2024
1 parent e50b2e6 commit 675c458
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/uplink/packages/instance/finalize.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ defmodule Uplink.Packages.Instance.Finalize do
node = Map.get(instance_params, "node", %{})

transition_parameters =
Map.put(@transition_parameters, "node", node["slug"])
@transition_parameters
|> Map.put("node", node["slug"])
|> Map.put("hash", install.deployment.hash)

Instellar.transition_instance(name, install, "complete",
comment: comment,
Expand Down
4 changes: 3 additions & 1 deletion test/uplink/packages/instance/finalize_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ defmodule Uplink.Packages.Instance.FinalizeTest do
assert {:ok, body, conn} = Plug.Conn.read_body(conn)
assert {:ok, body} = Jason.decode(body)

%{"event" => %{"name" => event_name}} = body
%{"event" => %{"name" => event_name, "parameters" => %{"hash" => hash}}} = body

assert hash == "some-hash"

assert event_name in ["complete"]

Expand Down

0 comments on commit 675c458

Please sign in to comment.