Skip to content

Commit

Permalink
Drop autospawn behavior (#1379)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino authored Sep 14, 2024
1 parent 08ca210 commit aa2d4f9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
10 changes: 5 additions & 5 deletions lib/console/deployments/stacks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ defmodule Console.Deployments.Stacks do
end)
|> when_ok(:update)
end)
|> add_operation(:run, fn
%{stack: %Stack{runnable: true} = stack} ->
trigger_run(stack.id, user)
_ -> {:ok, nil}
end)
# |> add_operation(:run, fn
# %{stack: %Stack{runnable: true} = stack} ->
# trigger_run(stack.id, user)
# _ -> {:ok, nil}
# end)
|> execute(extract: :stack)
|> notify(:update, user)
end
Expand Down
46 changes: 23 additions & 23 deletions test/console/deployments/stacks_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -144,29 +144,29 @@ defmodule Console.Deployments.StacksTest do
assert_receive {:event, %PubSub.StackUpdated{item: ^stack}}
end

test "if it makes a meaningful change, a run will be auto-created" do
user = insert(:user)
stack = insert(:stack, write_bindings: [%{user_id: user.id}])
expect(Discovery, :sha, fn _, _ -> {:ok, "new-sha"} end)
expect(Discovery, :changes, fn _, _, _, _ -> {:ok, ["new-folder/main.tf"], "a commit message"} end)

{:ok, stack} = Stacks.update_stack(%{
name: "my-stack",
type: :terraform,
approval: true,
git: %{ref: "main", folder: "new-folder"},
}, stack.id, user)

assert stack.name == "my-stack"
assert stack.type == :terraform
assert stack.approval
assert stack.git.ref == "main"
assert stack.git.folder == "new-folder"

[_] = StackRun.for_stack(stack.id) |> Console.Repo.all()

assert_receive {:event, %PubSub.StackUpdated{item: ^stack}}
end
# test "if it makes a meaningful change, a run will be auto-created" do
# user = insert(:user)
# stack = insert(:stack, write_bindings: [%{user_id: user.id}])
# expect(Discovery, :sha, fn _, _ -> {:ok, "new-sha"} end)
# expect(Discovery, :changes, fn _, _, _, _ -> {:ok, ["new-folder/main.tf"], "a commit message"} end)

# {:ok, stack} = Stacks.update_stack(%{
# name: "my-stack",
# type: :terraform,
# approval: true,
# git: %{ref: "main", folder: "new-folder"},
# }, stack.id, user)

# assert stack.name == "my-stack"
# assert stack.type == :terraform
# assert stack.approval
# assert stack.git.ref == "main"
# assert stack.git.folder == "new-folder"

# [_] = StackRun.for_stack(stack.id) |> Console.Repo.all()

# assert_receive {:event, %PubSub.StackUpdated{item: ^stack}}
# end

test "you can update bindings" do
user = admin_user()
Expand Down

0 comments on commit aa2d4f9

Please sign in to comment.