Skip to content

Commit

Permalink
qf-knm_4oh: loads of tests and some fixes to KNM (2600hz#3384)
Browse files Browse the repository at this point in the history
* qf-knm_4oh: add is_dirty/1

* qf-knm_4oh: fix dirtyness of set_used_by

* qf-knm_4oh: fix dirtyness of set_features

* qf-knm_4oh: add tests for used_by dirtyness

* qf-knm_4oh: better test-mode logging

* qf-knm_4oh: fix dirtyness of set_features, set_module_name, set_reserve_history

* qf-knm_4oh: do not un-dirty what is already clean

* qf-knm_4oh: even better logging for >19 OTPs

* qf-knm_4oh: properly fix kpn tests

* qf-knm_4oh: properly fix kpn tests again

* qf-knm_4oh: adding loads more tests

* qf-knm_4oh: ensure pvt_number_state is no longer on number doc

* qf-knm_4oh: test for single specific cases of dirtyness for OLDNUM2

* qf-knm_4oh: more fixes to set_module_name dirtyness

* qf-knm_4oh: better handling of pvt_modified

* qf-knm_4oh: fix set_doc dirty-ness

* qf-knm_4oh: moar tests

* qf-knm_4oh: moar tests

* qf-knm_4oh: remove some duplication

* qf-knm_4oh: pass tests

* qf-knm_4oh: ensure all testing DIDs are not dirty

* qf-knm_4oh: last set of additional tests
  • Loading branch information
fenollp authored and mark2600 committed Mar 6, 2017
1 parent 3b53978 commit a0f4066
Show file tree
Hide file tree
Showing 29 changed files with 1,068 additions and 284 deletions.
11 changes: 9 additions & 2 deletions core/kazoo/src/kz_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,19 @@ log_stacktrace(ST) ->
],
'ok'.

-ifdef(TEST).
log_stacktrace_mfa(M, F, Arity, Info) when is_integer(Arity) ->
io:format(user, "st: ~s:~s/~b at (~b)\n", [M, F, Arity, props:get_value('line', Info, 0)]);
log_stacktrace_mfa(M, F, Args, Info) ->
io:format(user, "st: ~s:~s at ~p\n", [M, F, props:get_value('line', Info, 0)]),
lists:foreach(fun (Arg) -> io:format(user, "args: ~p\n", [Arg]) end, Args).
-else.
log_stacktrace_mfa(M, F, Arity, Info) when is_integer(Arity) ->
lager:error("st: ~s:~s/~b at (~b)", [M, F, Arity, props:get_value('line', Info, 0)]);
log_stacktrace_mfa(M, F, Args, Info) ->
lager:error("st: ~s:~s at ~p", [M, F, props:get_value('line', Info, 0)]),
_ = [lager:error("args: ~p", [Arg]) || Arg <- Args],
'ok'.
lists:foreach(fun (Arg) -> lager:error("args: ~p", [Arg]) end, Args).
-endif.

