Commit Graph

547 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron debe2a118c
rabbitmq_ct_helpers: Change how Mnesia/Khepri is selected
[Why]
Once `khepr_db` is enabled by default, we need another way to disable it
to select Mnesia instead.

[How]
We use the new relative forced feature flags mechanism to indicate if we
want to explicitly enable or disable `khepri_db`. This way, we don't
touch other stable feature flags and only mess with Khepri.

However, this mechanism is not supported by RabbitMQ 4.0.x and older.
They will ignore the setting. Therefore, to make this work in
mixed-version testing, we set the `$RABBITMQ_FEATURE_FLAGS` variable for
the secondary umbrella. This part will go away once we test against
RabbitMQ 4.1.x as the secondary umbrella in the future.

At the end, we compare the effective metadata store to the expected one.
If they don't match, we skip the test.

While here, change `rjms_topic_selector_SUITE` to only choose Khepri
without specifying any feature flags.
2024-12-17 09:56:54 +01:00
Michael Klishin 1cae417dbf
Merge pull request #12821 from rabbitmq/rabbitmq-server-12776
Definition export: inject default queue type into virtual host metadata
2024-11-27 14:53:25 -05:00
Michael Klishin 090d11818f
HTTP API tests for injected default queue type 2024-11-26 18:00:37 -05:00
Diana Parra Corbacho ca0a450f3b Tests: SSL certificates
Parallel/sharding groups often fail to create certificates in CI.
Most likely it is related to the fact they use the same directory
for certificates. This commit uses shard/node name and unique id
for each SSL certificate
2024-11-25 14:46:05 +01:00
GitHub 873d54a088 bazel run gazelle 2024-11-21 04:02:30 +00:00
Péter Gömöri 9bb7530d04
Move client-side stream protocol test helpers to a separate module
So that they can be used from multiple test suites.

(cherry picked from commit cf8a00c5db)
2024-11-19 19:13:59 -05:00
Michael Klishin 961e5c5a21
Undo the Bazel-related change from #12696
(cherry picked from commit a66c926985)
2024-11-09 17:47:06 -05:00
Michael Klishin 673826425a
Merge pull request #12696 from rabbitmq/mk-http-api-lower-body-length-limit-for-binding-creation
HTTP API: reduce body size limit for the endpoint used to bind queues/streams/exchanges
2024-11-09 17:13:03 -05:00
Michael Klishin 3dc5c463a4
Pass Dialyzer 2024-11-09 16:53:45 -05:00
Marcial Rosales e7cb2420a7 Verify non-zero DNS and email SAN 2024-10-29 16:41:20 +01:00
Loïc Hoguin f68fc8bb94
Make CI: Add mixed version testing
This is enabled on main and for pull requests. Bazel remains
used in previous branches.
2024-10-25 13:50:05 +02:00
Loïc Hoguin 4127f15676
Make CI: Bazel updates following ct_master work 2024-10-15 14:57:42 +02:00
Loïc Hoguin 8d411c7cda
Make CI: Print auto-skipped and failed test cases at the end
Of a ct_master run. This uses the builtin CT Master event
handler to gather the results.
2024-10-15 14:57:42 +02:00
Loïc Hoguin 655caf6d1a
Make CI: Have ct_master return the test results
Instead of having a CT hook just to know whether our tests failed.
2024-10-15 14:57:42 +02:00
Loïc Hoguin dddf917378
Make CI: Sort the results printout from ct_master
It makes more sense to sort by node name, than to have
the results in the order they finished.
2024-10-15 14:57:42 +02:00
Loïc Hoguin 6cdc32f558
Make CI: Make ct_master handle all testspec instructions 2024-10-15 14:57:42 +02:00
Loïc Hoguin 77ab5eddcb
Reduce the amount of printing to the terminal during tests 2024-10-15 14:57:42 +02:00
Loïc Hoguin 1897e02764
Make CI: Fix a small issue in master_runs.html 2024-10-15 14:57:42 +02:00
Loïc Hoguin ce7184598c
Make CI: Fix the master_runs.html css file paths
Needed to file:set_cwd like in normal CT.
2024-10-15 14:57:42 +02:00
Loïc Hoguin 37c2f9f675
Make CI: Don't refresh logs at the end of ct_master run
The ct_run:run_test function already takes care of the
node's logs. The ct_master_logs module takes care of
ct_master itself.
2024-10-15 14:57:41 +02:00
Loïc Hoguin 807c8f8a0b
Make CI: Add forks of ct_master_event and ct_master_logs 2024-10-15 14:57:41 +02:00
GitHub b9bb3014c0 bazel run gazelle 2024-10-08 04:02:25 +00:00
Loïc Hoguin 9645fb1275
Make parallel-ct properly detect test failures
The problem comes from `ct_master` which doesn't tell us
in the return value whether the tests succeeded. In order
to get that information a CT hook was created. But then
we run into another problem: despite its documentation
claiming otherwise, `ct_master` does not handle `ct_hooks`
instructions in the test spec.

