Skip to content

Commit 8057d3d

Browse files
author
Adriano Santos
committed
chore: adjustments in interop script and formatting
1 parent 662f7c4 commit 8057d3d

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

interop/.formatter.exs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
[
22
inputs: [
33
"{mix,.formatter}.exs",
4-
"{config,lib,test,src}/**/*.{ex,exs}"
4+
"{config,lib,test,src,script}/**/*.{ex,exs}"
55
],
6-
import_deps: [:grpc_core, :protobuf],
7-
locals_without_parens: [rpc: 3, intercept: 1, intercept: 2, run: 1, run: 2],
8-
export: [
9-
locals_without_parens: [rpc: 3, intercept: 1, intercept: 2, run: 1, run: 2]
10-
]
6+
import_deps: [:grpc_core, :protobuf]
117
]

interop/lib/interop/endpoint.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
defmodule Interop.Endpoint do
22
use GRPC.Endpoint
33

4-
run Interop.Server
4+
run(Interop.Server)
55
end

interop/mix.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ defmodule Interop.MixProject do
2222

2323
defp deps do
2424
[
25-
{:grpc_server, path: "..", override: true},
26-
{:grpc_client, path: "../../grpc_client", override: true},
25+
{:grpc_server, path: "../grpc_server", override: true},
26+
{:grpc_client, path: "../grpc_client", override: true},
2727
{:protobuf, "~> 0.14"},
2828
{:grpc_statsd, "~> 0.1.0"},
2929
{:statix, ">= 1.2.1"},

interop/script/run.exs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
{options, _, _} = OptionParser.parse(System.argv(), strict: [rounds: :integer, concurrency: :integer, port: :integer, level: :string])
1+
{options, _, _} =
2+
OptionParser.parse(System.argv(),
3+
strict: [rounds: :integer, concurrency: :integer, port: :integer, level: :string]
4+
)
5+
26
rounds = Keyword.get(options, :rounds) || 20
37
max_concurrency = System.schedulers_online()
48
concurrency = Keyword.get(options, :concurrency) || max_concurrency
@@ -24,7 +28,6 @@ defmodule InteropTestRunner do
2428
ch = Client.connect("127.0.0.1:#{port}", opts)
2529

2630
for round <- 1..rounds do
27-
2831
Client.empty_unary!(ch)
2932
Client.cacheable_unary!(ch)
3033
Client.large_unary!(ch)
@@ -46,20 +49,27 @@ defmodule InteropTestRunner do
4649

4750
IO.inspect(round, label: "Round #{round} --------------------------------")
4851
end
52+
4953
:ok
5054
end
5155
end
5256

57+
res = DynamicSupervisor.start_link(strategy: :one_for_one, name: GRPC.Client.Supervisor)
58+
5359
{:ok, _pid} =
54-
DynamicSupervisor.start_link(
55-
strategy: :one_for_one,
56-
name: GRPC.Client.Supervisor
57-
)
60+
case res do
61+
{:ok, pid} ->
62+
{:ok, pid}
63+
64+
{:error, {:already_started, pid}} ->
65+
{:ok, pid}
66+
end
5867

5968
for adapter <- [Gun, Mint] do
6069
Logger.info("Starting run for adapter: #{adapter}")
6170
args = [adapter, port, rounds]
6271
stream_opts = [max_concurrency: concurrency, ordered: false, timeout: :infinity]
72+
6373
1..concurrency
6474
|> Task.async_stream(InteropTestRunner, :run, args, stream_opts)
6575
|> Enum.to_list()

0 commit comments

Comments
 (0)