Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/instrument #4226

Merged
merged 375 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
375 commits
Select commit Hold shift + click to select a range
17b3f68
Test mod_roster_get event with GraphQL
chrzaszcz Jun 10, 2024
dcd072d
Support multi-segment metric names in legacy metrics API
chrzaszcz Jun 7, 2024
d7f0a8a
Update tested metric name in metrics_api_SUITE
chrzaszcz Jun 7, 2024
e8f357f
Update vars to enable all_metrics_are_global for mim2
chrzaszcz Jun 7, 2024
4c8e4b5
Test the mod_disco_roster_get event
chrzaszcz Jun 7, 2024
c620cfa
Instrument mod_global_distrib_receiver
gustawlippa Jun 6, 2024
ccda7de
Start all global_distrib metrics globally
gustawlippa Jun 7, 2024
2d9a0db
Rename metrics
gustawlippa Jun 10, 2024
1a93b6b
Document metric name changes
gustawlippa Jun 10, 2024
0646e43
Merge pull request #4295 from esl/instrument/hook-handlers
arcusfelis Jun 10, 2024
b9d35aa
Replace `mongoose_metrics` with assertions
jacekwegr Jun 10, 2024
7d81424
Add wait_for event helper
gustawlippa Jun 11, 2024
3c2dda5
Instrument mod_pubsub
gustawlippa Jun 11, 2024
fc3690f
Merge branch 'feature/instrument' into instrument/mod_global_distrib
gustawlippa Jun 11, 2024
ff2feab
Merge pull request #4292 from esl/instrument/mod_global_distrib
gustawlippa Jun 12, 2024
2e7b823
Check event assertions with JID
jacekwegr Jun 11, 2024
7b2ab42
Merge pull request #4288 from esl/instrument-mod-ping
chrzaszcz Jun 12, 2024
16fc52c
Extract arg construction for readability
gustawlippa Jun 12, 2024
47a8941
Add assert_event helpers
gustawlippa Jun 12, 2024
8c4fb56
Use mongoose_instrument in privacy modules
chrzaszcz Jun 13, 2024
d18e0e0
Remove unused hooks and handlers
chrzaszcz Jun 13, 2024
9a91f3d
Test privacy events in big tests
chrzaszcz Jun 13, 2024
48159b4
Set up instrumentation events in amp_big_SUITE
chrzaszcz Jun 13, 2024
6d25e6b
Fix typo
gustawlippa Jun 13, 2024
984a8cc
Merge pull request #4297 from esl/instrument/pubsub
chrzaszcz Jun 13, 2024
05c4697
Instrument mod_websockets
arcusfelis Jun 12, 2024
e8026ce
Use instrumentation/0 for listeners and http_handlers
arcusfelis Jun 13, 2024
35b81ac
Add instrument_helper:declared_events/2 to allow call instrumentation/0
arcusfelis Jun 13, 2024
e8120df
Add comment about conflicting behaviours in mod_bosh
arcusfelis Jun 13, 2024
884d96b
Use export helper
arcusfelis Jun 13, 2024
90c7d75
Split line in instrument_helper
arcusfelis Jun 13, 2024
1076b67
Merge pull request #4299 from esl/instrument-websockets
chrzaszcz Jun 13, 2024
f5b57d4
Merge pull request #4298 from esl/instrument/hook-handlers-privacy
arcusfelis Jun 13, 2024
746df12
Add tests for cets instrument
arcusfelis Jun 6, 2024
aad5845
Restart probes after setting probe interval
arcusfelis Jun 10, 2024
ab32b55
Rename mongoose_instrument_probe_cets
arcusfelis Jun 10, 2024
098b16c
Stop mongoose_instrument_probe_cets in cets_disco_SUITE
arcusfelis Jun 10, 2024
dfe5229
Test cets metrics though graphql API
arcusfelis Jun 13, 2024
fef34cf
Remove duplicate in code
arcusfelis Jun 13, 2024
eaa838a
Remove ok from mongoose_instrument_probe_cets:start
arcusfelis Jun 14, 2024
e2932b6
Instrument user registration
chrzaszcz Jun 13, 2024
50db678
Add instrumentation to mongoose_gen_auth
chrzaszcz Jun 13, 2024
43fbd31
Add C2S TCP/TLS listener instrumentation metrics
arcusfelis Jun 14, 2024
387cf7e
Instrument anonymous user registration
chrzaszcz Jun 13, 2024
f84f6e0
Don't instrument the anonymous_purge hook
chrzaszcz Jun 13, 2024
ba8f64f
Remove metric handlers, for which there is new instrumentation
chrzaszcz Jun 13, 2024
d9c5061
Set up auth instrumentation in cleanup test
chrzaszcz Jun 13, 2024
e20de88
Test registration events in accounts_SUITE
chrzaszcz Jun 14, 2024
8af75af
Add anonymous_host_type - to be used in anonymous_SUIE
chrzaszcz Jun 14, 2024
6b90c51
Test registration events in anonymous_SUITE
chrzaszcz Jun 14, 2024
d2ab907
Remove registration metrics tests
chrzaszcz Jun 14, 2024
2cf5fb9
Merge pull request #4301 from esl/instrument/hook-handlers-auth
JanuszJakubiec Jun 17, 2024
d5e625c
Remove all_zeros from mongoose_instrument_probe_cets
arcusfelis Jun 17, 2024
de88a13
Add xmpp_stanza_size_sent/xmpp_stanza_size_received instrumentation
arcusfelis Jun 17, 2024
38a9ac8
Merge pull request #4296 from esl/instrument-cets-probe
chrzaszcz Jun 18, 2024
4f2bd26
Move xmpp_stanza_size_sent into mongoose_c2s
arcusfelis Jun 18, 2024
ffce191
Pass negative cases as a separate argument into instrument_helper:sta…
arcusfelis Jun 18, 2024
f33f178
Remove try..catch from elem_size/0
arcusfelis Jun 19, 2024
f8aba39
Adress review comments
arcusfelis Jun 19, 2024
073f925
Ignore dialyzer warning
arcusfelis Jun 19, 2024
6ee91a4
Merge pull request #4304 from esl/instrument_c2s
chrzaszcz Jun 19, 2024
e743336
Set up and execute the auth_failed event in mongoose_c2s
chrzaszcz Jun 18, 2024
2f41c02
Add session events to the sm module
chrzaszcz Jun 18, 2024
2a95306
Add the 'counter' metric, which is increased or decreased
chrzaszcz Jun 18, 2024
7cb0506
Support counter in exometer metrics
chrzaszcz Jun 18, 2024
0c10c53
Support counter in prometheus metrics
chrzaszcz Jun 18, 2024
4b5282a
Remove unused metric definitions
chrzaszcz Jun 14, 2024
423dfb0
Remove unused metrics
chrzaszcz Jun 18, 2024
1d0c157
Add missing host, which is detected by instrumentation
chrzaszcz Jun 18, 2024
fe2dcc2
Add unit tests for the new counter metric
chrzaszcz Jun 18, 2024
f13c5cb
Remove nonexistent test suite
chrzaszcz Jun 18, 2024
a231f60
Export 'filter' utility from instrument_helper
chrzaszcz Jun 18, 2024
65b26ae
Disable test in last_SUITE that leads to inconsistent metrics
chrzaszcz Jun 18, 2024
a1bd7d0
Fix indentation
chrzaszcz Jun 18, 2024
2e63f2c
Update metric names in the API test
chrzaszcz Jun 18, 2024
98cc1e1
Add host type to the tested subscription event
chrzaszcz Jun 18, 2024
f145184
Update session metrics tests
chrzaszcz Jun 18, 2024
7baafa9
Update metrics description in docs
chrzaszcz Jun 18, 2024
ccb47ee
Explicitly declare tested c2s events
chrzaszcz Jun 19, 2024
14280cf
Merge pull request #4305 from esl/instrument/hook-handlers-session
arcusfelis Jun 19, 2024
e156e3f
Add instrumentation for other auth events
arcusfelis Jun 24, 2024
74fe916
Add instrumentation for incoming and outgoing c2s XML elements
chrzaszcz Jun 24, 2024
b11bd4b
Map the new C2S instrumentation events to system metrics (analytics)
chrzaszcz Jun 24, 2024
9244dcd
Replace the xmpp_bounce_message hook with an event
chrzaszcz Jun 25, 2024
1dfd59c
Add 'drop_stanza' utility with instrumentation
chrzaszcz Jun 25, 2024
b6f984b
Call 'drop_stanza' utility instead of xmpp_stanza_dropped
chrzaszcz Jun 25, 2024
0ce1c13
Start and stop mongoose_router in the correct place
chrzaszcz Jun 25, 2024
d80c224
Remove metrics for C2S traffic, which are now handled by events
chrzaszcz Jun 24, 2024
8128c6b
Remove unused hooks: xmpp_bounce_message, xmpp_stanza_dropped
chrzaszcz Jun 25, 2024
3d5a3bc
Explicitly declare c2s events to test
chrzaszcz Jun 24, 2024
18e55d0
Update GraphQL metrics API tests with the new C2S event names
chrzaszcz Jun 24, 2024
2f9829c
Update REST metrics API tests with the new c2s event names
chrzaszcz Jun 24, 2024
6971657
Update c2s metrics tests to use the new events
chrzaszcz Jun 24, 2024
39093f8
Test the router_stanza_dropped event
chrzaszcz Jun 25, 2024
29c27d2
Fix small tests after instrumenting mongoose_router
chrzaszcz Jun 25, 2024
d433ed8
Update hooks description in docs
chrzaszcz Jun 25, 2024
3855cd4
Document new metrics for XMPP traffic
chrzaszcz Jun 25, 2024
7f14efe
Merge pull request #4310 from esl/instrument/hook-handlers-c2s
gustawlippa Jun 26, 2024
cc840c5
Move header file to include directory
gustawlippa Jun 20, 2024
d7435da
Call mongoose_credentials:auth_modules again
arcusfelis Jun 26, 2024
b4a112a
Fix auth_methods_for_c2s_SUITE
arcusfelis Jun 26, 2024
27a2f9f
Fix accounts_SUITE:admin_notify/1 for dynamic domains
arcusfelis Jun 26, 2024
62284e2
Instrument mongoose_wpool
gustawlippa Jun 18, 2024
b25f29f
Remove calls to mongoose_metrics
gustawlippa Jun 20, 2024
0a92b5a
Instrument rabbit worker
gustawlippa Jun 25, 2024
cce4a49
Fix slow tests
gustawlippa Jun 25, 2024
090c153
Rename pool stats event
gustawlippa Jun 25, 2024
1185f56
Fix typos and move metric to correct place
gustawlippa Jun 26, 2024
e30286d
Document new pool metric names
gustawlippa Jun 26, 2024
183802d
Merge pull request #4311 from esl/instrument-auth
chrzaszcz Jul 1, 2024
132532f
Code review: drop the mongoose_ prefix
gustawlippa Jul 1, 2024
be4d19c
Code review: start instrumentation instead of mocking
gustawlippa Jul 1, 2024
770c33a
Fix disconnection assertion
gustawlippa Jul 1, 2024
1a275d7
Rename metrics to instrumentation
gustawlippa Jul 2, 2024
5c27ad5
Extract get_rdbms_data_stats from mongoose_metrics.erl
gustawlippa Jul 2, 2024
5fea3e7
Test instrumentation events more correctly
gustawlippa Jul 2, 2024
bc5c502
Merge pull request #4306 from esl/instrument/pools
chrzaszcz Jul 2, 2024
8bf0609
Migrate session metrics to new instrumentation
jacekwegr Jun 27, 2024
01dd943
Change tests for session metrics
jacekwegr Jun 27, 2024
0797c79
Change docs for session metrics
jacekwegr Jun 27, 2024
3570a4d
Remove unused `create_probe_metric` function
jacekwegr Jun 28, 2024
49f75c6
Remove test related to deleted metric
jacekwegr Jul 2, 2024
146aa72
Move SM probes
jacekwegr Jul 2, 2024
6730fe5
Merge pull request #4313 from esl/instrument/sm-session
chrzaszcz Jul 3, 2024
fb0db9d
Make instrumentation assertions cover more cases
chrzaszcz Jul 2, 2024
7b8f93a
Change event table type to duplicate_bag
chrzaszcz Jul 3, 2024
7cf9170
Make mod_roster_push JID more specific (include resource)
chrzaszcz Jul 4, 2024
e85ac02
Use the new instrumentation assertions in mod_global_distrib_SUITE
chrzaszcz Jul 2, 2024
f539010
Use the new instrumentation assertions for wpool metrics
chrzaszcz Jul 3, 2024
b375b7d
Use the new instrumentation assertions in privacy tests
chrzaszcz Jul 4, 2024
6939f92
Use the new instrumentation assertions in other test suites
chrzaszcz Jul 4, 2024
b35227e
Fixing muc_prefs_cases in mam_SUITE
JanuszJakubiec Jul 4, 2024
68da361
Merge pull request #4315 from esl/fixing-mam-flaky-tests
chrzaszcz Jul 4, 2024
0684bd2
Merge pull request #4312 from esl/instrument/specific-assertions
gustawlippa Jul 4, 2024
a5407fb
Merge branch 'master' into feature/instrument
chrzaszcz Jul 5, 2024
8669545
Changing mam_SUITE to fix flaky tests
JanuszJakubiec Jul 5, 2024
c833a20
Instrument mongoose_router
gustawlippa Jul 8, 2024
980ee28
Replace global spirals with instrumentation
gustawlippa Jul 8, 2024
6ca9c02
Test router_no_route_found event
gustawlippa Jul 10, 2024
4b887df
Removing unnecessary end_per_group
JanuszJakubiec Jul 8, 2024
cde4b6a
Improve instrumentation checks
gustawlippa Jul 11, 2024
cc58dfc
Removing repaet_until_any_fail
JanuszJakubiec Jul 11, 2024
31ad729
Merge pull request #4321 from esl/fix-mam-flaky-tests
chrzaszcz Jul 11, 2024
efdf7d3
Migrate `user_cache` to new instrumentation
jacekwegr Jul 12, 2024
49a9b1d
Add tests for cache instrumentation
jacekwegr Jul 12, 2024
fd97605
Improve cache instrumentation tests
jacekwegr Jul 15, 2024
35f7e51
Put system-wide instrumentation probes in mongoose_system_probes
chrzaszcz Jul 15, 2024
9f4c738
Start and stop mongoose_system_probes
chrzaszcz Jul 15, 2024
ddba60b
Don't start CETS probe in tests
chrzaszcz Jul 15, 2024
933d553
Clean up removed metrics
chrzaszcz Jul 15, 2024
1cca9c8
Fix and update carbon_cache_server
chrzaszcz Jul 15, 2024
c1acffc
Clean up mongooseim_metrics_SUITE
chrzaszcz Jul 15, 2024
89431bc
Replace metric checks with instrumentation events in big tests
chrzaszcz Jul 15, 2024
696df68
Update graphql_metric_SUITE with the new gauges
chrzaszcz Jul 15, 2024
9608c19
Update metrics tested in metrics_api_SUITE
chrzaszcz Jul 15, 2024
31c2b20
Start `mongoose_instrument` in `batches_SUITE`
jacekwegr Jul 15, 2024
f1796e3
Test system probes in system_probes_SUITE
chrzaszcz Jul 15, 2024
b7123ff
Remove unused types (there are gauges now instead)
chrzaszcz Jul 15, 2024
5c7ea1c
Update docs with the new metric names
chrzaszcz Jul 15, 2024
8abfb09
Merge pull request #4323 from esl/instrument/user-cache
chrzaszcz Jul 15, 2024
e15f242
Split component/S2S transport metrics
gustawlippa Jul 11, 2024
88bc7ef
Rename stanza to element in metrics
gustawlippa Jul 12, 2024
d1bcacf
Test S2S events
gustawlippa Jul 15, 2024
b78784a
Rename sent/received to out/in
gustawlippa Jul 15, 2024
cf1c165
Fix test
gustawlippa Jul 15, 2024
5d52de6
Remove flaky tests
gustawlippa Jul 15, 2024
783dbea
Merge pull request #4317 from esl/instrument/global-metrics
jacekwegr Jul 16, 2024
1d93348
Remove the unused legacy probes
chrzaszcz Jul 16, 2024
a49b3c0
Move the prometheus handler to the correct location
chrzaszcz Jul 16, 2024
4ef5573
Merge pull request #4324 from esl/instrument/cleanup
jacekwegr Jul 16, 2024
cdfa58e
Merge branch 'feature/instrument' into instrument/router
chrzaszcz Jul 16, 2024
30e684c
Update mongooseim_metrics_SUITE to use instrumentation
chrzaszcz Jul 16, 2024
fe995bc
Improve docs and comments
chrzaszcz Jul 16, 2024
578bd1b
Accept multiple elements in one TCP packet for s2s event tests
chrzaszcz Jul 16, 2024
3d2012d
Merge pull request #4319 from esl/instrument/router
JanuszJakubiec Jul 17, 2024
d9eed9d
Merge branch 'master' into feature/instrument
chrzaszcz Jul 24, 2024
8933814
Add opts to 'start' and 'stop' callbacks in mongoose_instrument
chrzaszcz Jul 23, 2024
aa43be2
Add Graphite reporter support to mongoose_instrument_exometer
chrzaszcz Jul 23, 2024
aef513d
Remove reporters from mongoose_metrics
chrzaszcz Jul 23, 2024
45ac171
Update start/stop in the event table
chrzaszcz Jul 23, 2024
b359f66
Wait for linked processes in async_helper
chrzaszcz Jul 23, 2024
fcfcf85
Make carbon_cache_server easier to use
chrzaszcz Jul 23, 2024
e00bd88
Test configuration options of the graphite reporter
chrzaszcz Jul 23, 2024
bfe7a07
Add 'report' option to test
chrzaszcz Jul 23, 2024
e12d33f
Replace legacy reporter tests with exometer_report_SUITE
chrzaszcz Jul 23, 2024
2b08cc0
Remove obsolete reporter configuration from app.config
chrzaszcz Jul 24, 2024
b07999b
Merge pull request #4326 from esl/instrument/exometer_report
gustawlippa Jul 24, 2024
f5d8642
Migrate `async_pools` to `mongoose_instrument`
jacekwegr Jul 25, 2024
07270d1
Test async pool request event
jacekwegr Jul 25, 2024
87a2188
Test async pool flush event
jacekwegr Jul 25, 2024
60e1b6f
Update small tests for async pools
jacekwegr Jul 25, 2024
b54495d
Turn off automatic Prometheus metric configuration for time units
chrzaszcz Jul 25, 2024
6b9bc1e
Clean up exometer_report_SUITE
chrzaszcz Jul 25, 2024
bd46278
Remove unused `mongoose_metrics` functions
jacekwegr Jul 25, 2024
11f0193
Change `async_pools` metric type
jacekwegr Jul 26, 2024
725b351
Add prometheus_endpoint_SUITE for testing the exposed metrics
chrzaszcz Jul 25, 2024
86efd89
Stop instrumentation apps in tests for clean state
chrzaszcz Jul 26, 2024
3c21c8c
Fix flaky `async_pools` instrumentation tests
jacekwegr Jul 26, 2024
fc8fb35
Merge pull request #4335 from esl/instrument/test-prometheus-endpoint
jacekwegr Jul 29, 2024
72c3de4
Parallelize `async_workers` tests
jacekwegr Jul 30, 2024
2d51539
Merge pull request #4337 from esl/instrument/async-pools
chrzaszcz Jul 31, 2024
15dfed0
Merge branch 'master' into feature/instrument
chrzaszcz Jul 31, 2024
9292213
Bring back missing tests for dropped messages
jacekwegr Jul 31, 2024
574f351
Merge pull request #4352 from esl/instrument/bring-back-dropped-msgs-…
arcusfelis Aug 1, 2024
83c78fd
Fix GraphQL documentation building
gustawlippa Aug 12, 2024
0e8cf4b
Merge pull request #4356 from esl/fix_GraphQL_docs
NelsonVides Aug 12, 2024
bc4ceb6
Add header links
gustawlippa Aug 1, 2024
bf7880e
Add next/previous page links
gustawlippa Aug 1, 2024
148ee0f
Fix incorrect port documentation
gustawlippa Aug 1, 2024
7387a8d
Document instrumentation configuration
gustawlippa Aug 2, 2024
bff4e00
Fix metric measurement and rename
gustawlippa Aug 6, 2024
086c124
Make links to tabbed content more readible
gustawlippa Aug 7, 2024
bd26b05
Document Prometheus endpoint
gustawlippa Aug 7, 2024
4bde3b3
Present Prometheus/Exometer as an alternative
gustawlippa Aug 7, 2024
b9c5bcb
Document new metrics
gustawlippa Aug 7, 2024
30190ee
Update metrics documentation in modules
gustawlippa Aug 9, 2024
17da31c
Remove `general.all_metrics_are_global` option
jacekwegr Aug 1, 2024
4dd3de4
Remove `mongoose_metrics` from code
jacekwegr Aug 8, 2024
91beb0e
Remove `mongoose_metrics` from documentation
jacekwegr Aug 9, 2024
65ccdf0
Remove unused function from `metrics_roster_SUITE`
jacekwegr Aug 12, 2024
643f99d
Refactor `get_metric_value` function
jacekwegr Aug 12, 2024
9636520
Review: Fix typos and phrasing
gustawlippa Aug 13, 2024
e0e819c
Apply code review: fix typos, wrong descriptions
gustawlippa Aug 13, 2024
6087044
Merge pull request #4355 from esl/docs/instrumentation
jacekwegr Aug 13, 2024
bb07208
Merge pull request #4353 from esl/instrument/remove-mongoose-metrics
gustawlippa Aug 13, 2024
5eeb673
Add migration info
gustawlippa Aug 16, 2024
89683a6
Document metrics migration
gustawlippa Aug 16, 2024
9bfdfca
Correct "prefix" to "suffix"
gustawlippa Aug 19, 2024
f200b6a
Clarify simple Prometheus configuration
gustawlippa Aug 19, 2024
229b40d
Merge pull request #4358 from esl/instrumentation/migration_guide
chrzaszcz Aug 20, 2024
0c74dd0
Correct module name
gustawlippa Aug 19, 2024
4447d7e
Remove StatsD reporter mention
gustawlippa Aug 19, 2024
6b436b4
Clarify Prometheus endpoint
gustawlippa Aug 19, 2024
a4f6dc3
Add all_metrics_are_global description
gustawlippa Aug 19, 2024
b8969b5
Describe loglevel option
gustawlippa Aug 20, 2024
4aaa227
Fix event name
gustawlippa Aug 20, 2024
7575e72
Add missing word
gustawlippa Aug 20, 2024
aabaeeb
Fix module name
gustawlippa Aug 20, 2024
07a87d2
Fix event name
gustawlippa Aug 20, 2024
30e16c6
Fix event name
gustawlippa Aug 20, 2024
03ecfe6
Fix event name
gustawlippa Aug 20, 2024
df0da1e
Fix Exometer event type
gustawlippa Aug 20, 2024
5774c7f
Document when probes are updated clearly
gustawlippa Aug 20, 2024
e4b8918
Fix mod_ping_response_timeout_count event name
gustawlippa Aug 20, 2024
3f3a664
Rephrase all_metrics_are_global description
gustawlippa Aug 20, 2024
9a8a509
Note logging verbosity and possible level override
gustawlippa Aug 20, 2024
2bf2b51
Merge pull request #4360 from esl/instrumentation/documentation_fixes
chrzaszcz Aug 21, 2024
0da2372
Adding instrumentation and prometheus to prod configuration
JanuszJakubiec Aug 29, 2024
95f71bb
Merge pull request #4368 from esl/prod-config-changes
chrzaszcz Sep 6, 2024
a66c1b8
Merge branch 'master' into feature/instrument
JanuszJakubiec Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ jobs:
- run:
name: Build GraphQL static docs
command: |
npm install --prefix=$HOME/.local --global spectaql
npm install --global cheerio@1.0.0-rc.12 spectaql
npx spectaql -t doc/graphql-api -f admin-graphql-doc.html doc/graphql-api/Admin-GraphQL_spectaql.yml
npx spectaql -C -J -t doc/graphql-api -f user-graphql-doc.html doc/graphql-api/User-GraphQL_spectaql.yml
- run:
Expand Down
2 changes: 1 addition & 1 deletion big_tests/default.spec
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
{suites, "tests", mam_send_message_SUITE}.
{suites, "tests", metrics_api_SUITE}.
{suites, "tests", metrics_c2s_SUITE}.
{suites, "tests", metrics_register_SUITE}.
{suites, "tests", metrics_roster_SUITE}.
{suites, "tests", metrics_session_SUITE}.
{suites, "tests", mod_blocking_SUITE}.
Expand Down Expand Up @@ -108,6 +107,7 @@
{suites, "tests", sic_SUITE}.
{suites, "tests", smart_markers_SUITE}.
{suites, "tests", sm_SUITE}.
{suites, "tests", system_probes_SUITE}.
{suites, "tests", vcard_SUITE}.
{suites, "tests", vcard_simple_SUITE}.
{suites, "tests", websockets_SUITE}.
Expand Down
4 changes: 3 additions & 1 deletion big_tests/dynamic_domains.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{host_type, <<"test type">>},
{secondary_domain, <<"domain.example.org">>},
{secondary_host_type, <<"test type">>},
{anonymous_host_type, <<"anonymous">>},
{dynamic_domains, [{<<"test type">>, [<<"domain.example.com">>, <<"domain.example.org">>]},
{<<"anonymous">>, [<<"anonymous.example.com">>]}]},
{muc_service, <<"groupchats.domain.example.com">>},
Expand Down Expand Up @@ -119,7 +120,8 @@
{wspath, <<"/ws-xmpp">>}]},
{admin, [
{username, <<"admin">>},
{server, <<"localhost">>},
{server, <<"domain.example.com">>},
{host, <<"localhost">>},
{password, <<"bruce_almighty">>}]},
{secure_joe, [
{username, <<"secure_joe">>},
Expand Down
3 changes: 1 addition & 2 deletions big_tests/dynamic_domains.spec
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@

{suites, "tests", metrics_c2s_SUITE}.

{suites, "tests", metrics_register_SUITE}.

{suites, "tests", metrics_roster_SUITE}.

{suites, "tests", metrics_session_SUITE}.
Expand Down Expand Up @@ -154,6 +152,7 @@

{suites, "tests", smart_markers_SUITE}.
{suites, "tests", sm_SUITE}.
{suites, "tests", system_probes_SUITE}.
{suites, "tests", vcard_SUITE}.
{suites, "tests", vcard_simple_SUITE}.
{suites, "tests", websockets_SUITE}.
Expand Down
2 changes: 1 addition & 1 deletion big_tests/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
{vars, "mim1"},
{cluster, mim},
{secondary_domain, <<"localhost.bis">>},
{reloaded_domain, <<"sogndal">>},
{secondary_host_type, <<"localhost.bis">>},
{anonymous_host_type, <<"anonymous.localhost">>},
{muc_service, <<"muc.localhost">>},
{muc_service_pattern, <<"muc.@HOST@">>},
{muc_light_service, <<"muclight.localhost">>},
Expand Down
49 changes: 30 additions & 19 deletions big_tests/tests/accounts_SUITE.erl
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
-module(accounts_SUITE).
-compile([export_all, nowarn_export_all]).

-include_lib("escalus/include/escalus.hrl").
-include_lib("escalus/include/escalus_xmlns.hrl").

-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").

-include_lib("exml/include/exml.hrl").

-import(distributed_helper, [mim/0,
require_rpc_nodes/1,
rpc/4]).

-import(distributed_helper, [mim/0, require_rpc_nodes/1, rpc/4]).
-import(mongoose_helper, [wait_for_user/3]).

-import(auth_helper, [assert_event/2]).
-import(domain_helper, [domain/0, host_type/0]).

%%--------------------------------------------------------------------
Expand All @@ -37,6 +30,7 @@ all() ->

groups() ->
[{register, [parallel], [register,
unregister,
already_registered,
registration_conflict,
check_unregistered]},
Expand Down Expand Up @@ -68,13 +62,15 @@ change_password_tests() ->
%%--------------------------------------------------------------------

init_per_suite(Config1) ->
instrument_helper:start(instrument_helper:declared_events(ejabberd_auth)),
ok = dynamic_modules:ensure_modules(host_type(), required_modules()),
Config2 = [{mod_register_options, mod_register_options()} | Config1],
escalus:init_per_suite([{escalus_user_db, xmpp} | Config2]).

end_per_suite(Config) ->
escalus_fresh:clean(),
escalus:end_per_suite(Config).
escalus:end_per_suite(Config),
instrument_helper:stop().

required_modules() ->
[{mod_register, mod_register_options()}].
Expand Down Expand Up @@ -178,23 +174,37 @@ end_per_testcase(CaseName, Config) ->

register(Config) ->
[{Name1, _UserSpec1}, {Name2, _UserSpec2}] = escalus_users:get_users([alice, bob]),
escalus_fresh:create_users(Config, escalus:get_users([Name1, Name2])).
Config1 = escalus_fresh:create_users(Config, escalus:get_users([Name1, Name2])),
assert_event(auth_register_user, escalus_users:get_jid(Config1, Name1)),
assert_event(auth_register_user, escalus_users:get_jid(Config1, Name2)),
assert_event(auth_try_register, escalus_users:get_jid(Config1, Name1)),
assert_event(auth_try_register, escalus_users:get_jid(Config1, Name2)),
assert_event(auth_does_user_exist, escalus_users:get_jid(Config1, Name1)),
assert_event(auth_does_user_exist, escalus_users:get_jid(Config1, Name2)).

unregister(Config) ->
UserSpec = escalus_fresh:freshen_spec(Config, alice),
escalus_users:create_user(Config, {alice, UserSpec}),
escalus_users:delete_user(Config, {alice, UserSpec}),
assert_event(auth_unregister_user, escalus_users:get_jid(Config, UserSpec)).

already_registered(Config) ->
escalus_fresh:story(Config, [{alice, 1}], fun(Alice) ->
escalus:send(Alice, escalus_stanza:get_registration_fields()),
Stanza = escalus:wait_for_stanza(Alice),
escalus:assert(is_iq_result, Stanza),
true = has_registered_element(Stanza)
escalus_fresh:story(Config, [{alice, 1}], fun already_registered_story/1).

already_registered_story(Alice) ->
AliceJid = escalus_utils:get_short_jid(Alice),
assert_event(auth_register_user, AliceJid), % one event expected
escalus:send(Alice, escalus_stanza:get_registration_fields()),
Stanza = escalus:wait_for_stanza(Alice),
escalus:assert(is_iq_result, Stanza),
true = has_registered_element(Stanza),
assert_event(auth_register_user, AliceJid). % still one event - nothing new

end).
registration_conflict(Config) ->
[Alice] = escalus_users:get_users([alice]),
{ok, result, _Stanza} = escalus_users:create_user(Config, Alice),
{ok, conflict, _Raw} = escalus_users:create_user(Config, Alice).



admin_notify(Config) ->
[{Name1, UserSpec1}, {Name2, UserSpec2}] = escalus_users:get_users([alice, bob]),
[{_, AdminSpec}] = escalus_users:get_users([admin]),
Expand All @@ -204,6 +214,7 @@ admin_notify(Config) ->

rpc(mim(), ejabberd_auth, try_register, [mongoose_helper:make_jid(AdminU, AdminS), AdminP]),
escalus:story(Config, [{admin, 1}], fun(Admin) ->
assert_event(auth_authorize, escalus_utils:get_jid(Admin)),
escalus:create_users(Config, escalus:get_users([Name1, Name2])),

Predicates = [
Expand Down
10 changes: 9 additions & 1 deletion big_tests/tests/amp_big_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ init_per_suite(Config) ->
{Mod, Code} = dynamic_compile:from_string(amp_test_helper_code()),
rpc(mim(), code, load_binary, [Mod, "amp_test_helper.erl", Code]),
setup_meck(suite),
instrument_helper:start(declared_events()),
escalus:init_per_suite(ConfigWithHooks).

amp_test_helper_code() ->
Expand All @@ -131,10 +132,17 @@ amp_test_helper_code() ->
" _ -> meck:passthrough([Socket, Data])\n"
" end.\n".

declared_events() ->
[ % tested by privacy helpers
{mod_privacy_set, #{host_type => host_type()}},
{mod_privacy_get, #{host_type => host_type()}}
].

end_per_suite(C) ->
teardown_meck(suite),
escalus_fresh:clean(),
escalus:end_per_suite(C).
escalus:end_per_suite(C),
instrument_helper:stop().

init_per_group(GroupName, Config) ->
Config1 = case lists:member(GroupName, main_group_names()) of
Expand Down
25 changes: 22 additions & 3 deletions big_tests/tests/anonymous_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ suite() ->
%% Init & teardown
%%--------------------------------------------------------------------
init_per_suite(Config) ->
instrument_helper:start(declared_events()),
escalus:init_per_suite(Config).

end_per_suite(Config) ->
escalus:end_per_suite(Config).
escalus:end_per_suite(Config),
instrument_helper:stop().

init_per_testcase(CaseName, Config0) ->
NewUsers = escalus_ct:get_config(escalus_anon_users),
Expand All @@ -67,23 +69,27 @@ end_per_testcase(CaseName, Config) ->
connection_is_registered_with_sasl_anon(Config) ->
escalus:story(Config, [{jon, 1}], fun(Jon) ->
JID = jid:from_binary(escalus_client:short_jid(Jon)),
assert_event(auth_anonymous_register_user, JID),
OrigName = escalus_users:get_username(Config, jon),
?assertNotEqual(OrigName, JID#jid.luser),
F = fun() -> rpc(mim(), ejabberd_auth, does_user_exist, [JID]) end,
true = F(),
escalus_connection:kill(Jon),
mongoose_helper:wait_until(F, false)
mongoose_helper:wait_until(F, false),
assert_event(auth_anonymous_unregister_user, JID)
end).

connection_is_registered_with_login(Config) ->
escalus:story(Config, [{anna, 1}], fun(Anna) ->
JID = jid:from_binary(escalus_client:short_jid(Anna)),
assert_event(auth_anonymous_register_user, JID),
OrigName = escalus_users:get_username(Config, anna),
?assertEqual(OrigName, JID#jid.luser),
F = fun() -> rpc(mim(), ejabberd_auth, does_user_exist, [JID]) end,
true = F(),
escalus_connection:kill(Anna),
mongoose_helper:wait_until(F, false)
mongoose_helper:wait_until(F, false),
assert_event(auth_anonymous_unregister_user, JID)
end).

messages_story(Config) ->
Expand All @@ -94,3 +100,16 @@ messages_story(Config) ->
%% Below's dirty, but there is no other easy way...
escalus_assert:is_chat_message(<<"Hi!">>, Stanza)
end).

%% Helpers

declared_events() ->
instrument_helper:declared_events(ejabberd_auth_anonymous, [host_type()]).

host_type() ->
domain_helper:anonymous_host_type().

assert_event(EventName, #jid{luser = LUser, lserver = LServer}) ->
instrument_helper:assert_one(
EventName, #{host_type => host_type()},
fun(M) -> M =:= #{count => 1, user => LUser, server => LServer} end).
27 changes: 27 additions & 0 deletions big_tests/tests/auth_helper.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-module(auth_helper).
-export([assert_event/2]).

-include_lib("jid/include/jid.hrl").
-import(domain_helper, [host_type/0]).

assert_event(EventName, BinJid)
when EventName =:= auth_unregister_user; EventName =:= auth_register_user ->
#jid{luser = LUser, lserver = LServer} = jid:from_binary(BinJid),
F = fun(M) ->
M =:= #{count => 1, user => LUser, server => LServer}
end,
instrument_helper:assert_one(EventName, #{host_type => host_type()}, F);
assert_event(EventName, BinJid)
when EventName =:= auth_authorize ->
#jid{lserver = LServer} = jid:from_binary(BinJid),
F = fun(#{time := Time, count := 1, server := Server}) ->
(Time > 0) and (Server =:= LServer)
end,
%% Note: this could match events from other tests because there is no user name
instrument_helper:assert(EventName, #{host_type => host_type()}, F);
assert_event(EventName, BinJid) ->
#jid{luser = LUser, lserver = LServer} = jid:from_binary(BinJid),
F = fun(#{time := Time, count := 1, user := User, server := Server}) ->
(Time > 0) and (User =:= LUser) and (Server =:= LServer)
end,
instrument_helper:assert_one(EventName, #{host_type => host_type()}, F).
41 changes: 26 additions & 15 deletions big_tests/tests/auth_methods_for_c2s_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
-include_lib("exml/include/exml.hrl").

-import(distributed_helper, [mim/0, rpc/4]).
-import(auth_helper, [assert_event/2]).

all() ->
[
{group, two_methods_enabled},
{group, metrics}
{group, instrumentation}
].

groups() ->
Expand All @@ -20,29 +21,37 @@ groups() ->
cannot_login_with_not_allowed_method,
can_login_to_another_listener
]},
{metrics, [],
{instrumentation, [],
[
metrics_incremented_on_user_connect
instrumentation_incremented_on_user_connect
]}
].

suite() ->
distributed_helper:require_rpc_nodes([mim]) ++ escalus:suite().

init_per_suite(Config) ->
escalus:init_per_suite(Config).

end_per_suite(Config) ->
escalus:end_per_suite(Config).

init_per_group(metrics, Config) ->
set_auth_mod(Config);
init_per_group(instrumentation, Config) ->
Config2 = set_auth_mod(Config),
instrument_helper:start(events()),
Config2;
init_per_group(_, Config0) ->
Config1 = ejabberd_node_utils:init(Config0),
ejabberd_node_utils:backup_config_file(Config1),
Config2 = modify_config_and_restart(Config1),
instrument_helper:start(events()),
escalus_cleaner:start(Config2).

end_per_group(metrics, _Config) ->
end_per_group(instrumentation, _Config) ->
instrument_helper:stop(),
escalus_fresh:clean();
end_per_group(_, Config) ->
instrument_helper:stop(),
ejabberd_node_utils:restore_config_file(Config),
ejabberd_node_utils:restart_application(mongooseim),
escalus_fresh:clean().
Expand Down Expand Up @@ -93,24 +102,24 @@ can_login_to_another_listener(Config) ->
TlsPort = ct:get_config({hosts, mim, c2s_tls_port}),
Spec2 = [{port, TlsPort}, {ssl, true}, {ssl_opts, [{verify, verify_none}]},
{password, <<"wrong">>} | Spec],
{ok, _, _} = escalus_connection:start(Spec2).
{ok, Conn, _} = escalus_connection:start(Spec2),
assert_event(auth_authorize, escalus_utils:get_jid(Conn)).

metrics_incremented_on_user_connect(ConfigIn) ->
instrumentation_incremented_on_user_connect(Config) ->
F = fun(Alice, Bob) ->
Body = <<"Hello Bob">>,
escalus:send(Alice, escalus_stanza:chat_to(Bob, Body)),
escalus:assert(is_chat_message, [Body], escalus:wait_for_stanza(Bob))
escalus:assert(is_chat_message, [Body], escalus:wait_for_stanza(Bob)),
assert_event(auth_authorize, escalus_utils:get_jid(Alice)),
assert_event(auth_authorize, escalus_utils:get_jid(Bob))
end,
HostType = domain_helper:host_type(),
HostTypePrefix = domain_helper:make_metrics_prefix(HostType),
MongooseMetrics = [{[HostTypePrefix, backends, auth, authorize], changed}],
Config = [{mongoose_metrics, MongooseMetrics} | ConfigIn],
escalus_fresh:story(Config, [{alice, 1}, {bob, 1}], F).

%% Helpers
%% If dummy backend is enabled, it is not possible to create new users
%% (we check if an user does exist before registering the user).
register_user(Config, Spec) ->
%% Calls backend module directly, so instrumentation is not called in this case.
Mod = proplists:get_value(auth_mod, Config),
#{username := User, server := Server,
password := Password} = maps:from_list(Spec),
Expand All @@ -119,5 +128,7 @@ register_user(Config, Spec) ->
HostType = domain_helper:host_type(),
ok = rpc(mim(), Mod, try_register,
[HostType, LUser, LServer, Password]),
fun() -> rpc(mim(), Mod, remove_user,
[HostType, LUser, LServer]) end.
fun() -> rpc(mim(), Mod, remove_user, [HostType, LUser, LServer]) end.

events() ->
[{auth_authorize, #{host_type => domain_helper:host_type()}}].
Loading