-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrace_bridging_test.erl
More file actions
74 lines (54 loc) · 2.36 KB
/
Copy pathtrace_bridging_test.erl
File metadata and controls
74 lines (54 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
% Copyright (C) 2020-2026 Olivier Boudeville
%
% This file is part of the Ceylan-Traces library.
%
% This library is free software: you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License or
% the GNU General Public License, as they are published by the Free Software
% Foundation, either version 3 of these Licenses, or (at your option)
% any later version.
% You can also redistribute it and/or modify it under the terms of the
% Mozilla Public License, version 1.1 or later.
%
% This library is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU Lesser General Public License and the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU Lesser General Public
% License, of the GNU General Public License and of the Mozilla Public License
% along with this library.
% If not, see <http://www.gnu.org/licenses/> and
% <http://www.mozilla.org/MPL/>.
%
% Author: Olivier Boudeville [olivier (dot) boudeville (at) esperide (dot) com]
% Creation date: Wednesday, October 21, 2020.
-module(trace_bridging_test).
-moduledoc """
Testing the **actual use of a trace bridge**, in the context of Ceylan-Traces.
See also, in Ceylan-Myriad, `trace_bridge_test.erl` for a similar test when no
specific bridge is registered.
""".
% Test target:
-include("traces_for_tests.hrl").
-doc "Runs the test.".
-spec run() -> no_return().
run() ->
?test_start,
?test_info( "Testing first when no trace bridge is registered." ),
% Note that we rely on the same test sending as the one done in Myriad, to
% better showcase it can be transparently switched:
%
trace_bridge_test:emit_traces(),
?test_info( "Then testing the trace bridge with a Ceylan-Traces bridge "
"registered for this test process." ),
% We define our own bridge spec and apply it to ourself:
BridgeSpec = trace_bridge:get_bridge_spec( _MyEmitterName="MyBridgeTester",
_MyCateg="MyTraceCategory", class_TraceAggregator:get_aggregator() ),
trace_bridge:register( BridgeSpec ),
trace_bridge:register_if_not_already( BridgeSpec ),
trace_bridge_test:emit_traces(),
trace_bridge:unregister(),
?test_debug_fmt( "End of test for ~ts.", [ ?MODULE ] ),
?test_stop.