Skip to content

Commit

Permalink
fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
eliasdarruda committed Jan 24, 2025
1 parent b5ca925 commit e9ee426
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 30 deletions.
20 changes: 10 additions & 10 deletions lib/sidecar/grpc/code_generator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ defmodule Sidecar.GRPC.CodeGenerator do
svcs = :persistent_term.get(:proto_file_descriptors, [])
current_services = :persistent_term.get(:grpc_services, [])

Check warning on line 89 in lib/sidecar/grpc/code_generator.ex

View workflow job for this annotation

GitHub Actions / Build and Test OTP 25 / Elixir 1.15

variable "current_services" is unused (if the variable is not meant to be used, prefix it with an underscore)

dispatchers =
current_services
|> Enum.reduce("", fn svc, acc -> "#{svc}.ActorDispatcher,\n#{acc}" end)

reflections =
current_services
|> Enum.reduce("", fn svc, acc -> "#{svc}.Service,\n#{acc}" end)

compile_proxy_endpoint(dispatchers)
compile_reflections(reflections)
# dispatchers =
# current_services
# |> Enum.reduce("", fn svc, acc -> "#{svc}.ActorDispatcher,\n#{acc}" end)
#
# reflections =
# current_services
# |> Enum.reduce("", fn svc, acc -> "#{svc}.Service,\n#{acc}" end)

# compile_proxy_endpoint(dispatchers)
# compile_reflections(reflections)
put_actor_definition_settings(svcs)

:persistent_term.erase(:proto_file_descriptors)
Expand Down
13 changes: 7 additions & 6 deletions lib/sidecar/grpc/supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ defmodule Sidecar.GRPC.Supervisor do

defp maybe_start_reflection(children, true) do
Logger.info("Starting gRPC Reflection...")
(children ++ [{GrpcReflection, []}]) |> List.flatten()
children |> List.flatten()
end

defp maybe_start_grpc_server(children, false), do: children
Expand All @@ -55,11 +55,12 @@ defmodule Sidecar.GRPC.Supervisor do
port = Config.get(:grpc_port)
Logger.debug("Starting gRPC Server on port #{inspect(port)}...")

(children ++
[
{GRPC.Server.Supervisor,
endpoint: Sidecar.GRPC.ProxyEndpoint, port: port, start_server: true}
])
# ++
children
# [
# {GRPC.Server.Supervisor,
# endpoint: Sidecar.GRPC.ProxyEndpoint, port: port, start_server: true}
# ])
|> List.flatten()
end

Expand Down
2 changes: 1 addition & 1 deletion lib/spawn/cluster/cluster_resolver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ defmodule Spawn.Cluster.ClusterResolver do

IO.inspect(app_name, label: "Using application name ---------------------")
IO.inspect(service, label: "Using service ---------------------")
IO.inspect(resolver, label: "Using resolver ---------------------")
IO.inspect(resolver, label: "Using resolver ---------------------")
IO.inspect(Node.get_cookie(), label: "Using node cookie ---------------------")

