Commit Graph

847 Commits

Author SHA1 Message Date
Michael Klishin 8625301e8d CLI: drop two table formatter tests
The only way to make them reliable in their current form
would be converting to keyword lists, which are covered anyway.
2023-04-24 19:52:45 +04:00
Michael Klishin ddf7926941 CLI: make input ordering preditable when formatting a table
if the input is given as a map.

References #7931, #7921
2023-04-24 14:50:31 +04:00
Michael Klishin cec151df59
Introduce a way to update virtual host metadata using CLI tools (#7914)
Introduce 'ctl update_vhost_metadata'

that can be used to update the description, tags or default queue type of
any existing virtual hosts.

Closes #7912, #7857.

#7912 will need an HTTP API counterpart change.
2023-04-18 02:54:37 +04:00
Michal Kuratczyk e62bef164a
Don't rely on implicit order in CLI tests 2023-04-13 14:37:19 +02:00
Michal Kuratczyk 699af2c8c3
Don't rely on implicit order in a test 2023-04-13 14:37:18 +02:00
Jean-Sébastien Pédron 091d756d97
rabbitmq_cli: Fix invalid feature flag definitions
`desc` was set to binaries instead of strings.
2023-03-10 09:25:42 +01:00
Rin Kuryloski 93be82d09f Add 3.13.0 as an allowed version in the test plugin in cli tests 2023-02-14 18:11:23 +01:00
Michael Klishin 9beda74d86
Sort tags before comparing them in this test
now that the server sorts and deduplicates them
2023-02-13 22:16:21 -03:00
Jean-Sébastien Pédron 78e8c595b1
set_permissions_globally_command_test: Fix "invalid_regex patterns" test expectations
Testcases are executed in a random order. Unfortunately, this testcase
depended on side effects of other testcases. If this testcase was
executed first, then there were no permissions set and the testcase
would fail.

It now lists permissions before and after the actual test and compare
both.
2023-02-08 10:21:10 +01:00
Jean-Sébastien Pédron 271a7babdf
set_permissions_globally_command_test: Always set @user
Otherwise the command causes a `function_clause` exception in the broker
because a `nil` atom is passed as the username instead of a binary.
2023-02-08 10:18:24 +01:00
Michael Klishin 69add44ce3
CLI: mix format 2023-02-06 15:54:09 -05:00
Michael Klishin ab99ccfa45
Introduce a CLI command that grants permissions to all virtual hosts
Closes #1000
2023-02-06 13:07:09 -05:00
Simon Unge 03617f681c See #5957. Accept empty arg and prompt for password 2023-01-26 11:46:24 -08:00
Simon Unge 67bc94ed16 See #5957. CLI command to generate hashed password from cleartext password 2023-01-23 14:47:29 -08:00
Michael Klishin c3c4665970
Update tests 2023-01-16 09:24:37 -08:00
Jean-Sébastien Pédron 4840ca9f2f
Merge pull request #6866 from rabbitmq/init-db-from-rabbit_db
rabbit_db: Add `init/0`, `is_virgin_node/0`, `dir/0` and `ensure_dir_exists/0` functions
2023-01-13 16:26:06 +01:00
Jean-Sébastien Pédron 950c4ef7eb
Use `rabbit:data_dir/0` instead of `rabbit_mnesia:dir/0` where it makes sense
Some testcases are interested in RabbitMQ data directory, not Mnesia
directory per se. In this case, call `rabbit:data_dir/0` instead.
2023-01-13 11:56:21 +01:00
Rin Kuryloski d3794cf2c0 Conform vhost tags to a list when set with the cli in all cases
`rabbitmqctl add_vhost myvhost --tags "my_tag"` would not previously
conform "my_tag" to a list before setting vhost metadata, which could
cause crashes when the list was read.
2023-01-13 10:06:11 +01:00
Michael Klishin ec4f1dba7d
(c) year bump: 2022 => 2023 2023-01-01 23:17:36 -05:00
Jean-Sébastien Pédron 46b71e8994
rabbitmq-cli: Deleting a non-existing user or vhost is fine
This patch adapts several testcases to this behavior change. The goal is
to avoid transactions where there is no need for one.
2022-12-14 10:06:45 +01:00
Jean-Sébastien Pédron b25175563c
rabbitmq-cli: Fix several testcases which didn't test anything
RabbitMQ lacks argument verifications in many places unfortunately.
Several testcases were passing bad arguments to the command but were
also comparing the result to bad data. This happened to "work"...
2022-12-13 14:55:46 +01:00
Jean-Sébastien Pédron 99b14fd0fa
rabbit_env: Rename `mnesia_*dir` to `data_*dir`
The location and name of this directory remains the same for
compatibility reasons. Therefore, it sill contains "mnesia" in its name.
However, semantically, we want this directory to be unrelated to Mnesia.

In the end, many subsystems write files and directories there, including
Mnesia, all Ra systems and in the future, Khepri.
2022-11-30 13:00:49 +01:00
Alex Valiushko d70660dac7 Add inclusive aliases to ctl info keys
Includes generic ability to provide aliases in other commands.
2022-11-11 14:44:05 -08:00
Michael Klishin 6ebbfaa0a4
Adopt new helpers that assert on plugin presence and state
In many tests, we do not care what is the complete set of plugins
running on a node (or present, or in a specific state). We only
care that a few select ones are running, are of the expected version,
in a certain state, and so on.

So list comparison assertions are counterproductive and lead to
test interference that is difficult to track down. In many cases
we can do more fine grained assertions and ignore the rest of
the plugins present on the node.

References #6289, #6020.
2022-11-02 14:07:10 +04:00
Michael Klishin 8c6b3bfbc6
CLI: continue reworking assertions on plugin state 2022-11-02 13:08:44 +04:00
Michael Klishin e1d14bac2d
Reset enabled plugins after each test that enables any 2022-11-02 13:08:44 +04:00
Simon Unge 917bf55e19
See Issue 6020. Take plugin dependency into account 2022-11-02 13:08:44 +04:00
Michael Klishin 0cd8dff415
CLI: improve isolation of set_disk_free_limit tests 2022-11-01 16:39:35 +04:00
Jean-Sébastien Pédron 4b132daaba
Remove upgrade-specific log file
This category should be unused with the decommissioning of the old
upgrade subsystem (in favor of the feature flags subsystem). It means:
1. The upgrade log file will not be created by default anymore.
2. The `$RABBITMQ_UPGRADE_LOG` environment variable is now unsupported.

The configuration variables remain to avoid breaking an existing and
working configuration.
2022-10-06 21:28:50 +02:00
Ayanda Dube 4cbbaad2df mix format rabbitmq_cli 2022-10-02 18:54:11 +01:00
Jean-Sébastien Pédron 5b98d7d2a2
Remove test code which depended on the `maintenance_mode_status` feature flags
These checks are now irrelevant as the feature flag is required.
2022-07-29 11:51:52 +02:00
Rin Kuryloski e9c1e6b680 Bump the rabbitmq version on this branch to 3.12.0 (bazel)
To reduce cache misses, the bazel build uses a hard coded version. A
correct value is injected in releases.
2022-07-28 09:45:26 +02:00
Rin Kuryloski 59b858de54 Revert "Fixup an accidental backport side-effect"
This reverts commit 5053d48bce.
2022-07-27 14:03:01 +02:00
Rin Kuryloski 5053d48bce
Fixup an accidental backport side-effect 2022-07-27 14:02:35 +02:00
Rin Kuryloski f67eaaae68 Use code compiled with -DTEST in mixed version testing
Also introduces an actions workflow to provide the necessary archives
referenced in secondary_umbrella.bzl
2022-07-26 20:29:33 +02:00
Karl Nilsson 65ca0b4dfd Add default_queue_type to list_vhosts command 2022-07-25 12:34:52 +01:00
Jean-Sébastien Pédron bcb8733880
rabbit_feature_flags: Add a feature flags controller process
This gen_statem-based process is responsible for handling concurrency
when feature flags are enabled and synchronized when a cluster is
expanded.

This clarifies and stabilizes the behavior of the feature flag subsystem
w.r.t. situations where e.g. a feature flag migration function takes
time to update data and a new node joins a cluster and synchronizes its
feature flag states with the cluster. There was a chance that the
feature flag was marked as enabled on the joining node, even though the
migration function didn't take care of that node.

With this new feature flags controller, enabling or synchronizing
feature flags blocks and delays any concurrent operations which try to
modify feature flags states too.

This change also clarifies where and when the migration function is
called: it is called at least once on each node who knows the feature
flag and when the state goes from "disabled" to "enabled" on that node.

Note that even if the feature flag is being enabled on a subset of the
nodes (because other nodes already have it enabled), it is marked as
"state_changing" everywhere during the migration. This is to prevent
that a node where it is enabled assumes it is enabled on all nodes who
know the feature flag.

There is a new feature as well: just after a feature flag is enabled,
the migration function is called a second time for any post-enable
actions. The feature flag is marked as enabled between these "enable"
and "post-enable" steps. The success or failure of this "post-enable"
run does not affect the state of the feature flag (i.e. it is ignored).

A new migration function API is introduced to allow more advanced
things. The new API is:

    my_migration_function(
      #ffcommand{name = ...,
                 props = ...,
		 command = enable | post_enable,
		 extra = #{...}})

The record is defined in `include/feature_flags.hrl`. Here is the
meaning of each field:

* `name` and `props` are the equivalent of the `FeatureName` and
  `FeatureProps` arguments of the previous migration function API.

* `command` is basically the same as the previous `Arg` arguments.

* `extra` is map containing context-specific information. For instance, it
  contains the list of nodes where the feature flag state changes.

This whole new behavior is behind a new feature flag called
`feature_flags_v2`. If a feature flag uses the new migration function
API, `feature_flags_v2` will be automatically enabled.

If many feature flags are enabled at once (like when a fresh RabbitMQ
node is started for the first time), `feature_flags_v2` will be enabled
first if it is in the list.
2022-06-28 10:13:19 +02:00
Michael Klishin c38a3d697d
Bump (c) year 2022-03-21 01:21:56 +04:00
Michael Klishin 4b88b269ce
Cosmetics 2022-03-10 18:57:59 +04:00
Michael Klishin 16bdcee5f4
rabbitmqct {encode, decode}: accept more values via standard input
Per discussion with @lhoguin.

References #4216.
2022-03-10 18:55:12 +04:00
Michael Klishin 1c4d07aadc
Make these list order-independent
(cherry picked from commit ac0f5d2c14)
2022-02-18 00:41:46 +03:00
Michael Klishin 866c652f9d
Update this test for new mock .ez files
(cherry picked from commit 83e2946317)
2022-02-18 00:41:37 +03:00
Michael Klishin d51a83197b
Correct .app file of mock plugin 02
(cherry picked from commit 4bf2ef1b4b)
2022-02-18 00:41:29 +03:00
Michael Klishin ccb8f1e045
Update mock_rabbitmq_plugins_03 and mock_rabbitmq_plugins_04
Now compiled on Erlang 23 for Erlang 25 module loading compatibility.

(cherry picked from commit 532d555260)
2022-02-18 00:41:20 +03:00
Michael Klishin ee4114b54e
Update mock_rabbitmq_plugins_01 and mock_rabbitmq_plugins_02
Now compiled on Erlang 23 for Erlang 25 module loading compatibility.

(cherry picked from commit 26d526771a)
2022-02-18 00:41:13 +03:00
Michael Klishin e18b75e9a1
Safely fetch skip_if_unchanged from options 2022-01-30 00:12:16 +03:00
Michael Klishin f7d32d69f8 Introduce a new CLI tool (scope), rabbitmq-tanzu
For Tanzu (commercial) plugins to attach their commands to instead of
polluting rabbitmqctl.

Pair: @pjk25
(cherry picked from commit 6e0f2436fa)
2021-11-30 14:54:09 +00:00
Jean-Sébastien Pédron b95d540669
rabbitmq_cli: Fix `maintenance_mode_status` feature flag name
... in testsuite.

This didn't really affect the testsuite because all feature flags are
enabled earlier if I understand correctly.
2021-09-01 11:30:48 +02:00
Michael Klishin 1d3d8623de
CLI tests: make mock plugin declare compatibility with 3.8 through 3.10 2021-06-28 18:39:40 +03:00
Philip Kuryloski 7e17a47557 Update rabbitmq_cli mock test plugin for 3.10.x 2021-06-15 11:29:57 +02:00