Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

elixir: fix tests

+17 -198
+1
apps/sower/mix.exs
··· 40 40 {:faker, "~> 0.18", only: :test}, 41 41 {:finch, "~> 0.13"}, 42 42 {:floki, ">= 0.30.0", only: :test}, 43 + {:lazy_html, ">= 0.1.0", only: :test}, 43 44 {:gettext, "~> 1.0"}, 44 45 {:jason, "~> 1.2"}, 45 46 {:joken, "~> 2.6.1"},
-40
apps/sower/test/sower_web/live/agent_live_test.exs
··· 1 - defmodule SowerWeb.AgentLiveTest do 2 - use SowerWeb.ConnCase 3 - 4 - import Phoenix.LiveViewTest 5 - import Sower.OrchestrationFixtures 6 - 7 - defp create_agent(%{user: %{org_id: org_id}}) do 8 - agent = agent_fixture(%{org_id: org_id}) 9 - %{agent: agent} 10 - end 11 - 12 - describe "Index" do 13 - setup [:register_and_log_in_user, :create_agent] 14 - 15 - test "lists all agents", %{conn: conn, agent: agent} do 16 - {:ok, _index_live, html} = live(conn, ~p"/agents") 17 - 18 - assert html =~ "Listing Agents" 19 - assert html =~ agent.sid 20 - end 21 - 22 - test "deletes agent in listing", %{conn: conn, agent: agent} do 23 - {:ok, index_live, _html} = live(conn, ~p"/agents") 24 - 25 - assert index_live |> element("#agents-#{agent.id} a", "Delete") |> render_click() 26 - refute has_element?(index_live, "#agents-#{agent.id}") 27 - end 28 - end 29 - 30 - describe "Show" do 31 - setup [:register_and_log_in_user, :create_agent] 32 - 33 - test "displays agent", %{conn: conn, agent: agent} do 34 - {:ok, _show_live, html} = live(conn, ~p"/agents/#{agent}") 35 - 36 - assert html =~ "Show Agent" 37 - assert html =~ agent.sid 38 - end 39 - end 40 - end
-122
apps/sower/test/sower_web/live/deployment_live_test.exs
··· 1 - defmodule SowerWeb.DeploymentLiveTest do 2 - use SowerWeb.ConnCase 3 - 4 - import Phoenix.LiveViewTest 5 - import Sower.OrchestrationFixtures 6 - 7 - @create_attrs %{seed_name: "some seed_name", seed_type: "some seed_type"} 8 - @update_attrs %{seed_name: "some updated seed_name", seed_type: "some updated seed_type"} 9 - @invalid_attrs %{seed_name: nil, seed_type: nil} 10 - defp create_deployment(_) do 11 - deployment = deployment_fixture() 12 - 13 - %{deployment: deployment} 14 - end 15 - 16 - describe "Index" do 17 - setup [:create_deployment] 18 - 19 - test "lists all deployments", %{conn: conn, deployment: deployment} do 20 - {:ok, _index_live, html} = live(conn, ~p"/deployments") 21 - 22 - assert html =~ "Listing Deployments" 23 - assert html =~ deployment.seed_name 24 - end 25 - 26 - test "saves new deployment", %{conn: conn} do 27 - {:ok, index_live, _html} = live(conn, ~p"/deployments") 28 - 29 - assert {:ok, form_live, _} = 30 - index_live 31 - |> element("a", "New Deployment") 32 - |> render_click() 33 - |> follow_redirect(conn, ~p"/deployments/new") 34 - 35 - assert render(form_live) =~ "New Deployment" 36 - 37 - assert form_live 38 - |> form("#deployment-form", deployment: @invalid_attrs) 39 - |> render_change() =~ "can't be blank" 40 - 41 - assert {:ok, index_live, _html} = 42 - form_live 43 - |> form("#deployment-form", deployment: @create_attrs) 44 - |> render_submit() 45 - |> follow_redirect(conn, ~p"/deployments") 46 - 47 - html = render(index_live) 48 - assert html =~ "Deployment created successfully" 49 - assert html =~ "some seed_name" 50 - end 51 - 52 - test "updates deployment in listing", %{conn: conn, deployment: deployment} do 53 - {:ok, index_live, _html} = live(conn, ~p"/deployments") 54 - 55 - assert {:ok, form_live, _html} = 56 - index_live 57 - |> element("#deployments-#{deployment.id} a", "Edit") 58 - |> render_click() 59 - |> follow_redirect(conn, ~p"/deployments/#{deployment}/edit") 60 - 61 - assert render(form_live) =~ "Edit Deployment" 62 - 63 - assert form_live 64 - |> form("#deployment-form", deployment: @invalid_attrs) 65 - |> render_change() =~ "can't be blank" 66 - 67 - assert {:ok, index_live, _html} = 68 - form_live 69 - |> form("#deployment-form", deployment: @update_attrs) 70 - |> render_submit() 71 - |> follow_redirect(conn, ~p"/deployments") 72 - 73 - html = render(index_live) 74 - assert html =~ "Deployment updated successfully" 75 - assert html =~ "some updated seed_name" 76 - end 77 - 78 - test "deletes deployment in listing", %{conn: conn, deployment: deployment} do 79 - {:ok, index_live, _html} = live(conn, ~p"/deployments") 80 - 81 - assert index_live |> element("#deployments-#{deployment.id} a", "Delete") |> render_click() 82 - refute has_element?(index_live, "#deployments-#{deployment.id}") 83 - end 84 - end 85 - 86 - describe "Show" do 87 - setup [:create_deployment] 88 - 89 - test "displays deployment", %{conn: conn, deployment: deployment} do 90 - {:ok, _show_live, html} = live(conn, ~p"/deployments/#{deployment}") 91 - 92 - assert html =~ "Show Deployment" 93 - assert html =~ deployment.seed_name 94 - end 95 - 96 - test "updates deployment and returns to show", %{conn: conn, deployment: deployment} do 97 - {:ok, show_live, _html} = live(conn, ~p"/deployments/#{deployment}") 98 - 99 - assert {:ok, form_live, _} = 100 - show_live 101 - |> element("a", "Edit") 102 - |> render_click() 103 - |> follow_redirect(conn, ~p"/deployments/#{deployment}/edit?return_to=show") 104 - 105 - assert render(form_live) =~ "Edit Deployment" 106 - 107 - assert form_live 108 - |> form("#deployment-form", deployment: @invalid_attrs) 109 - |> render_change() =~ "can't be blank" 110 - 111 - assert {:ok, show_live, _html} = 112 - form_live 113 - |> form("#deployment-form", deployment: @update_attrs) 114 - |> render_submit() 115 - |> follow_redirect(conn, ~p"/deployments/#{deployment}") 116 - 117 - html = render(show_live) 118 - assert html =~ "Deployment updated successfully" 119 - assert html =~ "some updated seed_name" 120 - end 121 - end 122 - end
-36
apps/sower/test/sower_web/live/subscription_live_test.exs
··· 1 - defmodule SowerWeb.SubscriptionLiveTest do 2 - use SowerWeb.ConnCase 3 - 4 - import Phoenix.LiveViewTest 5 - import Sower.OrchestrationFixtures 6 - import Sower.SeedFixtures 7 - 8 - defp create_subscription(%{user: %{org_id: org_id}}) do 9 - agent = agent_fixture(%{org_id: org_id}) 10 - seed = seed_fixture() 11 - subscription = subscription_fixture(%{org_id: org_id, agent_id: agent.id, seed_id: seed.id}) 12 - %{subscription: subscription} 13 - end 14 - 15 - describe "Index" do 16 - setup [:register_and_log_in_user, :create_subscription] 17 - 18 - test "lists all subscriptions", %{conn: conn, subscription: subscription} do 19 - {:ok, _index_live, html} = live(conn, ~p"/subscriptions") 20 - 21 - assert html =~ "Listing Subscriptions" 22 - assert html =~ subscription.sid 23 - end 24 - end 25 - 26 - describe "Show" do 27 - setup [:register_and_log_in_user, :create_subscription] 28 - 29 - test "displays subscription", %{conn: conn, subscription: subscription} do 30 - {:ok, _show_live, html} = live(conn, ~p"/subscriptions/#{subscription}") 31 - 32 - assert html =~ "Show Subscription" 33 - assert html =~ subscription.sid 34 - end 35 - end 36 - end
+12
apps/sower/test/support/fixtures/orchestration_fixtures.ex
··· 31 31 32 32 subscription 33 33 end 34 + 35 + @doc """ 36 + Generate a deployment. 37 + """ 38 + def deployment_fixture(attrs \\ %{}) do 39 + {:ok, deployment} = 40 + attrs 41 + |> Enum.into(%{seeds: [], subscriptions: []}) 42 + |> Sower.Orchestration.create_deployment() 43 + 44 + deployment 45 + end 34 46 end
+4
mix.lock
··· 1 1 %{ 2 2 "argon2": {:git, "https://github.com/adamcstephens/erl_argon2.git", "699ff303d6866b0b61b73c11859fcab898a8badf", [ref: "699ff303d6866b0b61b73c11859fcab898a8badf"]}, 3 3 "bandit": {:hex, :bandit, "1.8.0", "c2e93d7e3c5c794272fa4623124f827c6f24b643acc822be64c826f9447d92fb", [:mix], [{:hpax, "~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.18", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "8458ff4eed20ff2a2ea69d4854883a077c33ea42b51f6811b044ceee0fa15422"}, 4 + "cc_precompiler": {:hex, :cc_precompiler, "0.1.11", "8c844d0b9fb98a3edea067f94f616b3f6b29b959b6b3bf25fee94ffe34364768", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "3427232caf0835f94680e5bcf082408a70b48ad68a5f5c0b02a3bea9f3a075b9"}, 4 5 "cloak": {:hex, :cloak, "1.1.4", "aba387b22ea4d80d92d38ab1890cc528b06e0e7ef2a4581d71c3fdad59e997e7", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "92b20527b9aba3d939fab0dd32ce592ff86361547cfdc87d74edce6f980eb3d7"}, 5 6 "cloak_ecto": {:hex, :cloak_ecto, "1.3.0", "0de127c857d7452ba3c3367f53fb814b0410ff9c680a8d20fbe8b9a3c57a1118", [:mix], [{:cloak, "~> 1.1.1", [hex: :cloak, repo: "hexpm", optional: false]}, {:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "314beb0c123b8a800418ca1d51065b27ba3b15f085977e65c0f7b2adab2de1cc"}, 6 7 "conv_case": {:hex, :conv_case, "0.2.3", "c1455c27d3c1ffcdd5f17f1e91f40b8a0bc0a337805a6e8302f441af17118ed8", [:mix], [], "hexpm", "88f29a3d97d1742f9865f7e394ed3da011abb7c5e8cc104e676fdef6270d4b4a"}, ··· 11 12 "dialyxir": {:hex, :dialyxir, "1.4.6", "7cca478334bf8307e968664343cbdb432ee95b4b68a9cba95bdabb0ad5bdfd9a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "8cf5615c5cd4c2da6c501faae642839c8405b49f8aa057ad4ae401cb808ef64d"}, 12 13 "ecto": {:hex, :ecto, "3.13.3", "6a983f0917f8bdc7a89e96f2bf013f220503a0da5d8623224ba987515b3f0d80", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "1927db768f53a88843ff25b6ba7946599a8ca8a055f69ad8058a1432a399af94"}, 13 14 "ecto_sql": {:hex, :ecto_sql, "3.13.2", "a07d2461d84107b3d037097c822ffdd36ed69d1cf7c0f70e12a3d1decf04e2e1", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.13.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "539274ab0ecf1a0078a6a72ef3465629e4d6018a3028095dc90f60a19c371717"}, 15 + "elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"}, 14 16 "enough": {:hex, :enough, "0.1.0", "0254710c52d324e2dadde54cb56fbb80a792c2eb285669b8379efd0752bf89f0", [:rebar3], [], "hexpm", "0460c7abda5f5e0ea592b12bc6976b8a5c4b96e42f332059cd396525374bf9a1"}, 15 17 "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, 16 18 "esbuild": {:hex, :esbuild, "0.10.0", "b0aa3388a1c23e727c5a3e7427c932d89ee791746b0081bbe56103e9ef3d291f", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "468489cda427b974a7cc9f03ace55368a83e1a7be12fba7e30969af78e5f8c70"}, ··· 21 23 "faker": {:hex, :faker, "0.18.0", "943e479319a22ea4e8e39e8e076b81c02827d9302f3d32726c5bf82f430e6e14", [:mix], [], "hexpm", "bfbdd83958d78e2788e99ec9317c4816e651ad05e24cfd1196ce5db5b3e81797"}, 22 24 "file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"}, 23 25 "finch": {:hex, :finch, "0.20.0", "5330aefb6b010f424dcbbc4615d914e9e3deae40095e73ab0c1bb0968933cadf", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2658131a74d051aabfcba936093c903b8e89da9a1b63e430bee62045fa9b2ee2"}, 26 + "fine": {:hex, :fine, "0.1.4", "b19a89c1476c7c57afb5f9314aed5960b5bc95d5277de4cb5ee8e1d1616ce379", [:mix], [], "hexpm", "be3324cc454a42d80951cf6023b9954e9ff27c6daa255483b3e8d608670303f5"}, 24 27 "floki": {:hex, :floki, "0.38.0", "62b642386fa3f2f90713f6e231da0fa3256e41ef1089f83b6ceac7a3fd3abf33", [:mix], [], "hexpm", "a5943ee91e93fb2d635b612caf5508e36d37548e84928463ef9dd986f0d1abd9"}, 25 28 "gettext": {:hex, :gettext, "1.0.0", "f8853ecb33e96361288f6239fafcfd50214b0a88ec38b5e452138d815d4877d8", [:mix], [{:expo, "~> 0.5.1 or ~> 1.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "cc8196640756894a4fd75606067bed41a9863c0db09d6d6cc576e6170cffaa74"}, 26 29 "glob_ex": {:hex, :glob_ex, "0.1.11", "cb50d3f1ef53f6ca04d6252c7fde09fd7a1cf63387714fe96f340a1349e62c93", [:mix], [], "hexpm", "342729363056e3145e61766b416769984c329e4378f1d558b63e341020525de4"}, ··· 29 32 "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, 30 33 "joken": {:hex, :joken, "2.6.2", "5daaf82259ca603af4f0b065475099ada1b2b849ff140ccd37f4b6828ca6892a", [:mix], [{:jose, "~> 1.11.10", [hex: :jose, repo: "hexpm", optional: false]}], "hexpm", "5134b5b0a6e37494e46dbf9e4dad53808e5e787904b7c73972651b51cce3d72b"}, 31 34 "jose": {:hex, :jose, "1.11.10", "a903f5227417bd2a08c8a00a0cbcc458118be84480955e8d251297a425723f83", [:mix, :rebar3], [], "hexpm", "0d6cd36ff8ba174db29148fc112b5842186b68a90ce9fc2b3ec3afe76593e614"}, 35 + "lazy_html": {:hex, :lazy_html, "0.1.8", "677a8642e644eef8de98f3040e2520d42d0f0f8bd6c5cd49db36504e34dffe91", [:make, :mix], [{:cc_precompiler, "~> 0.1", [hex: :cc_precompiler, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.9.0", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:fine, "~> 0.1.0", [hex: :fine, repo: "hexpm", optional: false]}], "hexpm", "0d8167d930b704feb94b41414ca7f5779dff9bca7fcf619fcef18de138f08736"}, 32 36 "libcluster": {:hex, :libcluster, "3.3.3", "a4f17721a19004cfc4467268e17cff8b1f951befe428975dd4f6f7b84d927fe0", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "7c0a2275a0bb83c07acd17dab3c3bfb4897b145106750eeccc62d302e3bdfee5"}, 33 37 "libcluster_consul": {:hex, :libcluster_consul, "1.3.0", "114c8a2d4fdcf3331cf96c42048d79eb3d3ffa2a6c983f68eb215e0717fe2f00", [:mix], [{:libcluster, "~> 3.3.1", [hex: :libcluster, repo: "hexpm", optional: false]}], "hexpm", "fb63bc580f931a5af041c582a565df52bca3c8005c2ada13cce71647e674da25"}, 34 38 "mime": {:hex, :mime, "2.0.7", "b8d739037be7cd402aee1ba0306edfdef982687ee7e9859bee6198c1e7e2f128", [:mix], [], "hexpm", "6171188e399ee16023ffc5b76ce445eb6d9672e2e241d2df6050f3c771e80ccd"},