cond do
Expand Down
10 changes: 3 additions & 7 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ defmodule Spawn.MixProject do
{:protobuf, "~> 0.14"},
{:protobuf_generate, "~> 0.1"},
{:grpc, "~> 0.8"},
{:grpc_reflection, "~> 0.1"},
{:finch, "~> 0.18"},
{:flame_k8s_backend, "~> 0.5"},
{:retry, "~> 0.17"},
Expand Down Expand Up @@ -106,12 +105,9 @@ defmodule Spawn.MixProject do
{:opentelemetry_ecto, "~> 1.2"},
{:opentelemetry_exporter, "~> 1.0"},
# Statestores deps
{:spawn_statestores_mariadb,
path: "./spawn_statestores/statestores_mariadb", optional: false},
{:spawn_statestores_postgres,
path: "./spawn_statestores/statestores_postgres", optional: false},
{:spawn_statestores_native,
path: "./spawn_statestores/statestores_native", optional: false},
{:spawn_statestores_mariadb, "2.0.0-RC9", optional: true},
{:spawn_statestores_postgres, "2.0.0-RC9", optional: true},
{:spawn_statestores_native, "2.0.0-RC9", optional: true},
{:pluggable, "~> 1.0"},
# Non runtime deps
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
Expand Down
6 changes: 4 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@
"flow": {:hex, :flow, "1.2.4", "1dd58918287eb286656008777cb32714b5123d3855956f29aa141ebae456922d", [:mix], [{:gen_stage, "~> 1.0", [hex: :gen_stage, repo: "hexpm", optional: false]}], "hexpm", "874adde96368e71870f3510b91e35bc31652291858c86c0e75359cbdd35eb211"},
"gen_stage": {:hex, :gen_stage, "1.2.1", "19d8b5e9a5996d813b8245338a28246307fd8b9c99d1237de199d21efc4c76a1", [:mix], [], "hexpm", "83e8be657fa05b992ffa6ac1e3af6d57aa50aace8f691fcf696ff02f8335b001"},
"gnat": {:hex, :gnat, "1.9.1", "7fd16d40ba927cc88256fae2a8a96089d4e017f3bf7fb83e2e6f5093893b7461", [:mix], [{:connection, "~> 1.1", [hex: :connection, repo: "hexpm", optional: false]}, {:cowlib, "~> 2.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:nkeys, "~> 0.2", [hex: :nkeys, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e49eb63c2bbc57b099dd2a5ef602963d395fa2790968054ba9d24dd1390e0ab5"},
"google_protos": {:hex, :google_protos, "0.4.0", "93e1be2c1a07517ffed761f69047776caf35e4acd385aac4f5ce4fedd07f3660", [:mix], [{:protobuf, "~> 0.10", [hex: :protobuf, repo: "hexpm", optional: false]}], "hexpm", "4c54983d78761a3643e2198adf0f5d40a5a8b08162f3fc91c50faa257f3fa19f"},
"gproc": {:hex, :gproc, "0.9.1", "f1df0364423539cf0b80e8201c8b1839e229e5f9b3ccb944c5834626998f5b8c", [:rebar3], [], "hexpm", "905088e32e72127ed9466f0bac0d8e65704ca5e73ee5a62cb073c3117916d507"},
"grpc": {:hex, :grpc, "0.9.0", "1b930a57272d4356ea65969b984c2eb04f3dab81420e1e28f0e6ec04b8f88515", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:cowboy, "~> 2.10", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowlib, "~> 2.12", [hex: :cowlib, repo: "hexpm", optional: false]}, {:gun, "~> 2.0", [hex: :gun, repo: "hexpm", optional: false]}, {:jason, ">= 0.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mint, "~> 1.5", [hex: :mint, repo: "hexpm", optional: false]}, {:protobuf, "~> 0.11", [hex: :protobuf, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7c059698248738fcf7ad551f1d78f4a3d2e0642a72a5834f2a0b0db4b9f3d2b5"},
"grpc_reflection": {:hex, :grpc_reflection, "0.1.4", "0b3542801ff7078e53dc5dee3d79205f3b8d1fec391c6e890926a182f83d09e0", [:mix], [{:google_protos, "~> 0.4.0", [hex: :google_protos, repo: "hexpm", optional: false]}, {:grpc, "~> 0.7", [hex: :grpc, repo: "hexpm", optional: false]}, {:protobuf, "~> 0.11", [hex: :protobuf, repo: "hexpm", optional: false]}], "hexpm", "74a6148335305926b166a58c8e040f64501410d744be55ebe343a704003e994a"},
"grpcbox": {:hex, :grpcbox, "0.17.1", "6e040ab3ef16fe699ffb513b0ef8e2e896da7b18931a1ef817143037c454bcce", [:rebar3], [{:acceptor_pool, "~> 1.0.0", [hex: :acceptor_pool, repo: "hexpm", optional: false]}, {:chatterbox, "~> 0.15.1", [hex: :ts_chatterbox, repo: "hexpm", optional: false]}, {:ctx, "~> 0.6.0", [hex: :ctx, repo: "hexpm", optional: false]}, {:gproc, "~> 0.9.1", [hex: :gproc, repo: "hexpm", optional: false]}], "hexpm", "4a3b5d7111daabc569dc9cbd9b202a3237d81c80bf97212fbc676832cb0ceb17"},
"gun": {:hex, :gun, "2.1.0", "b4e4cbbf3026d21981c447e9e7ca856766046eff693720ba43114d7f5de36e87", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "52fc7fc246bfc3b00e01aea1c2854c70a366348574ab50c57dfe796d24a0101d"},
"highlander": {:hex, :highlander, "0.2.1", "e59b459f857e89daf73f2598bf2b2c0479a435481e6101ea389fd3625919b052", [:mix], [], "hexpm", "5ba19a18358803d82a923511acec8ee85fac30731c5ca056f2f934bc3d3afd9a"},
Expand Down Expand Up @@ -89,6 +87,10 @@
"salsa20": {:hex, :salsa20, "1.0.4", "404cbea1fa8e68a41bcc834c0a2571ac175580fec01cc38cc70c0fb9ffc87e9b", [:mix], [], "hexpm", "745ddcd8cfa563ddb0fd61e7ce48d5146279a2cf7834e1da8441b369fdc58ac6"},
"shards": {:hex, :shards, "1.1.1", "8b42323457d185b26b15d05187784ce6c5d1e181b35c46fca36c45f661defe02", [:make, :rebar3], [], "hexpm", "169a045dae6668cda15fbf86d31bf433d0dbbaec42c8c23ca4f8f2d405ea8eda"},
"sobelow": {:hex, :sobelow, "0.13.0", "218afe9075904793f5c64b8837cc356e493d88fddde126a463839351870b8d1e", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "cd6e9026b85fc35d7529da14f95e85a078d9dd1907a9097b3ba6ac7ebbe34a0d"},
"spawn_statestores": {:hex, :spawn_statestores, "2.0.0-RC9", "426206b79aa855fb5a696afdc72708e63be07a99dcc01a43cfd5ede82f8aaaa5", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:cloak_ecto, "~> 1.2", [hex: :cloak_ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.12", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.3", [hex: :jason, repo: "hexpm", optional: false]}, {:protobuf, "~> 0.14", [hex: :protobuf, repo: "hexpm", optional: false]}], "hexpm", "fc3277e9f3c2135c843382e2df0180881edb4301783f71ab3d4b28a6be18ec64"},
"spawn_statestores_mariadb": {:hex, :spawn_statestores_mariadb, "2.0.0-RC9", "ac426e191ec4f1dad5d1583902779ab58014af2ad0f316b480be6851dd192311", [:mix], [{:cloak_ecto, "~> 1.2", [hex: :cloak_ecto, repo: "hexpm", optional: false]}, {:ecto_mysql_extras, "~> 0.6.3", [hex: :ecto_mysql_extras, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.12", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6", [hex: :myxql, repo: "hexpm", optional: false]}, {:spawn_statestores, "2.0.0-RC9", [hex: :spawn_statestores, repo: "hexpm", optional: false]}], "hexpm", "34a3f93b1edff1c069d2cff0571b964428a628e44fae1b1bae06781728e65d9e"},
"spawn_statestores_native": {:hex, :spawn_statestores_native, "2.0.0-RC9", "92fa03eb0dcd6648551e3de66118302c92d775a3d90881fb2179cc4b00441eac", [:mix], [{:mnesiac, "~> 0.3", [hex: :mnesiac, repo: "hexpm", optional: false]}, {:spawn_statestores, "2.0.0-RC9", [hex: :spawn_statestores, repo: "hexpm", optional: false]}], "hexpm", "784c4b5f69f7fed5396a8806a4bfb3bbb06e5417cb49f059f7b0f2cbbd747b8e"},
"spawn_statestores_postgres": {:hex, :spawn_statestores_postgres, "2.0.0-RC9", "13f9db8f6d3fcc756ac92c5e7f93ad8be269ca95370e6bd474bfc0fcd55bbe2d", [:mix], [{:cloak_ecto, "~> 1.2", [hex: :cloak_ecto, repo: "hexpm", optional: false]}, {:ecto_psql_extras, "~> 0.8", [hex: :ecto_psql_extras, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.12", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.17", [hex: :postgrex, repo: "hexpm", optional: false]}, {:spawn_statestores, "2.0.0-RC9", [hex: :spawn_statestores, repo: "hexpm", optional: false]}], "hexpm", "0c7a02576a419d1733aa6b3dcd38315b758696890a9492fd346234782451113d"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"},
"table_rex": {:hex, :table_rex, "4.0.0", "3c613a68ebdc6d4d1e731bc973c233500974ec3993c99fcdabb210407b90959b", [:mix], [], "hexpm", "c35c4d5612ca49ebb0344ea10387da4d2afe278387d4019e4d8111e815df8f55"},
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule SpawnOperator.K8sConn do

@spec get(atom()) :: K8s.Conn.t()
def get(:dev) do
{:ok, conn} = K8s.Conn.from_file("~/.kube/config", context: "minikube")
{:ok, conn} = K8s.Conn.from_file("~/.kube/config", context: "k3d-k3s-default")
struct!(conn, insecure_skip_tls_verify: true)
end

Expand Down
4 changes: 1 addition & 3 deletions spawn_sdk/spawn_sdk/test/actor/actor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,12 @@ defmodule Actor.ActorTest do

dynamic_actor_name = "#{inspect(make_ref())}" <> "simple_error"

assert {:ok, response} =
assert {:error, _response} =
SpawnSdk.invoke(dynamic_actor_name,
ref: "my_actor_ref",
system: system,
action: "test_error"
)

assert {:error, _} = response
end

test "simple call that goes through 3 actors piping each other", ctx do
Expand Down

0 comments on commit e9ee426

Please sign in to comment.