So for the time being we fork `ct_master` into a new
`ct_master_fork` module and insert our hook directly
in the code. Later on we will submit patches to OTP.
2024-10-07 13:30:32 +02:00
Loïc Hoguin 7fe78a3af9
Better fix for a Dialyzer warning
The previous fix was leading to a badmatch in some cases,
including when trying to stop a node that was already stopped.
2024-09-30 14:25:01 +02:00
Loïc Hoguin f54e307aee
CT: No longer wait 3 minutes for node start
Reverting back to the default 1 minute. The problem with
3 minutes is that this is exceedingly long and when there
are problems the test time increases exponentially.
2024-09-30 12:35:44 +02:00
Loïc Hoguin 67eee5602c
Fix OTP-27 Dialyzer errors in rabbitmq_ct_helpers 2024-09-30 12:35:43 +02:00
Simon Unge b2904404da Use openssl.cnf config when generating new CSR 2024-09-10 17:20:41 +00:00
Loïc Hoguin 4a118c25f9
make: Fix regressions following make plugins cleanup 2024-09-10 15:42:28 +02:00
Michael Davis a3ca1bba6c
Explicitly match skips when setting metadata store in CT
This causes a clearer error when the `enable_feature_flags/2` function
returns something not in the shape `ok | {skip, any()}`.
2024-09-09 09:06:39 -04:00
Michael Klishin 94baa7cfd4
Merge pull request #11702 from rabbitmq/mqtt-extract-client-id-from-cert
Extract MQTT client_id from client certificate and propagate to authnz backends
2024-09-03 10:53:19 -04:00
Marcial Rosales 1abc4ed02f Extract client_id from client cert 2024-08-30 11:39:48 +01:00
Loïc Hoguin a17fb13a03
make: Initial work on using ct_master to run tests
Because `ct_master` is yet another Erlang node, and it is used
to run multiple CT nodes, meaning it is in a cluster of CT
nodes, the tests that change the net_ticktime could not
work properly anymore. This is because net_ticktime must
be the same value across the cluster.

The same value had to be set for all tests in order to solve
this. This is why it was changed to 5s across the board. The
lower net_ticktime was used in most places to speed up tests
that must deal with cluster failures, so that value is good
enough for these cases.

One test in amqp_client was using the net_ticktime to test
the behavior of the direct connection timeout with varying
net_ticktime configurations. The test now mocks the
`net_kernel:get_net_ticktime()` function to achieve the
same result.
2024-08-29 15:23:31 +02:00
Loïc Hoguin 7ad8e2856b
make: Restrict Erlang.mk plugin inclusion
This has no real impact on performance[1] but should
make it clear which application can run the broker
and/or publish to Hex.pm. In particular, applications
that we can't run the broker from will now give up
early if we try to.

Note that while the broker can't normally run from the
amqp_client application's directory, it can run from
tests and some of the tests start the broker.

[1] on my machine
2024-08-29 15:19:50 +02:00
Loïc Hoguin d4222f8216
make: Remove emptied rabbitmq-tools.mk 2024-08-29 15:19:14 +02:00
Michael Klishin 768b2f6925 Update HTTP API tests
This relaxes assert_list/2 assertion to
not require the size of an actually returned list element
to be exactly equal to the size of the expected one.

Sometimes it makes perfect sense to not assert on
every single key but only a subset, and with this
change, it now will be possible.

Individual tests may choose to assert on all
keys by listing them explicitly.
2024-08-24 14:50:37 -04:00
Simon Unge 5189adf144 Add qq status to mgmt api 2024-08-20 23:55:11 -04:00
David Ansari b6fbc0292a Maintain order of configured SASL mechanisms
RabbitMQ should advertise the SASL mechanisms in the order as
configured in `rabbitmq.conf`.

Starting RabbitMQ with the following `rabbitmq.conf`:
```
auth_mechanisms.1 = PLAIN
auth_mechanisms.2 = AMQPLAIN
auth_mechanisms.3 = ANONYMOUS
```

translates prior to this commit to:
```
1> application:get_env(rabbit, auth_mechanisms).
{ok,['ANONYMOUS','AMQPLAIN','PLAIN']}
```

and after this commit to:
```
1> application:get_env(rabbit, auth_mechanisms).
{ok,['PLAIN','AMQPLAIN','ANONYMOUS']}
```

In our 4.0 docs we write:
> The server mechanisms are ordered in decreasing level of preference.

