summaryrefslogtreecommitdiff
path: root/lib/diameter/test
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright yearErlang/OTP2023-05-151-1/+1
|
* dbg: deprecates function dbg:stop_clear/1Kiko Fernandez-Reyes2023-04-191-1/+1
| | | | | | | | function `dbg:stop_clear/1` is not documented in the API but was kept for compatibility reasons. in this commit we make a step forward to deprecating its use such that it will be eventually removed. closes GH-6903.
* Update copyright yearErlang/OTP2023-04-111-1/+1
|
* ssl: Remove double assert and fix test cases to handle client defaults to ↵Ingela Anderton Andin2023-03-271-2/+2
| | | | {verify, verify_peer}
* Update copyright yearErlang/OTP2023-02-142-2/+2
|
* diameter: improve codegen changing size/1 by XXX_size/1Kiko Fernandez-Reyes2023-01-242-3/+3
|
* make: Allow OTP to be built deterministicallyTom Davies2022-06-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a --enable-deterministic-build to the configure script, which sets ERL_DETERMINISTIC=yes throughout the relevant Makefiles, which then invoke the relevant build stages with the +deterministic option. This addresses absolute paths being included in generated .erl files and compiled .beam files that resulted in builds from different source directories generating different artefacts (which is a component of the issue in erlang#4482). I think it would make sense to make this the default at some stage, but I've put the change behind a flag for now to decouple making deterministic OTP builds possible from making them the default. Having +deterministic set results in compiler options being removed from the module info for modules where this options was used. This may have other implications for users of OTP. For tests themselves, +determinism is not set, since many test cases depend on accessing the test module's compilation options, or other features not available in deterministic mode, in order to configure themselves. For tests of the determinism feature specifically, +deterministic must be explicitly passed to the compiler within the relevant test cases.
* Merge branch 'anders/diameter/test/OTP-16752'Anders Svensson2022-03-186-67/+98
|\ | | | | | | | | * anders/diameter/test/OTP-16752: Ensure testsuites only write to temporary directory
| * Ensure testsuites only write to temporary directoryAnders Svensson2022-03-186-67/+98
| | | | | | | | | | | | The compiler, codec, and examples testsuites wrote to pwd, which common_test changes to its priv_dir, but that isn't ideal without common_test. Write to a created temporary directory in this case.
* | Merge branch 'anders/diameter/test/OTP-16752'Anders Svensson2022-03-188-57/+67
|\ \ | |/ | | | | | | | | | | * anders/diameter/test/OTP-16752: Tweak test/Makefile Fix peer-related testsuite noise Fix minor testsuite blunders
| * Tweak test/MakefileAnders Svensson2022-03-181-11/+11
| | | | | | | | | | | | One target for running suites without common_test (run), one with (ct): ignoring errors is better done on the command line with make -i. Disable crash dumps.
| * Fix peer-related testsuite noiseAnders Svensson2022-03-184-19/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Crashes like the one below after commit 0dad730b were just noise, but caused by the process running peer:start_link/1 exiting with a meaningful reason for the purpose of monitoring. Start from a middleman process to work around it. =ERROR REPORT==== 18-Mar-2022::10:50:22.260471 === ** Generic server <0.139.0> terminating ** Last message in was {'EXIT',<0.135.0>, {#Ref<0.2812022913.2652372994.101846>,[]}} ** When Server state == {peer_state,#{args => ["-pa", "/home/anders/dev/otp/lib/diameter/test", "/home/anders/dev/otp/lib/diameter/test/../ebin", "-setcookie", "zzz"], name => "diametertcpserver"}, diametertcpserver@elxa6vcfsf2, "/home/anders/dev/erlang/94c81bfd/erts-12.2.1/bin/erl", ["-sname","diametertcpserver","-detached", "-noinput","-user","peer","-origin", "g1hkACNkaWFtZXRlcl90ZXN0X19leGFtcGxlc0BlbHhhNnZjZnNmMgAAAIsAAAAAYjQeQw==", "-pa", "/home/anders/dev/otp/lib/diameter/test", "/home/anders/dev/otp/lib/diameter/test/../ebin", "-setcookie","zzz"], undefined,undefined,<<>>,running, {<0.135.0>, #Ref<0.2812022913.2652372994.101857>}, 0,#{}} ** Reason for termination == ** {#Ref<0.2812022913.2652372994.101846>,[]} =CRASH REPORT==== 18-Mar-2022::10:50:22.267130 === crasher: initial call: peer:init/1 pid: <0.139.0> registered_name: [] exception exit: {#Ref<0.2812022913.2652372994.101846>,[]} in function gen_server:decode_msg/9 (gen_server.erl, line 488) ancestors: [<0.135.0>] message_queue_len: 1 messages: [{nodedown,diametertcpserver@elxa6vcfsf2}] links: [] dictionary: [] trap_exit: true status: running heap_size: 6772 stack_size: 28 reductions: 11827 neighbours:
| * Fix minor testsuite blundersAnders Svensson2022-03-186-27/+9
| | | | | | | | | | | | | | | | | | | | | | Don't test that the current version isn't in the appup file since the way version numbers are handled has changed since that test was written, no longer being updated manually. As is, the relup testcase fails after the appup file is updated, until release results in a new version number. Tweak some timeouts after testing on some underpowered hosts. Remove some dead code.
* | Merge branch 'anders/diameter/test/OTP-16752'Anders Svensson2022-03-1730-1935/+1884
|\ \ | |/ | | | | | | | | | | | | | | | | | | * anders/diameter/test/OTP-16752: Rework remaining diameter testsuites Rework diameter_{dist,distribution,examples}_SUITE Rework diameter_{traffic,tls,transport}_SUITE Simplify diameter_util Run fewer testcases in diameter_traffic_SUITE Remove is_port guard Skip diameter_gen_sctp_SUITE
| * Rework remaining diameter testsuitesAnders Svensson2022-03-1722-1005/+943
| | | | | | | | | | | | | | | | | | | | | | | | As in the previous two commit: remove common_test as a requirement and make all testcases independent. Add a make target for running any suite without common test; for example, to run all testcases in diameter_dpr_SUITE: make _dpr Similar to the target that runs suites with common_test, just add an underscore prefix.
| * Rework diameter_{dist,distribution,examples}_SUITEAnders Svensson2022-03-173-326/+559
| | | | | | | | | | | | | | | | | | | | | | These were redone somewhat in commit 96d28d7d, but that moved peer start into init_per_suite, whose failure unintuitively results in skipped rather than failed testcases, and that also suffers from the common_test woes mentioned in previous commits. Redo them again to make tests runnable without common_test, as in the parent commit. Also remove the interdependency that existed between the code and traffic testcases in the examples suite.
| * Rework diameter_{traffic,tls,transport}_SUITEAnders Svensson2022-03-173-450/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make them runnable without common_test, by way of run/0, which is convenient for running suites easily from the shell; for example: $ env ERL_CRASH_DUMP_BYTES=0 erl -noinput -pa ebin -pa test -s diameter_traffic_SUITE run -s init stop Just crashing also provides better diagnostics than common_test often provides in the shell; for example: diameter_traffic_SUITE:init_per_group failed Reason: {badmatch,undefined} rand:uniform_s failed on line 334 Reason: {function_clause,[{rand,...},{...}|...]} Having to look in html pages to find details of failures like this isn't ideal. Testcases were also dependent on one another, so one failure could lead to several. Now run everthing that needs to be done in sequence, and different tests within a sequence in parallel. Multiple simultaneous connections in the transport suite are often refused on macOS, so be satisfied with one.
| * Simplify diameter_utilAnders Svensson2022-03-171-58/+95
| | | | | | | | | | | | | | | | | | | | | | map_size/1 has existed since OTP 17.0 and is_map_key/2 since OTP 21.0: use them to simplify some mechanics. Simplify more as well, and add choose/1, tmpdir/0, and mktemp/1; the latter two for running suites that need a temporary directory without common_test. Ensure run/1 doesn't orphan any temporary processes when it returns. runtime_dependencies in the appfile states erts-10.0, which corresponds to OTP 21.0, so there is no new dependency.
| * Run fewer testcases in diameter_traffic_SUITEAnders Svensson2022-03-171-117/+23
| | | | | | | | | | | | | | | | Instead of even trying to run a meaningful subset of all the configuration possibilities, just choose one and simplify the common_test mechanics/workarounds. The test suite is run night after night on many different hosts, so simply choosing a configuration results in coverage over time.
| * Skip diameter_gen_sctp_SUITEAnders Svensson2022-03-172-3/+2
| | | | | | | | | | | | | | | | | | | | Testcases in this suite have failed for almost 9 years now. Either there's a reasonable explanation for it or no one is using gen_sctp enough to notice/care, but the failures are just noise in diameter's testing. May only affect the loopback address, which would explain the lack of interest.
* | Fix typos in lib/diameterKian-Meng, Ang2022-02-163-6/+6
|/
* Update copyright yearErlang/OTP2022-02-152-2/+2
|
* otp: Fix `make TYPE=$TYPE` to work for all typesLukas Larsson2022-01-211-1/+1
|
* otp: Skip tests that fail in gh actionsLukas Larsson2022-01-212-1/+5
|
* Update copyright yearRickard Green2021-12-163-3/+3
|
* [diameter] use ?CT_PEER instead of ct_slaveMaxim Fedorov2021-11-083-504/+215
| | | | | | | | | | | Replace ct_slave invocations with ?CT_PEER. This ensures no rogue nodes are left after test suite completes, and allows running multiple copies of the suite concurrently (or, run both on the same host in parallel). This patch also improves diameter_dist_SUITE, diameter_distribution_SUITE and diameters_examples_SUITE resilience. Previously these tests suites depended on a specific order of test case execution, making it impossible to run a single test case independently of another.
* Fix ignored unordered option on client diameter_sctp transportAnders Svensson2021-04-301-9/+9
| | | | | | The option was ignored, causing all sending to be ordered. Thanks to Bengt Kleberg.
* Skip traffic tests differentlyAnders Svensson2020-02-121-9/+5
| | | | | | | | | | | The reduction of the number of traffic cases in the parent commit speeds up testing, but common_test doesn't seem to do well with the large number of groups returned from groups/0: one for each of the 1440 config variants and a few more. Randomly skip variants when building the groups list instead of when init_per_group/2 is invoked, to reduce the running time from 12 minutes mentioned in the parent commit to around 8.
* Skip many more traffic testcasesAnders Svensson2020-02-121-2/+2
| | | | | | | | | | | | | There are currently 55 traffic testcases and 1440 config variants: 55*1440 = 79200 possible testcases. Skipping 25% of these (randomly) still leaves 59400 for common_test to trudge through, and this is not quick, even though some of these 54900 are also skipped: almost 90 minutes on one reasonable host. The benefit of running all these variants of the same test ad nauseum (on many hosts to boot) is doubtful, so increase the number skipped to 90%. This leaves 7920 testcases, still not a small number, and takes around 12 minutes vs 90. (Which is exactly 90 * 10/75 in fact.)
* Fix incorrect transport optionsAnders Svensson2020-02-121-17/+30
| | | | | | | | | | | | | | | | | | | | | | | | | Commit 5f3becad caused transport options differing from those passed to diameter:add_transport/2 to be used in several situations: when starting a transport process after connect_timer expiry after an initial connection attempt has failed, when starting a transport process after a connection has been accepted, when sending events, when returning options in diameter:service_info/2, and possibly more. In particular, the configuration options below were lost. avp_dictionaries incoming_maxlen spawn_opt strict_mbit The effect was as if these hadn't been configured. Discovered when testing {diameter_dist, route_session, []} as a spawn_opt MFA and seeing that the callback was missing after an initial connection failure. (Thanks to Tamas Bodnar.) Add a simply match to the event suite that detects one instance of the fault.
* Don't orphan slave node in example suiteAnders Svensson2020-02-121-7/+18
| | | | The ct_slave start for compilation was orphaned if compilation failed.
* Fix traffic counters for remote request handler processesAnders Svensson2020-02-111-13/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit f1cdd721 documented the possibility of starting a handler process for an incoming Diameter request with a configured MFA, but the counter implementation (ie. {traffic_counters, true}) was broken when this process was not on the same node as the transport configuration: incrementing a counter was a noop since the transport pid was not associated with the transport reference in diameter_stats on the remote node. This was a good thing though, since distributing the counters across handler nodes has a number of problems: not losing counters if the connection to a handler node is lost, or not being able to remove counters on a handler node when the transport is removed, keeping track of where counters are located if they have to be retrieved from multiple nodes, and so on. Moreover, it's the service/transport configuration on the local node that orders the counters, so incrementing them on remote nodes is questionable. Avoid the problems by incrementing counters where the transport in question is configured, the node that terminates any associated peer connection. Instead of calling diameter_stats to increment the counter when the diameter_peer_fsm process it's being incremented for is not local, bang the counter to that process to let it call diameter_stats. The only requirement on the handler node is now that diameter and application callbacks reside on the code path, and the documentation has been updated to reflect this. Compare this to the case of outgoing requests, where counters are incremented on the originating node. Similarly, it's the local configuration that orders the counters, and there can be multiple remote nodes through which the request can be sent on a peer connection just like there can be multiple handler nodes in the case of an incoming request.
* Add diameter_dist_SUITE to exercise diameter_dist:route_session/2Anders Svensson2019-03-063-2/+337
| | | | | | | Spread a server over three nodes, one of which terminates a peer connection, the other two to handle requests. Terminate transport on one of the server nodes and ensure that answers come only from the other two.
* Add options to diameter_dist:route_session/2 node selectionAnders Svensson2019-03-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To be able to restrict how many AVPs will be examined (from the front of a message) when looking for Session-Id, and to decide what to do with if the AVP isn't found. Options are specified as a map of the following form. #{search => non_neg_integer(), default => discard | mfa(), dispatch => list() | mfa()} The search member says how many AVPs to examine at most, from the front of the message. If the optional value of a Session-Id is not the name of a connected node then the default member determines what to do with the request, handle it locally (the default), discard it, or invoke an MFA on the Session-Id | false (if none was found) and diameter_packet record to return a node() | false; if the latter then the request is discarded. If a node is identified then the dispatch MFA is invoked on the node and the request MFA (as three arguments), a list Opts being equivalent to the MFA {erlang, spawn_opt, [Opts]}, and the default being the empty list. Integer- or list-valued options are equivalent to the corresponding map with a single value. Limiting the search is to avoid searching messages containing many AVPs for a Session-Id that is known to occur near the header, since section 8.8 of RFC 6733 says this: When present, the Session-Id SHOULD appear immediately following the Diameter header (see Section 3). There's no guarantee, but in practice it may well be known that peers are respecting the RFC, and in that case limiting the search is a defense against searching messages from a malicious peer unnecessarily. The search is unlimited by default. A default is only used when a search fails to locate a Session-Id, and can be to discard the message, or have a node() or false be returned from an MFA applied to the diameter_packet in question. The local node is chosen by default.
* Add diameter_dist for ready spawn_opt callbacksAnders Svensson2019-03-061-1/+2
| | | | | | | | | | | | That is, of functions that can be configured as spawn_opt MFAs in transport configuration. This commits adds the spawn_local described in the parent commit, and a route_session that assumes that the local node initiates all sessions with Session-Id returned by diameter:session_id/1, and handles incoming requests on the node on which the id in question was returned, diameter:session_id/1 using node() as optional value in the Session-Id format.
* Tweak/document request handler callbackAnders Svensson2019-03-061-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | The possibility of configuring an MFA as spawn_opt was added in commit fd285079, the callback being passed an arity-0 fun to be applied in an appropriate handler process. Replace the fun by a tuple to be passed to diameter_traffic:request/1, to avoid passing funs between nodes when handler processes are remote. A list-valued spawn_opt is now equivalent to the following configured as {spawn_opt, {Mod, spawn_local, [Opts]}}. spawn_local(ReqT, Opts) -> spawn_opt(diameter_traffic, request, [ReqT], Opts). ReqT is passed by diameter and contains information that the callback may want to decide where to handle the request in question (which wasn't accessible with a fun), but this information isn't exposed in a documented way. The intention is instead to add an own callback implementation to make use of the information. Note that application lookup now takes place in the watchdog process in both the list-valued (or no configuration) and mfa-valued cases. Whether this is good, bad, or (probably) inconsequential remains to be seen.
* Make diameter_app_SUITE fail more usefullyAnders Svensson2018-06-111-3/+5
| | | | | | | | | | | | | | | | The badmatch in the grandparent commit is ssl not being installed: === Reason: no match of right hand side value {ssl,non_existing, ["non_existing"]} in function diameter_app_SUITE:app/1 (diameter_app_SUITE.erl, line 266) in call from diameter_app_SUITE:'-xref/1-fun-3-'/2 (diameter_app_SUITE.erl, line 214) in call from lists:'-filter/2-lc$^0/1-0-'/2 (lists.erl, line 1286) in call from diameter_app_SUITE:xref/1 (diameter_app_SUITE.erl, line 214) in call from test_server:ts_tc/3 (test_server.erl, line 1545) in call from test_server:run_test_case_eval1/6 (test_server.erl, line 1063) in call from test_server:run_test_case_eval/9 (test_server.erl, line 995) Tweak the failure a bit more, without fixing it.
* Match in diameter_app_SUITE to identify an unexpected pathAnders Svensson2018-06-111-2/+4
| | | | | | | | | | | | | | | | | | | | | | | See this failure in nightly test on one host, indicating that code:which/1 is returning something other than the expected path: === Ended at 2018-06-08 05:10:41 === Location: [{lists,nth,170}, {diameter_app_SUITE,app,265}, {diameter_app_SUITE,'-xref/1-fun-3-',214}, {lists,'-filter/2-lc$^0/1-0-',1286}, {diameter_app_SUITE,xref,214}, {test_server,ts_tc,1545}, {test_server,run_test_case_eval1,1063}, {test_server,run_test_case_eval,995}] === Reason: no function clause matching lists:nth(2,[]) (lists.erl, line 170) in function diameter_app_SUITE:app/1 (diameter_app_SUITE.erl, line 265) in call from diameter_app_SUITE:'-xref/1-fun-3-'/2 (diameter_app_SUITE.erl, line 214) in call from lists:'-filter/2-lc$^0/1-0-'/2 (lists.erl, line 1286) in call from diameter_app_SUITE:xref/1 (diameter_app_SUITE.erl, line 214) in call from test_server:ts_tc/3 (test_server.erl, line 1545) in call from test_server:run_test_case_eval1/6 (test_server.erl, line 1063) in call from test_server:run_test_case_eval/9 (test_server.erl, line 995)
* Don't use deprecated erlang:get_stacktrace/0Anders Svensson2018-06-072-8/+7
|
* Fix missing monitor in diameter_regAnders Svensson2017-10-051-1/+10
| | | | | | | | | Commit fae8ca0c inadvertently removed the monitor at add/1 and add_new/1. As a result, process death did not remove associations, causing table diameter_reg to leak entries and stop/start of a service to fail. Add a testcase to detect the problem, which existing testcases miss.
* Merge branch 'anders/diameter/sctp/OTP-10889' into maintAnders Svensson2017-09-181-7/+12
|\ | | | | | | | | * anders/diameter/sctp/OTP-10889: Make unordered delivery configurable
| * Make unordered delivery configurableAnders Svensson2017-09-171-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Changing the default in the parent commit is possibly a bit dangerous, even if the motivation still holds. Take a step back and make unordered delivery a matter of configuration, without changing the default: configuration is {unordered, boolean() | pos_integer()}, with false the default, and N equivalent to OS =< N, where OS is the number of outbound streams negotiated on the association in question. A user can mess with this by configuring an sctp_default_send_param of their own, but unordered sending is them from start, not only after the second message reception.
* | Merge branch 'anders/diameter/answer-message_decode/OTP-14596' into maintAnders Svensson2017-09-051-4/+67
|\ \ | | | | | | | | | | | | | | | * anders/diameter/answer-message_decode/OTP-14596: Exercise answer-message/AVP decode in traffic suite Exercise answer-message/Failed-AVP decode in traffic suite
| * | Exercise answer-message/AVP decode in traffic suiteAnders Svensson2017-09-041-14/+41
| | | | | | | | | | | | | | | In particular, that arbitrary application AVPs are decoded in an answer setting the E-bit.
| * | Exercise answer-message/Failed-AVP decode in traffic suiteAnders Svensson2017-09-041-4/+40
| | | | | | | | | | | | | | | In particular, that application AVPs in Failed-AVP are decoded in an answer setting the E-bit.
* | | Merge branch 'anders/diameter/DOIC/OTP-14588' into maintAnders Svensson2017-09-054-8/+32
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | * anders/diameter/DOIC/OTP-14588: Exercise avp_dictionaries in traffic suite Let generic AVPs be encoded/decoded in alternate dictionaries Rename field in codec map: dictionary -> app_dictionary Add RFC 7683 Diameter Overload Indicator Conveyance text and dictionary Fix decode undef Fix dictionary compilation error message
| * | Exercise avp_dictionaries in traffic suiteAnders Svensson2017-09-041-4/+27
| | | | | | | | | | | | As introduced in the parent commit.
| * | Rename field in codec map: dictionary -> app_dictionaryAnders Svensson2017-09-043-3/+3
| | | | | | | | | | | | | | | | | | | | | To better reflect what the field is: field 'module' is the dictionary module that's calling diameter_gen to decode a list of AVP, while field 'app_dictionary' is the dictionary module defining the message being decoded.
| * | Add RFC 7683 Diameter Overload Indicator Conveyance text and dictionaryAnders Svensson2017-09-041-1/+2
| | | | | | | | | | | | | | | Which motivates the avp_dictionaries config that will be added in a subsequent commit.
* | | Merge branch 'anders/diameter/decode_format/OTP-14511' into maintAnders Svensson2017-09-031-67/+43
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | * anders/diameter/decode_format/OTP-14511: Map less in traffic suite Fix decode_format doc oversights Rename decode_format false to none Tweak {decode_format, false} semantics Fix dialyzer spec