@@ -30,16 +30,6 @@ defmodule Realtime.PromEx.Plugins.TenantsTest do
3030 % { tenant: random_string ( ) }
3131 end
3232
33- test "success" , % { tenant: tenant } do
34- metric = "realtime_rpc_count"
35- # Enough time for the poll rate to be triggered at least once
36- Process . sleep ( 200 )
37- previous_value = metric_value ( metric , mechanism: "erpc" , success: true , tenant: tenant ) || 0
38- assert { :ok , "success" } = Rpc . enhanced_call ( node ( ) , Test , :success , [ ] , tenant_id: tenant )
39- Process . sleep ( 200 )
40- assert metric_value ( metric , mechanism: "erpc" , success: true , tenant: tenant ) == previous_value + 1
41- end
42-
4333 test "global success" , % { tenant: tenant } do
4434 metric = "realtime_global_rpc_count"
4535 # Enough time for the poll rate to be triggered at least once
@@ -50,16 +40,6 @@ defmodule Realtime.PromEx.Plugins.TenantsTest do
5040 assert metric_value ( metric , mechanism: "erpc" , success: true ) == previous_value + 1
5141 end
5242
53- test "failure" , % { tenant: tenant } do
54- metric = "realtime_rpc_count"
55- # Enough time for the poll rate to be triggered at least once
56- Process . sleep ( 200 )
57- previous_value = metric_value ( metric , mechanism: "erpc" , success: false , tenant: tenant ) || 0
58- assert { :error , "failure" } = Rpc . enhanced_call ( node ( ) , Test , :failure , [ ] , tenant_id: tenant )
59- Process . sleep ( 200 )
60- assert metric_value ( metric , mechanism: "erpc" , success: false , tenant: tenant ) == previous_value + 1
61- end
62-
6343 test "global failure" , % { tenant: tenant } do
6444 metric = "realtime_global_rpc_count"
6545 # Enough time for the poll rate to be triggered at least once
@@ -70,19 +50,6 @@ defmodule Realtime.PromEx.Plugins.TenantsTest do
7050 assert metric_value ( metric , mechanism: "erpc" , success: false ) == previous_value + 1
7151 end
7252
73- test "exception" , % { tenant: tenant } do
74- metric = "realtime_rpc_count"
75- # Enough time for the poll rate to be triggered at least once
76- Process . sleep ( 200 )
77- previous_value = metric_value ( metric , mechanism: "erpc" , success: false , tenant: tenant ) || 0
78-
79- assert { :error , :rpc_error , % RuntimeError { message: "runtime error" } } =
80- Rpc . enhanced_call ( node ( ) , Test , :exception , [ ] , tenant_id: tenant )
81-
82- Process . sleep ( 200 )
83- assert metric_value ( metric , mechanism: "erpc" , success: false , tenant: tenant ) == previous_value + 1
84- end
85-
8653 test "global exception" , % { tenant: tenant } do
8754 metric = "realtime_global_rpc_count"
8855 # Enough time for the poll rate to be triggered at least once
@@ -102,38 +69,38 @@ defmodule Realtime.PromEx.Plugins.TenantsTest do
10269 % { tenant: random_string ( ) }
10370 end
10471
105- test "success" , % { tenant: tenant } do
106- metric = "realtime_rpc_count "
72+ test "global success" , % { tenant: tenant } do
73+ metric = "realtime_global_rpc_count "
10774 # Enough time for the poll rate to be triggered at least once
10875 Process . sleep ( 200 )
109- previous_value = metric_value ( metric , mechanism: "gen_rpc" , success: true , tenant: tenant ) || 0
76+ previous_value = metric_value ( metric , mechanism: "gen_rpc" , success: true ) || 0
11077 assert GenRpc . multicall ( Test , :success , [ ] , tenant_id: tenant ) == [ { node ( ) , { :ok , "success" } } ]
11178 Process . sleep ( 200 )
112- assert metric_value ( metric , mechanism: "gen_rpc" , success: true , tenant: tenant ) == previous_value + 1
79+ assert metric_value ( metric , mechanism: "gen_rpc" , success: true ) == previous_value + 1
11380 end
11481
115- test "failure" , % { tenant: tenant } do
116- metric = "realtime_rpc_count "
82+ test "global failure" , % { tenant: tenant } do
83+ metric = "realtime_global_rpc_count "
11784 # Enough time for the poll rate to be triggered at least once
11885 Process . sleep ( 200 )
119- previous_value = metric_value ( metric , mechanism: "gen_rpc" , success: false , tenant: tenant ) || 0
86+ previous_value = metric_value ( metric , mechanism: "gen_rpc" , success: false ) || 0
12087 assert GenRpc . multicall ( Test , :failure , [ ] , tenant_id: tenant ) == [ { node ( ) , { :error , "failure" } } ]
12188 Process . sleep ( 200 )
122- assert metric_value ( metric , mechanism: "gen_rpc" , success: false , tenant: tenant ) == previous_value + 1
89+ assert metric_value ( metric , mechanism: "gen_rpc" , success: false ) == previous_value + 1
12390 end
12491
125- test "exception" , % { tenant: tenant } do
126- metric = "realtime_rpc_count "
92+ test "global exception" , % { tenant: tenant } do
93+ metric = "realtime_global_rpc_count "
12794 # Enough time for the poll rate to be triggered at least once
12895 Process . sleep ( 200 )
129- previous_value = metric_value ( metric , mechanism: "gen_rpc" , success: false , tenant: tenant ) || 0
96+ previous_value = metric_value ( metric , mechanism: "gen_rpc" , success: false ) || 0
13097 node = node ( )
13198
13299 assert assert [ { ^ node , { :error , :rpc_error , { :EXIT , { % RuntimeError { message: "runtime error" } , _stacktrace } } } } ] =
133100 GenRpc . multicall ( Test , :exception , [ ] , tenant_id: tenant )
134101
135102 Process . sleep ( 200 )
136- assert metric_value ( metric , mechanism: "gen_rpc" , success: false , tenant: tenant ) == previous_value + 1
103+ assert metric_value ( metric , mechanism: "gen_rpc" , success: false ) == previous_value + 1
137104 end
138105 end
139106
0 commit comments