which complies with https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-security-v1.0-os.html#type-sasl-mechanisms
2024-08-16 14:38:36 +02:00
Michael Davis 543bf76a74
Add `cluster_upgrade_SUITE` to check mixed-version upgrades
This suite uses the mixed version secondary umbrella as a starting
version for a cluster and then has a helper to upgrade the cluster to
the current code. This is meant to ensure that we can upgrade from the
previous minor.
2024-08-09 16:23:35 -04:00
David Ansari 8ba36492ad Reduce Khepri test flakes
Test case rabbit_mqtt_qos0_queue_kill_node flaked because after an
MQTT client subscribes on node 0, RabbitMQ returns success
and replicated the new binding to node 0 and node 1, but not
yet to node 2. Another MQTT client then publishes on node 2
without the binding being present yet on node 2, and the
message therefore isn't routed.

This commit attempts to eliminate this flake.
It adds a function to rabbit_ct_broker_helpers which waits until a given
node has caught up with the leader node.
We can reuse that function in future to eliminate more test flakes.
2024-08-06 22:01:17 +02:00
Loïc Hoguin bbfa066d79
Cleanup .gitignore files for the monorepo
We don't need to duplicate so many patterns in so many
files since we have a monorepo (and want to keep it).

If I managed to miss something or remove something that
should stay, please put it back. Note that monorepo-wide
patterns should go in the top-level .gitignore file.
Other .gitignore files are for application or folder-
specific patterns.
2024-06-28 12:00:52 +02:00
Loïc Hoguin af49f5c526
make: Remove FAST_RUN_BROKER; make normal run-broker fast
The DIST step used rsync for copying files; changing this
to using cp/rm provides a noticeable speed boost.

Before this commit the situation was as follows. With
FAST_RUN_BROKER=1 we are pretty fast but don't benefit
from parallel make:

  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=1
    2,04s user 1,57s system 90% cpu 4,016 total
  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=1 -j8
    2,08s user 1,55s system 89% cpu 4,069 total

With FAST_RUN_BROKER=0 we are slow; on the other hand
we greatly benefit from parallel make:

  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0
    3,29s user 1,93s system 81% cpu 6,425 total
  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0 -j8
    3,36s user 1,90s system 142% cpu 3,695 total

The reason this method achieves such a result is because
the DIST step that takes a lot of time can be run in
parallel. In addition, this method results on only
the necessary plugins being available in the path,
therefore it doesn't discover unrelated plugins
during node startup, saving time.

By changing rsync to cp/rm, we get great results even
without parallel make:

  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0
    3,28s user 1,64s system 105% cpu 4,684 total
  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0 -j8
    3,27s user 1,65s system 135% cpu 3,640 total

We are within 1s of FAST_RUN_BROKER=1 by default, and
faster than FAST_RUN_BROKER=1 with parallel make. On
top of that, we greatly benefit when rebuilding as the
DIST files do not need to be rebuilt every time:

  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0
    2,94s user 1,40s system 107% cpu 4,035 total
  make -C deps/rabbitmq_management run-broker FAST_RUN_BROKER=0 -j8
    2,85s user 1,51s system 138% cpu 3,140 total

Therefore it only makes sense to remove FAST_RUN_BROKER,
and instead use the old method which is both more correct
and has more potential for optimisation.
2024-06-26 16:53:07 +02:00
Loïc Hoguin 9f15e978b1
make: Remove xrefr
It is no longer used by Erlang.mk.
2024-06-25 13:08:08 +02:00
Karl Nilsson de821c33f8 rabbitmq_management: speed up rabbit_mgmt_test_db_SUITE.erl 2024-06-21 10:47:30 +01:00
GitHub 24bfab3453 bazel run gazelle 2024-06-20 04:02:18 +00:00
Loïc Hoguin 5bf2b678c8
Merge pull request #11486 from rabbitmq/loic-fix-make-full1-regression
make: Don't propagate FULL=1 to "make test-dist"
2024-06-19 16:25:33 +02:00
Loïc Hoguin c79ae49b5a
make: Don't propagate FULL=1 to "make test-dist"
Both FULL and MAKEFLAGS env variables need to be unset
as FULL=1 is present in both. This is a bit of a band-aid,
it's possible that other variables get propagated that
shouldn't be, but we'll fix them when they are detected.
2024-06-19 11:02:06 +02:00
Rin Kuryloski 5debebfaf3 Use rules_elixir to build the cli without mix
Certain elixir-native deps are still build with mix, but this can be
corrected later
2024-06-18 14:50:34 +02:00
Michal Kuratczyk 41a4d1711d
OTP27 support (#11366)
* "maybe" is now a keyword
* Bump horus to 0.2.5 and switch to hex
* Get rid of some deprecated callbacks/functions
2024-06-18 07:32:58 +02:00
Loïc Hoguin c1500b96ad
make: Disable FAST_RUN_BROKER for tests
We want to be strict for tests. Only the code that should
be available when testing a plugin should be made available.
With FAST_RUN_BROKER=1, for the time being, this is not the
case: all plugins' code is available to be loaded.
2024-06-13 09:48:14 +02:00
Diana Parra Corbacho 3bbda5bdba Remove classic mirror queues 2024-06-04 13:00:31 +02:00