-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding company name and license-id from automate license. Signed-off-by: talktovikas <[email protected]> removing trailing space. Signed-off-by: talktovikas <[email protected]> fixing tests. Signed-off-by: talktovikas <[email protected]> fixing license test case. Signed-off-by: talktovikas <[email protected]> Fixing bug in condition statement Signed-off-by: talktovikas <[email protected]> debug statements Signed-off-by: talktovikas <[email protected]> adding the server url. Signed-off-by: talktovikas <[email protected]> assignment in case of standalone chef-server. Signed-off-by: talktovikas <[email protected]> adding licenseId in case of Automate-T data. Signed-off-by: talktovikas <[email protected]> fixing T-test cases. Signed-off-by: talktovikas <[email protected]> fixing tests. Signed-off-by: talktovikas <[email protected]> fixing tests. Signed-off-by: talktovikas <[email protected]> * remove debug logs Signed-off-by: talktovikas <[email protected]> * code review changes. Signed-off-by: talktovikas <[email protected]> --------- Signed-off-by: talktovikas <[email protected]>
- Loading branch information
1 parent
bfa89ec
commit fdc25e0
Showing
5 changed files
with
92 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,15 +28,21 @@ | |
active_nodes = 0, | ||
fqdn = []}). | ||
|
||
feild_value_test() -> | ||
field_value_test() -> | ||
State = #state{fqdn_select = {ok, [[{<<"property">>, <<"FQDN:node1.domain1.com">>}], | ||
[{<<"property">>, <<"FQDN:node2.subdomain2.domain2.com">>}], | ||
[{<<"property">>, <<"FQDN:node3.subdomain3.domain3.co.uk">>}]]}, | ||
should_send = true, | ||
user_emails = [[{<<"email">>, <<"[email protected]">>}]], | ||
nodes_count = 10 | ||
}, | ||
Expected = #expected{company_name = <<"testorg">>, | ||
{_Lic, _Type, _GracePeriod, _ExpDate, _Msg, CN,_} = chef_license:get_license(), | ||
CN1 = case CN of | ||
CN when CN == undefined, CN== <<"">>, CN == "" -> <<"testorg">>; | ||
CN ->CN | ||
end, | ||
|
||
Expected = #expected{company_name = CN1, | ||
nodes_count = 10, | ||
active_nodes = 4, | ||
fqdn = [<<".*\.domain1.com$">>, | ||
|
@@ -135,12 +141,25 @@ get_message() -> | |
throw(no_request) | ||
end. | ||
|
||
determine_license_id()-> | ||
{_Lic, _Type, _GracePeriod, _ExpDate, _Msg, _CN, LicenseID} = chef_license:get_license(), | ||
case LicenseID of | ||
undefined -> | ||
<<"Infra-Server-license-Id">>; | ||
<<"undefined">> -> | ||
<<"Infra-Server-license-Id">>; | ||
<<>> -> | ||
<<"Infra-Server-license-Id">>; | ||
_ -> | ||
LicenseID | ||
end. | ||
|
||
validate(Req, Expected) -> | ||
Licence = ej:get({<<"licenseId">>}, Req), | ||
TotalNodes = ej:get({<<"periods">>, 1, <<"summary">>, <<"nodes">>, <<"total">>}, Req), | ||
ActiveNodes = ej:get({<<"periods">>, 1, <<"summary">>, <<"nodes">>, <<"active">>}, Req), | ||
FQDNs = ej:get({<<"metadata">>, <<"Infra Server">>, <<"fqdn">>}, Req), | ||
?assertEqual(<<"Infra-Server-license-Id">>, Licence), | ||
?assertEqual(determine_license_id(), Licence), | ||
?assertEqual(Expected#expected.nodes_count, TotalNodes), | ||
?assertEqual(Expected#expected.active_nodes, ActiveNodes), | ||
?assertEqual(true, check_fqdn(FQDNs, Expected#expected.fqdn)). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters