• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mruoss / kompost / bf7b407df487178ba9b793a13ed30727a6359fb6

21 Apr 2024 05:01PM UTC coverage: 61.483% (+0.9%) from 60.579%
bf7b407df487178ba9b793a13ed30727a6359fb6

push

github

mruoss
chore(deps): update dependency bandit to ~> 1.5.0

340 of 553 relevant lines covered (61.48%)

7.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/lib/kompost/kompo/temporal/controller/api_server_controller.ex
1
defmodule Kompost.Kompo.Temporal.Controller.APIServerController do
2
  use Bonny.ControllerV2
3

4
  require Logger
5

6
  alias Kompost.Kompo.Temporal.Conn
7

8
  step Bonny.Pluggable.SkipObservedGenerations
9

10
  step Kompost.Pluggable.InitConditions, conditions: ["Connected"]
11
  step :handle_event
12

13
  @spec handle_event(Bonny.Axn.t(), Keyword.t()) :: Bonny.Axn.t()
14
  def handle_event(%Bonny.Axn{action: action} = axn, _opts)
15
      when action in [:add, :modify, :reconcile] do
16
    id = Conn.get_id(axn.resource)
4✔
17
    addr = "#{axn.resource["spec"]["host"]}:#{axn.resource["spec"]["port"]}"
4✔
18

19
    case Conn.connect(id, addr) do
4✔
20
      {:ok, _} ->
21
        axn
22
        |> success_event(message: "gRPC connection to Temporal established successfully.")
23
        |> set_condition(
3✔
24
          "Connected",
25
          true,
26
          "gRPC connection to Temporal established successfully."
27
        )
28

29
      {:error, reason} ->
30
        message = "Could not connect to Temporal cluster: #{reason}"
1✔
31
        Logger.warning("#{axn.action} failed. #{message}")
1✔
32

33
        axn
34
        |> failure_event(message: message)
35
        |> set_condition("Connected", false, message)
1✔
36
    end
37
  end
38

39
  def handle_event(%Bonny.Axn{action: :delete} = axn, _opts) do
40
    axn.resource
4✔
41
    |> Conn.get_id()
42
    |> Conn.disconnect()
4✔
43

44
    success_event(axn)
4✔
45
  end
46
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc