@@ -50,8 +50,8 @@ defmodule Core.Unit.Policies.AppPolicyTest do
50
50
end
51
51
end
52
52
53
- describe "is_valid ?" do
54
- test "is_valid ? should return true when invalidate options are :infinity and the worker can host the function" ,
53
+ describe "valid ?" do
54
+ test "valid ? should return true when invalidate options are :infinity and the worker can host the function" ,
55
55
% { impl: app_impl } do
56
56
wrk = % Worker {
57
57
name: "worker@localhost" ,
@@ -73,15 +73,15 @@ defmodule Core.Unit.Policies.AppPolicyTest do
73
73
invalidate_capacity = :infinity
74
74
invalidate_invocations = :infinity
75
75
76
- assert app_impl . is_valid ?(
76
+ assert app_impl . valid ?(
77
77
wrk ,
78
78
function ,
79
79
invalidate_capacity ,
80
80
invalidate_invocations
81
81
) == true
82
82
end
83
83
84
- test "is_valid ? should return true when invalidate options are satisfied and the worker can host the function" ,
84
+ test "valid ? should return true when invalidate options are satisfied and the worker can host the function" ,
85
85
% { impl: app_impl } do
86
86
wrk = % Worker {
87
87
name: "worker@localhost" ,
@@ -103,15 +103,15 @@ defmodule Core.Unit.Policies.AppPolicyTest do
103
103
invalidate_capacity = 50
104
104
invalidate_invocations = 1
105
105
106
- assert app_impl . is_valid ?(
106
+ assert app_impl . valid ?(
107
107
wrk ,
108
108
function ,
109
109
invalidate_capacity ,
110
110
invalidate_invocations
111
111
) == true
112
112
end
113
113
114
- test "is_valid ? should return false when invalidate options are :infinity and the worker can't host the function" ,
114
+ test "valid ? should return false when invalidate options are :infinity and the worker can't host the function" ,
115
115
% { impl: app_impl } do
116
116
wrk = % Worker {
117
117
name: "worker@localhost" ,
@@ -133,15 +133,15 @@ defmodule Core.Unit.Policies.AppPolicyTest do
133
133
invalidate_capacity = :infinity
134
134
invalidate_invocations = :infinity
135
135
136
- assert app_impl . is_valid ?(
136
+ assert app_impl . valid ?(
137
137
wrk ,
138
138
function ,
139
139
invalidate_capacity ,
140
140
invalidate_invocations
141
141
) == false
142
142
end
143
143
144
- test "is_valid ? should return false when invalidate options are not satisfied or the worker can't host the function" ,
144
+ test "valid ? should return false when invalidate options are not satisfied or the worker can't host the function" ,
145
145
% { impl: app_impl } do
146
146
wrk = % Worker {
147
147
name: "worker@localhost" ,
@@ -163,21 +163,21 @@ defmodule Core.Unit.Policies.AppPolicyTest do
163
163
invalidate_capacity = 49
164
164
invalidate_invocations = 1
165
165
166
- assert app_impl . is_valid ?(
166
+ assert app_impl . valid ?(
167
167
wrk ,
168
168
function ,
169
169
invalidate_capacity ,
170
170
invalidate_invocations
171
171
) == false
172
172
173
- assert app_impl . is_valid ?(
173
+ assert app_impl . valid ?(
174
174
wrk |> Map . put ( :concurrent_functions , 1 ) ,
175
175
function ,
176
176
invalidate_capacity ,
177
177
invalidate_invocations
178
178
) == false
179
179
180
- assert app_impl . is_valid ?(
180
+ assert app_impl . valid ?(
181
181
wrk |> Map . put ( :resources , % Metrics { memory: % { available: 127 , total: 256 } } ) ,
182
182
function ,
183
183
invalidate_capacity ,
@@ -266,7 +266,7 @@ defmodule Core.Unit.Policies.AppPolicyTest do
266
266
function: function
267
267
} do
268
268
assert app_impl . select ( script , workers , function ) == { :ok , wrk }
269
- assert app_impl . is_valid ?( wrk , function , :infinity , :infinity )
269
+ assert app_impl . valid ?( wrk , function , :infinity , :infinity )
270
270
271
271
# invalidating the first worker causes select() to choose "worker2"
272
272
workers_invalid_first = [
@@ -279,13 +279,13 @@ defmodule Core.Unit.Policies.AppPolicyTest do
279
279
]
280
280
281
281
assert app_impl . select ( script , workers_invalid_first , function ) == { :ok , wrk2 }
282
- assert app_impl . is_valid ?( wrk2 , function , :infinity , :infinity )
282
+ assert app_impl . valid ?( wrk2 , function , :infinity , :infinity )
283
283
end
284
284
285
285
test "select should return a valid worker in the script when the strategy is :random" ,
286
286
% { impl: app_impl , workers: workers , script: script , function: function } do
287
287
{ :ok , wrk } = app_impl . select ( script , workers , function )
288
- assert app_impl . is_valid ?( wrk , function , :infinity , :infinity )
288
+ assert app_impl . valid ?( wrk , function , :infinity , :infinity )
289
289
assert Enum . member? ( workers , wrk ) == true
290
290
end
291
291
@@ -305,7 +305,7 @@ defmodule Core.Unit.Policies.AppPolicyTest do
305
305
{ :ok , wrk } = app_impl . select ( platform_script , workers , function )
306
306
{ :ok , wrk_default } = default_impl . select ( % Data.Configurations.Empty { } , workers , function )
307
307
308
- assert app_impl . is_valid ?( wrk , function , :infinity , :infinity )
308
+ assert app_impl . valid ?( wrk , function , :infinity , :infinity )
309
309
assert Enum . member? ( workers , wrk ) == true
310
310
assert wrk_default == wrk
311
311
end
0 commit comments