Skip to content

Commit 15c3f80

Browse files
committed
fixing T-test cases.
Signed-off-by: talktovikas <[email protected]>
1 parent 730ea0e commit 15c3f80

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/oc_erchef/apps/chef_telemetry/test/chef_telemetry_worker_test.erl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ field_value_test() ->
3636
user_emails = [[{<<"email">>, <<"[email protected]">>}]],
3737
nodes_count = 10
3838
},
39-
{_Lic, _Type, _GracePeriod, _ExpDate, _Msg, CN} = gen_server:call(chef_license_worker, get_license),
39+
{_Lic, _Type, _GracePeriod, _ExpDate, _Msg, CN,_} = gen_server:call(chef_license_worker, get_license),
4040
CN1 = case CN of
4141
CN when CN == undefined, CN== <<"">>, CN == "" -> <<"testorg">>;
4242
CN ->CN
@@ -141,12 +141,25 @@ get_message() ->
141141
throw(no_request)
142142
end.
143143

144+
determine_license_id()->
145+
{_Lic, _Type, _GracePeriod, _ExpDate, _Msg, _CN, LicenseID} = gen_server:call(chef_license_worker, get_license),
146+
case LicenseID of
147+
undefined ->
148+
<<"Infra-Server-license-Id">>;
149+
<<"undefined">> ->
150+
<<"Infra-Server-license-Id">>;
151+
<<>> ->
152+
<<"Infra-Server-license-Id">>;
153+
_ ->
154+
LicenseID
155+
end.
156+
144157
validate(Req, Expected) ->
145158
Licence = ej:get({<<"licenseId">>}, Req),
146159
TotalNodes = ej:get({<<"periods">>, 1, <<"summary">>, <<"nodes">>, <<"total">>}, Req),
147160
ActiveNodes = ej:get({<<"periods">>, 1, <<"summary">>, <<"nodes">>, <<"active">>}, Req),
148161
FQDNs = ej:get({<<"metadata">>, <<"Infra Server">>, <<"fqdn">>}, Req),
149-
?assertEqual(<<"Infra-Server-license-Id">>, Licence),
162+
?assertEqual(determine_license_id(), Licence),
150163
?assertEqual(Expected#expected.nodes_count, TotalNodes),
151164
?assertEqual(Expected#expected.active_nodes, ActiveNodes),
152165
?assertEqual(true, check_fqdn(FQDNs, Expected#expected.fqdn)).

0 commit comments

Comments
 (0)