-define(LOG_LEVELS, ['emergency'
,'alert'
Expand Down
20 changes: 20 additions & 0 deletions core/kazoo_number_manager/priv/fixtures/old_vsn_1.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"_id": "+15045551227",
"_rev": "11-f8653b9aed4756a3bb512a734b620a7e",
"pvt_assigned_to": "009afc511c97b2ae693c6cc4920988e8",
"pvt_authorizing_account": "009afc511c97b2ae693c6cc4920988e8",
"pvt_created": 63648122255,
"pvt_db_name": "numbers%2F%2B1504",
"pvt_features_available": [
"cnam",
"e911",
"failover",
"port",
"prepend"
],
"pvt_modified": 63648133355,
"pvt_module_name": "knm_local",
"pvt_ported_in": false,
"pvt_state": "in_service",
"pvt_type": "number"
}
23 changes: 23 additions & 0 deletions core/kazoo_number_manager/priv/fixtures/old_vsn_2.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"_id": "+12014370856",
"_rev": "21-655c1bdd4196b001963eb78541a53165",
"pvt_assigned_to": "aac9151d9c1319c46f2677eeae2958f6",
"pvt_authorizing_account": "e4af2616e751955027c71fec039c6b11",
"pvt_created": 63637990840,
"pvt_db_name": "numbers%2F%2B1201",
"pvt_features": [],
"pvt_modified": 63637990853,
"pvt_module_name": "knm_pacwest",
"pvt_reserve_history": [
"aac9151d9c1319c46f2677eeae2958f6"
],
"pvt_resource_db": "account%2Faa%2Fc9%2F151d9c1319c46f2677eeae2958f6",
"pvt_state": "in_service",
"pvt_type": "number",
"ui_metadata": {
"origin": "common",
"ui": "monster-ui",
"version": "3.22-34"
},
"used_by": ""
}
23 changes: 23 additions & 0 deletions core/kazoo_number_manager/priv/fixtures/old_vsn_2.2_in.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"_id": "+12014370857",
"_rev": "22-655c1bdd4196b001963eb78541a53165",
"pvt_assigned_to": "aac9151d9c1319c46f2677eeae2958f6",
"pvt_authorizing_account": "e4af2616e751955027c71fec039c6b11",
"pvt_created": 63637990840,
"pvt_db_name": "numbers%2F%2B1201",
"pvt_features": [],
"pvt_modified": 63637990853,
"pvt_module_name": "wnm_pacwest",
"pvt_reserve_history": [
"aac9151d9c1319c46f2677eeae2958f6"
],
"pvt_resource_db": "account%2Faa%2Fc9%2F151d9c1319c46f2677eeae2958f6",
"pvt_state": "in_service",
"pvt_type": "number",
"ui_metadata": {
"origin": "common",
"ui": "monster-ui",
"version": "3.22-34"
},
"used_by": ""
}
30 changes: 30 additions & 0 deletions core/kazoo_number_manager/priv/fixtures/old_vsn_2.2_out.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"_id": "+12014370857",
"pvt_assigned_to": "aac9151d9c1319c46f2677eeae2958f6",
"pvt_authorizing_account": "system",
"pvt_created": 63637990840,
"pvt_db_name": "numbers%2F%2B1201",
"pvt_features_allowed": [
"failover",
"force_outbound",
"prepend",
"ringback"
],
"pvt_features_denied": [
"failover"
],
"pvt_is_billable": true,
"pvt_modified": 63637990853,
"pvt_module_name": "knm_pacwest",
"pvt_ported_in": false,
"pvt_reserve_history": [
"aac9151d9c1319c46f2677eeae2958f6"
],
"pvt_state": "in_service",
"pvt_type": "number",
"ui_metadata": {
"origin": "common",
"ui": "monster-ui",
"version": "3.22-34"
}
}
4 changes: 2 additions & 2 deletions core/kazoo_number_manager/priv/fixtures/old_vsn_2_in.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"_id": "+12014370855",
"_rev": "3-655c1bdd4196b001963eb78541a53165",
"_rev": "2-655c1bdd4196b001963eb78541a53165",
"pvt_assigned_to": "aac9151d9c1319c46f2677eeae2958f6",
"pvt_authorizing_account": "e4af2616e751955027c71fec039c6b11",
"pvt_created": 63637990840,
"pvt_db_name": "numbers%2F%2B1201",
"pvt_features": [],
"pvt_modified": 63637990853,
"pvt_module_name": "wnm_pacwest",
"pvt_module_name": "knm_pacwest",
"pvt_number_state": "in_service",
"pvt_reserve_history": [
"aac9151d9c1319c46f2677eeae2958f6"
Expand Down
2 changes: 1 addition & 1 deletion core/kazoo_number_manager/priv/fixtures/old_vsn_2_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"failover"
],
"pvt_is_billable": true,
"pvt_modified": 63637990854,
"pvt_modified": 63637990853,
"pvt_module_name": "knm_pacwest",
"pvt_ported_in": false,
"pvt_reserve_history": [
Expand Down
58 changes: 58 additions & 0 deletions core/kazoo_number_manager/priv/fixtures/old_vsn_3.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"_id": "+14082141751",
"_rev": "5-d8c63d6bdc3e8376e9ffe157904ce114",
"e911": {
"extended_address": "",
"locality": "SAN FRANCISCO",
"postal_code": "94108-5630",
"region": "CA",
"street_address": "140 GEARY ST"
},
"features": [
"e911"
],
"pvt_assigned_to": "eda33e3561baf133f9a088340643e35c",
"pvt_authorizing_account": "eda33e3561baf133f9a088340643e35c",
"pvt_carrier_data": {
"number": "+14082141750",
"order_id": "6c7e81e558cc48e1a55c783ff06244cc",
"order_name": "avaya-63646110391",
"rate_center": {
"lata": "722",
"name": "SAN MARTIN",
"state": "CA"
}
},
"pvt_created": 63646110391,
"pvt_db_name": "numbers%2F%2B1408",
"pvt_features": {
"e911": {
"extended_address": "",
"locality": "SAN FRANCISCO",
"postal_code": "94108-5630",
"region": "CA",
"street_address": "140 GEARY ST"
}
},
"pvt_features_available": [
"cnam",
"dash_e911",
"failover",
"port",
"prepend",
"vitelity_e911",
"e911"
],
"pvt_modified": 63646110391,
"pvt_module_name": "knm_bandwidth2",
"pvt_state": "in_service",
"pvt_type": "number",
"pvt_used_by": "callflow",
"state": "in_service",
"ui_metadata": {
"origin": "common",
"ui": "monster-ui",
"version": "4.0-3"
},
"used_by": "callflow"
}
4 changes: 2 additions & 2 deletions core/kazoo_number_manager/priv/fixtures/old_vsn_3_in.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"e911"
],
"pvt_modified": 63646110391,
"pvt_module_name": "knm_bandwidth2",
"pvt_number_state": "in_service",
"pvt_module_name": "wnm_bandwidth",
"pvt_state": "in_service",
"pvt_type": "number",
"pvt_used_by": "callflow",
"state": "in_service",
Expand Down
2 changes: 1 addition & 1 deletion core/kazoo_number_manager/priv/fixtures/old_vsn_3_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"failover"
],
"pvt_is_billable": true,
"pvt_modified": 6364611391,
"pvt_modified": 63646110391,
"pvt_module_name": "knm_bandwidth2",
"pvt_ported_in": false,
"pvt_state": "in_service",
Expand Down
34 changes: 34 additions & 0 deletions core/kazoo_number_manager/priv/fixtures/old_vsn_4.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"AintThey": "pretty",
"MyField": [
{
"my": "vals"
},
41,
2
],
"_id": "+14242424248",
"_rev": "41-62ac91830bae51385cb4c6d56f294444",
"e911": {
"caller_name": "Moua"
},
"pvt_assigned_to": "4b8c6fec4b2597882c0390202d195419",
"pvt_authorizing_account": "4b8c6fec4b2597882c0390202d195419",
"pvt_created": 63627551737,
"pvt_db_name": "numbers%2F%2B1424",
"pvt_features": {
"e911": {
"caller_name": "Moua"
},
"local": {}
},
"pvt_modified": 63627551739,
"pvt_module_name": "knm_local",
"pvt_reserve_history": [
"4b8c6fec4b2597882c0390202d195419"
],
"pvt_resource_db": "account%2F4b%2F8c%2F6fec4b2597882c0390202d195419",
"pvt_state": "reserved",
"pvt_type": "number",
"used_by": ""
}
2 changes: 1 addition & 1 deletion core/kazoo_number_manager/priv/fixtures/old_vsn_4_in.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"pvt_features": [],
"pvt_modified": 63627551739,
"pvt_module_name": "wnm_local",
"pvt_number_state": "reserved",
"pvt_reserve_history": [
"4b8c6fec4b2597882c0390202d195419"
],
"pvt_resource_db": "account%2F4b%2F8c%2F6fec4b2597882c0390202d195419",
"pvt_state": "reserved",
"pvt_type": "number",
"used_by": ""
}
2 changes: 1 addition & 1 deletion core/kazoo_number_manager/priv/fixtures/old_vsn_4_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"failover"
],
"pvt_is_billable": false,
"pvt_modified": 63648366250,
"pvt_modified": 63627551739,
"pvt_module_name": "knm_local",
"pvt_ported_in": false,
"pvt_reserve_history": [
Expand Down
90 changes: 90 additions & 0 deletions core/kazoo_number_manager/priv/fixtures/old_vsn_5.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"_id": "+19377038881",
"cnam": {
"display_name": "Bruce Wayne",
"inbound_lookup": true
},
"dash_e911": {
"caller_name": "Valued Customer",
"latitude": "40.05424",
"legacy_data": {
"house_number": "23",
"predirectional": "N",
"streetname": "MAIN ST"
},
"locality": "PLEASANT SIDE",
"location_id": "32379723",
"longitude": "-87.34416",
"plus_four": "8001",
"postal_code": "55359",
"region": "KZ",
"status": "PROVISIONED",
"street_address": "23 N MAIN ST"
},
"e911": {
"caller_name": "Valued Customer",
"latitude": "40.05424",
"legacy_data": {
"house_number": "23",
"predirectional": "N",
"streetname": "MAIN ST"
},
"locality": "PLEASANT SIDE",
"location_id": "32379723",
"longitude": "-87.34416",
"plus_four": "8001",
"postal_code": "55359",
"region": "KZ",
"status": "PROVISIONED",
"street_address": "23 N MAIN ST"
},
"pvt_assigned_to": "112bce1b4b782f2b33b366e420d05673",
"pvt_authorizing_account": "system",
"pvt_created": 63606025486,
"pvt_db_name": "numbers%2F%2B1937",
"pvt_features": {
"e911": {
"caller_name": "Valued Customer",
"latitude": "40.05424",
"legacy_data": {
"house_number": "23",
"predirectional": "N",
"streetname": "MAIN ST"
},
"locality": "PLEASANT SIDE",
"location_id": "32379723",
"longitude": "-87.34416",
"plus_four": "8001",
"postal_code": "55359",
"region": "KZ",
"status": "PROVISIONED",
"street_address": "23 N MAIN ST"
},
"inbound_cnam": {
"inbound_lookup": true
},
"outbound_cnam": {
"display_name": "Bruce Wayne"
}
},
"pvt_features_allowed": [
"failover",
"force_outbound",
"prepend",
"ringback"
],
"pvt_features_denied": [
"failover"
],
"pvt_is_billable": true,
"pvt_modified": 63648435293,
"pvt_module_name": "knm_bandwidth2",
"pvt_ported_in": false,
"pvt_state": "in_service",
"pvt_type": "number",
"state": "in_service",
"ui_metadata": {
"ui": "kazoo-ui",
"version": "3.14-1"
}
}
2 changes: 1 addition & 1 deletion core/kazoo_number_manager/priv/fixtures/old_vsn_5_in.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}
},
"pvt_module_name": "knm_bandwidth2",
"pvt_number_state": "in_service",
"pvt_state": "in_service",
"pvt_type": "number",
"state": "in_service",
"ui_metadata": {
Expand Down
2 changes: 1 addition & 1 deletion core/kazoo_number_manager/priv/fixtures/old_vsn_6_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"port"
],
"pvt_is_billable": false,
"pvt_modified": 63648931233,
"pvt_modified": 63640935218,
"pvt_module_name": "knm_local",
"pvt_ported_in": false,
"pvt_state": "in_service",
Expand Down
Loading

0 comments on commit a0f4066

Please sign in to comment.