Commit Graph

847 Commits

Author SHA1 Message Date
Michael Klishin d2549de22e Extract several modules from RabbitMQ.CLI.Core.Helpers
In preparation to changing status command output for 3.8
2019-04-10 13:31:38 +03:00
Michael Klishin d89feb4dec close_all_connections test: reduce duplication 2019-04-10 13:30:44 +03:00
Michael Klishin ed4a1fe5f4 Squash a warning 2019-04-09 15:07:01 +04:00
Michael Klishin 7ec98d5924 Extra tests that helped narrow #339 down 2019-04-09 14:37:00 +04:00
Michael Klishin ae4aca3364 One more test 2019-04-08 22:13:04 +04:00
Michael Klishin 03d2e921d9 Update assertions for #336 2019-04-08 21:33:45 +04:00
Michael Klishin 94f47ee51c ctl close_all_connections command test suite improvements
Use more but shorter retries when asserting on connection lists.

Discovered when investigating rabbitmq/rabbitmq-server#1971.
2019-04-08 15:18:27 +04:00
Michael Klishin 5685e4c7c9 rabbitmq-plugins formatter: don't print legend if --silent or --quiet is used 2019-04-01 14:56:40 +03:00
Michael Klishin 93dbbf342e Rework how command-specific options are displayed in help
Per recommendation from @dumbbell.
usage_addition/0 return format per discussion
with @dcorbacho, @hairyhum, @lukebakken.
2019-03-26 01:21:22 +03:00
Spring Operator 0a2541afd3 URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# HTTP URLs that Could Not Be Fixed
These URLs were unable to be fixed. Please review them to see if they can be manually resolved.

* http://blog.listincomprehension.com/search/label/procket (200) with 1 occurrences could not be migrated:
   ([https](https://blog.listincomprehension.com/search/label/procket) result ClosedChannelException).
* http://dozzie.jarowit.net/trac/wiki/TOML (200) with 1 occurrences could not be migrated:
   ([https](https://dozzie.jarowit.net/trac/wiki/TOML) result SSLHandshakeException).
* http://dozzie.jarowit.net/trac/wiki/subproc (200) with 1 occurrences could not be migrated:
   ([https](https://dozzie.jarowit.net/trac/wiki/subproc) result SSLHandshakeException).
* http://e2project.org (200) with 1 occurrences could not be migrated:
   ([https](https://e2project.org) result AnnotatedConnectException).
* http://erlang.org/doc/reference_manual/distributed.html (200) with 1 occurrences could not be migrated:
   ([https](https://erlang.org/doc/reference_manual/distributed.html) result ConnectTimeoutException).
* http://nitrogenproject.com/ (200) with 2 occurrences could not be migrated:
   ([https](https://nitrogenproject.com/) result ConnectTimeoutException).
* http://proper.softlab.ntua.gr (200) with 1 occurrences could not be migrated:
   ([https](https://proper.softlab.ntua.gr) result SSLHandshakeException).
* http://yaws.hyber.org (200) with 1 occurrences could not be migrated:
   ([https](https://yaws.hyber.org) result AnnotatedConnectException).
* http://choven.ca (503) with 1 occurrences could not be migrated:
   ([https](https://choven.ca) result ConnectTimeoutException).

# Fixed URLs

## Fixed But Review Recommended
These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended.

* http://fixprotocol.org/ (301) with 1 occurrences migrated to:
  https://fixtrading.org ([https](https://fixprotocol.org/) result SSLHandshakeException).
* http://erldb.org (UnknownHostException) with 1 occurrences migrated to:
  https://erldb.org ([https](https://erldb.org) result UnknownHostException).
* http://elixir-lang.org/docs/stable/elixir/OptionParser.html (301) with 1 occurrences migrated to:
  https://elixir-lang.org/docs/stable/elixir/OptionParser.html ([https](https://elixir-lang.org/docs/stable/elixir/OptionParser.html) result 404).
* http://elixir-lang.org/docs/stable/elixir/Stream.html (301) with 1 occurrences migrated to:
  https://elixir-lang.org/docs/stable/elixir/Stream.html ([https](https://elixir-lang.org/docs/stable/elixir/Stream.html) result 404).

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://cloudi.org/ with 27 occurrences migrated to:
  https://cloudi.org/ ([https](https://cloudi.org/) result 200).
* http://elixir-lang.org with 1 occurrences migrated to:
  https://elixir-lang.org ([https](https://elixir-lang.org) result 200).
* http://elixir-lang.org/ with 2 occurrences migrated to:
  https://elixir-lang.org/ ([https](https://elixir-lang.org/) result 200).
* http://elixir-lang.org/getting-started/typespecs-and-behaviours.html with 1 occurrences migrated to:
  https://elixir-lang.org/getting-started/typespecs-and-behaviours.html ([https](https://elixir-lang.org/getting-started/typespecs-and-behaviours.html) result 200).
* http://elixir-lang.org/install.html with 1 occurrences migrated to:
  https://elixir-lang.org/install.html ([https](https://elixir-lang.org/install.html) result 200).
* http://erlware.org/ with 1 occurrences migrated to:
  https://erlware.org/ ([https](https://erlware.org/) result 200).
* http://inaka.github.io/cowboy-trails/ with 1 occurrences migrated to:
  https://inaka.github.io/cowboy-trails/ ([https](https://inaka.github.io/cowboy-trails/) result 200).
* http://ninenines.eu with 6 occurrences migrated to:
  https://ninenines.eu ([https](https://ninenines.eu) result 200).
* http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html with 1 occurrences migrated to:
  https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html ([https](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) result 200).
* http://www.actordb.com/ with 2 occurrences migrated to:
  https://www.actordb.com/ ([https](https://www.actordb.com/) result 200).
* http://www.cs.kent.ac.uk/projects/wrangler/Home.html with 1 occurrences migrated to:
  https://www.cs.kent.ac.uk/projects/wrangler/Home.html ([https](https://www.cs.kent.ac.uk/projects/wrangler/Home.html) result 200).
* http://www.rebar3.org with 1 occurrences migrated to:
  https://www.rebar3.org ([https](https://www.rebar3.org) result 200).
* http://contributor-covenant.org with 1 occurrences migrated to:
  https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301).
* http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to:
  https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301).
* http://inaka.github.com/apns4erl with 1 occurrences migrated to:
  https://inaka.github.com/apns4erl ([https](https://inaka.github.com/apns4erl) result 301).
* http://inaka.github.com/edis/ with 1 occurrences migrated to:
  https://inaka.github.com/edis/ ([https](https://inaka.github.com/edis/) result 301).
* http://lasp-lang.org/ with 1 occurrences migrated to:
  https://lasp-lang.org/ ([https](https://lasp-lang.org/) result 301).
* http://rabbitmq.com/documentation.html with 1 occurrences migrated to:
  https://rabbitmq.com/documentation.html ([https](https://rabbitmq.com/documentation.html) result 301).
* http://saleyn.github.com/erlexec with 1 occurrences migrated to:
  https://saleyn.github.com/erlexec ([https](https://saleyn.github.com/erlexec) result 301).
* http://www.mozilla.org/MPL/ with 290 occurrences migrated to:
  https://www.mozilla.org/MPL/ ([https](https://www.mozilla.org/MPL/) result 301).
* http://zhongwencool.github.io/observer_cli with 1 occurrences migrated to:
  https://zhongwencool.github.io/observer_cli ([https](https://zhongwencool.github.io/observer_cli) result 301).
2019-03-20 03:13:07 -05:00
Michael Klishin f6bb9487ef Info item arg processing test: handle multi-line return values 2019-03-18 07:47:46 +03:00
Michael Klishin b5d39b2a2f Handle info keys that are strings
Some commands define them as atoms, others
as strings.
2019-03-17 14:01:04 +03:00
Michael Klishin bea9cf4486 Rework command-specific help
* Display command-specific options first instead of
  generic at the top
* Include one line command synopsis from --list-commands
  in the command-specific message
* List timeout in a separate section. It doesn't
  integrate very well with either command-specific
  or general section
* Format section headings as H2s in Markdown, this makes them stand out
* Assorted small formatting changes
* Update tests to be less fragile to copywriting changes
2019-03-17 13:54:18 +03:00
Michael Klishin 7f6ef260da ctl shutdown: consider @localhost nodes to be local
Without this -n has to be used when it previously wasn't required.

Follow-up to #328, references #327, #309.

Per discussion with @lukebakken.
2019-03-07 01:29:23 +03:00
Michael Klishin c339b6a10c ctl shutdown: infer hostnames from node names
inet_db is not a very reliable source as it doesn't take
node name CLI arguments and ERL_INETRC file settings.
That can lead to false positives in environments where
inet_db returns the same value (e.g. `localhost`) for
every cluster member.

Per discussion with @gerhard.

Closes #327.
References #309.
2019-03-06 20:19:52 +03:00
Josh Soref fd4e361f43 spelling: unrecognised 2019-02-24 02:10:56 -05:00
Josh Soref 8f5cb9d9aa spelling: success 2019-02-24 02:06:39 -05:00
Josh Soref f1333cfa00 spelling: providing 2019-02-24 02:04:05 -05:00
Josh Soref 0ef7adafe7 spelling: mysterious 2019-02-24 02:01:00 -05:00
Josh Soref 335427bfe3 spelling: inaccessible 2019-02-24 02:10:14 -05:00
Josh Soref ecabb4e763 spelling: exchange 2019-02-13 00:20:24 -05:00
Josh Soref ce893da54c spelling: already 2019-02-13 00:17:15 -05:00
Michael Klishin ea6294be41 New command: `rabbitmqctl force_gc`
Developed as part of a live coding training session but can be
useful in practice, so let's keep it.

Per discussion with @hairyhum.
2019-02-21 19:11:30 +03:00
Michael Klishin 12f8debdc6 Update help command tests for the new grouped output 2019-02-21 16:35:21 +03:00
Michael Klishin b4d2ab6fe0 Return a human-friendly validation error 2019-02-21 00:35:23 +03:00
kjnilsson a56f9cae61 rabbitmq-queues: add --errors-only to grow command
For consistency with shrink

[#162782801]
2019-02-20 17:28:26 +00:00
kjnilsson 67dfe2dfa8 add rabbitmq-queues grow command tests 2019-02-20 13:47:58 +00:00
Michael Klishin 5d15f28869 Feature flag tests belong under test/ctl 2019-02-20 13:31:15 +00:00
Michael Klishin 581cd2dc25 Add tests for rabbitmq-queues commands 2019-02-20 13:30:00 +00:00
Michael Klishin 29b66976f9 version command test: remove an environment-specific test
`rabbit_misc:version/0` requires rabbit.app to be on code path
and loaded which is not always the case on the test node.

The command is so simple that this doesn't introduce enough risk
to justify spending more time on it.
2019-02-20 13:29:59 +00:00
Michael Klishin da1d4d85fb Return :ok from setup_all 2019-02-20 13:29:59 +00:00
Michael Klishin f7a74c4183 Squash a couple of test warnings 2019-02-20 13:29:59 +00:00
Michael Klishin ddf6841f2f New command: version, closes #314 2019-02-20 13:29:59 +00:00
Michael Klishin 9231b21305 Follow-up to #298: descriptions and aliases for TLS-enabled listeners 2019-02-12 14:14:54 +03:00
Luke Bakken 95e5b78af6 Output a friendly error if a long node name is used but --longnames not specified 2019-02-05 08:56:04 -08:00
Luke Bakken 962e0cf7c7 Ensure longnames option is passed to normalise_node
Fixes #311
2019-02-05 07:27:34 -08:00
Arnaud Cogoluègnes 97c048cf37 Add active consumer fields if necessary
When calling node is 3.8 and one of the nodes is < 3.8, active and
activity status fields need to be set with default values.

[#163298456]
2019-02-05 15:06:51 +01:00
Michael Klishin 041a6c2bdf Reuse existing modules more, rearrange functions 2019-02-04 02:22:21 +03:00
Michael Klishin e11e7d1885 shutdown: add a test for 56ac8d1cf7
References #309.
2019-02-03 22:10:22 +03:00
Michael Klishin 7ad9176435 Further improvements to the shutdown command
Add --[no-]wait (enabled by default) for those who would prefer
to use it to shut down remote nodes even though it wouldn't wait for
a verified node termination.

Propagate --timeout to calls.

References #309.
2019-02-03 20:40:01 +03:00
Michael Klishin 92851c4f88 Test modules should be named *_test.exs 2019-02-03 05:12:23 +03:00
Michael Klishin 2ad334c91f Refactor 2019-02-03 04:55:37 +03:00
Jean-Sébastien Pédron 95f5b85498 forget_cluster_node_command_test: Set `feature_flags_file` config
... by querying the node for the actual value.

[#160169569]
2019-02-02 12:09:10 +01:00
Daniil Fedotov 8bf5e81926 Merge pull request #308 from rabbitmq/rabbitmqctl-cli-307
Support bare --help
2019-02-01 21:43:17 +04:00
Luke Bakken 9b01b1cf3c Add `list_feature_flags` and `enable_feature_flag` commands
As their name suggests, they are used to manage the feature flags of
RabbitMQ and its plugins.

[#159298729]
2019-02-01 17:51:21 +01:00
Michael Klishin 0053f67485 Support bare --help
Note that there's a different between the case with no arguments
(exits with EX_USAGE) and --help (exits successfully).

Per discussion with the team.

Closes #307.
2019-02-01 19:47:09 +03:00
Daniil Fedotov 5e5f4d461c Make it possible to get command help by typing 'rabbitmqctl mycommand --help'
Add a new default switch `help`
Add an alias `?`

Make rabbitmqctl display command help if this option is true for known commands.
2019-01-30 16:47:18 -05:00
Michael Klishin 724dbca331 Merge pull request #303 from rabbitmq/await_startup_with_a_timeout
New command: `rabbitmqctl await_startup`
2019-01-28 21:06:41 +03:00
Michael Klishin 5fad316390 New command: `rabbitmqctl await_startup`
Like `rabbitmqctl wait` but doesn't use a pid file path.

Pair: @gerhard.

References rabbitmq/rabbitmq-server#1848.
2019-01-28 20:45:08 +03:00
Michael Klishin badbc59dc9 Drive-by change: remove a TODO
Currently integration tests do not start
or stop the runtime (only the RabbitMQ app on it),
and it will likely remain the case for a while.
2019-01-28 17:05:01 +03:00
Arnaud Cogoluègnes 606b72b5a6 Add active to default fields for list_consumers
[#163298456]

References rabbitmq/rabbitmq-server#1839
2019-01-24 18:26:39 +01:00
Arnaud Cogoluègnes 1732932f7b Merge branch 'master' into rabbitmq-server-1838-active-field-for-consumers 2019-01-24 10:46:58 +01:00
Michael Klishin 1c621c4fdd RestartVhostCommandTest stability and efficiency improvements
Virtual host process tree needs a bit more time to start and stop/
update state on failure.

Before this test a slower 5 year old machine had a 20% failure test rate
with this test (2 out of 10 attempts), with this change it has a %0
failure rate (0 out of 50).

While at it, only set up the vhost for tests that will actually hit
the test node.
2019-01-24 12:25:03 +03:00
Michael Klishin 77c4f3672e Rearrange test files
Most test/* files belong to either test/ctl or test/core.
2019-01-24 11:25:57 +03:00
Michael Klishin a6cf0c5539 Correct protocol labels for STOMP and MQTT 2019-01-24 10:37:36 +03:00
Michael Klishin e8729c5de0 Introduce 'rabbitmq-diagnostics check_port_connectivity' 2019-01-23 22:30:20 +03:00
Michael Klishin ad23b37e3f Introduce 'rabbitmq-diagnostics check_port_listener <port>'
Part of #292.
2019-01-23 19:13:08 +03:00
Michael Klishin bd618db9cd Introduce 'rabbitmq-diagnostics check_protocol_listener'
Part of #292.
2019-01-23 17:45:37 +03:00
Michael Klishin 3f9c982d44 Standardize on :not_enough_args
That's what most commands use and the execution pipeline
expects.
2019-01-23 15:20:24 +03:00
Michael Klishin 25de27644b ExUnit defaults to async: false for test cases 2019-01-23 10:44:04 +03:00
Michael Klishin f239457c6d Update tests to use the new default exit code 2019-01-23 10:43:49 +03:00
Michael Klishin 94d5216e68 New check command: 'rabbitmq-diagnostics check_running'
Like is_running but will exit with a non-0 code if the app is
not running on the target node.
2019-01-23 10:43:12 +03:00
Michael Klishin 18ff37665c Change rabbitmq-diagnostics is_booting and is_running to be info commands
This means that even in the "negative" response they exit with a 0
status code. In other words, they just tell the user the state of things
without asserting on what constitutes a success or failure.

This is consistent with some recently introduced diagnostics commands:
some are "informational" (simply provide an insight into the state
of the node) and others are checks (optinionated, consider certain
conditions to be faulty and exit with a non-zero exit code).

References #292.
2019-01-23 08:49:05 +03:00
Michael Klishin b974bd18f9 Relax this assertion
Target node can have an AMQP+TLS listener enabled.
2019-01-22 13:53:17 +03:00
Michael Klishin cf226bb004 Tests and revisions for 'rabbitmq-diagnostics check[_local]_alarms'
References #292.
2019-01-22 13:28:42 +03:00
Michael Klishin 4d2ee15ce7 Rename a few test files 2019-01-22 13:28:42 +03:00
Michael Klishin 93ba999434 Tests for 'rabbitmq-diagnostics alarms' 2019-01-22 13:27:52 +03:00
Michael Klishin d5c2cd867f Add tests for 'rabbitmq-diagnostics listeners' 2019-01-22 12:26:29 +03:00
Michael Klishin 135c6a89a2 Rename a few test files
(cherry picked from commit 607b2fee1e28d8391c52bb4b687f15d665b48319)

Conflicts:
	test/diagnostics/alarms_command_test.exs
2019-01-22 09:12:07 +03:00
Michael Klishin 1757788b87 Update these tests to only operate on ctl commands
Since that's what the --help message lists with default
tool name.

(cherry picked from commit d92060c1a6ad26927459f70fb57855218f35bcd4)
2019-01-22 09:11:25 +03:00
Arnaud Cogoluègnes ca396e0ce5 Add active and activity status fields to list_consumers
[#163298456]

References rabbitmq/rabbitmq-management#1838
2019-01-21 14:36:53 +01:00
Michael Klishin 62fcdea747 Merge branch 'master' into rabbitmq-cli-292-plugins-is-enabled 2019-01-21 11:18:17 +03:00
Michael Klishin df39f2ccd1 Update (c) year in tests 2019-01-21 11:15:48 +03:00
Michael Klishin 84c1d51c92 Introducee rabbitmq-plugins is_enabled [plugin 1] [plugin 2] [...]
Part of #292.
2019-01-21 11:02:10 +03:00
Michael Klishin 14169d91ac Extra whitespace
[ci skip]
2019-01-21 05:51:06 +03:00
Michael Klishin f7cd1082fb Be more resilient to net_kernel internal process management 2019-01-20 09:09:11 +03:00
Michael Klishin 6ae2a395af Squash a warning 2019-01-20 09:08:55 +03:00
Michael Klishin d086ad8966 Use correct node hostname here 2019-01-20 09:08:32 +03:00
Michael Klishin be2c1e7101 Introoduce rabbitmq-diagnostics is_running, is_booting 2019-01-20 07:33:40 +03:00
Arnaud Cogoluègnes c6d4fcf19d Add single active field to list_consumers command
[#163089472]

References rabbitmq/rabbitmq-management#649
2019-01-16 10:38:57 +01:00
Michael Klishin 3c13df77f9 Don't use a function deprecated in 1.8.0 2019-01-15 08:25:28 +03:00
Michael Klishin d0ea645ea3 New command: rabbitmq-diagnostics tls_versions
Like cipher_suites but for supported (available in the runtime)
TLS versions.

[#162832991]
2018-12-24 15:25:35 +03:00
Michael Klishin ac653965f4 Improve error message formatting for rabbitmq-plugins commands
There are two main types of errors that I see in practice:

 * Insufficient enabled plugins file permission (or the file does not exist)
 * Enabled plugins file used by CLI tools does not match that of
   the target node

[#162757498]
2018-12-19 15:54:23 +03:00
Michael Klishin e0e33f4b73 New diagnostics command: runtime_thread_stats
Uses Erlang's microstate accounting data to produce
high level thread state/activity breakdown.

Per discussion with @gerhard.
2018-12-07 18:43:48 +03:00
Michael Klishin 8603a5caf6 Support hostnames with dashes in these tests
Such as those used by Concourse containers.
2018-12-06 01:15:57 +03:00
Luke Bakken b523093c3e Port Erlang/OTP node name code to Elixir
Follow-up to #278

Add another test case, fix bugs

Add another test

Start converting to new code

Node name related code is in NodeName module

Distribution not needed for Helpers tests

Add test for rabbit@localhost when longnames in use

No need to guess on domain in this spot

Fix behavior on OS X
2018-12-05 11:23:17 -08:00
Michael Klishin 1fc6a6cdde Make sure distribution is stopped first in these tests 2018-12-01 16:04:03 +03:00
Michael Klishin 011d987862 Adapt this test for environments where inet:get_rc/0 returns no domain info 2018-12-01 15:48:43 +03:00
Luke Bakken 5861d2da3b Do not raise error as offline commands will crash 2018-11-30 15:02:22 -08:00
Luke Bakken 1d878c79e1 Fix merge defaults test, fix warnings 2018-11-30 14:48:47 -08:00
Luke Bakken 9cc61e594b Add tests for normalising name with :longnames 2018-11-30 13:58:27 -08:00
Luke Bakken ff6243bfd2 Fix test for @hostname case 2018-11-30 12:27:58 -08:00
Luke Bakken 35ffd53be1 Rename parse_node to normalise_node 2018-11-30 12:14:21 -08:00
Luke Bakken c8e766dec7 Add function to normalise :node option after distribution started
Fixes #278
2018-11-30 07:00:18 -08:00
Michael Klishin df5db4ec1b Validate log level values, format unsupported level errors in a more human-friendly way 2018-11-29 00:20:41 +08:00
Luke Bakken 0e7608083b Add command to set log level
Fixes #276
2018-11-27 15:49:11 -08:00
Michael Klishin f85d4b4d56 Update one more test
Part of #274.
2018-11-21 08:02:20 +08:00
Luke Bakken 8ab22299a8 Document --no-table-headers
Fixes #274

Switch no_table_headers to table_headers

update tests

Integrate --silent
2018-11-19 15:25:36 -08:00
Michael Klishin 3968f94934 A follow-up to 35114e5dd4 2018-11-15 16:56:34 +00:00
Michael Klishin 35114e5dd4 Update this test for 3.8
Now that there's a 3.8 tag the build system detects server
version as 3.8.x, so this test has to be updated.
2018-11-15 16:38:25 +00:00
Michael Klishin 6416d745ed Update tests
[#161309687]
2018-11-01 23:46:32 +03:00
Michael Klishin 36ad6dfdb5 Merge pull request #269 from rabbitmq/rabbitmq-cli-267
rabbitmq-diagnostics: make cipher_suites default to --openssl-format
2018-10-30 07:06:57 +03:00
Michael Klishin fc18b4cce7 Update test titles 2018-10-30 07:02:47 +03:00
Michael Klishin b7d5fd4431 More warnings 2018-10-30 00:52:19 +03:00
Michael Klishin 875c7827f6 rabbitmq-diagnostics: make cipher_suites default to --openssl-format
And introduce --erlang-format. They are mutually exclusive.

Closes #267.
[#161435591]
2018-10-28 23:31:39 +03:00
Michael Klishin 5e54354fdf Make it possible to suppress table headers for list_* commands
Using --no-table-headers, per discussion with @dumbbell.
2018-10-24 16:43:58 +03:00
Daniil Fedotov 222e486ca7 Add headers to the table formatter.
There were headers in 3.6 CLI which were not implemented when moving
to the new one.

Fixes #264
[#161326468]
2018-10-22 10:55:16 +01:00
Michael Klishin 5ec71c18f3 Retrieve plugin directory and file information via Config
[#160792758]
2018-10-03 16:43:42 +03:00
Michael Klishin 769e3171df Merge branch 'master' into rabbitmq-cli-261 2018-10-02 04:07:47 +03:00
Michael Klishin ad69a2f2f7 Drive by cosmetic changes 2018-10-02 04:07:33 +03:00
Michael Klishin 1b56fc5957 New command: rabbitmq-plugins directories
Closes rabbitmq/rabbitmq-cli#261.

[#160792758]
2018-10-02 03:16:25 +03:00
Michael Klishin ad10aff434 Expect rabbitmqctl add_vhost to be idempotent
Part of rabbitmq/rabbitmq-cli#260

[#160792770]
2018-09-27 06:22:55 +03:00
Ayanda Dube c88cfd940d Reduce code footprint on aliases 2018-07-23 06:06:18 +01:00
Michael Klishin 784ebfd55a Ditto in close_all_connections_command_test 2018-07-14 02:06:01 +03:00
Michael Klishin 241aa9a3d2 An attempt to make this test more robust
This gives connection tracking a chance to update its state.
2018-07-14 00:42:57 +03:00
Michael Klishin ee2b185db9 Introduce rabbitmqctl ping
See #253 for background.

[#158291890]
2018-06-12 16:47:54 +03:00
Michael Klishin b06163bd32 More test stability improvements
Tests that trigger a timeout should specify a reachable node,
otherwise they'd get a {:badrpc, :nodedown} instead of {:badrpc, :timeout}.
2018-06-06 14:53:27 +03:00
Michael Klishin 52deb01d68 Less fragile diagnostics tests, squash a few warnings
Discovered as part of working on OTP 21 compatibility.
2018-06-06 14:11:41 +03:00
Michael Klishin c97b0de364 Tests for await_online_nodes, drive by wording changes
[#156729133]
2018-05-30 03:04:49 +03:00
kjnilsson da8fcc8b88 Test reliability
Make the vhost restart code a bit more reliable.
2018-05-01 14:51:55 +01:00
Michael Klishin 56991de0f3 Accept -t/--timeout before command name [again]
There are existing users (including RabbitMQ core tests) that
use that sequence because it was previously in the docs.

This relaxes command validation so that if a command-specific
flag overrides a global, we accept it as long as their types match.

Per discussion with @hairyhum.
2018-03-09 20:28:26 +03:00
Daniil Fedotov aef04bef84 Show timeout in help messages only for commands supporting timeout.
Removed timeout from default parsing options. Now every command
has to specify timeout in it's own switches.
If a command has timeout in switches - there will be help displayed
for this option in usage output.
2018-03-07 18:28:21 +00:00
Daniil Fedotov 8840460e00 Missing test helper to lookup queues 2018-03-07 15:26:46 +00:00
Daniil Fedotov 8b33c646ed Command to delete a queue. 2018-03-07 15:20:18 +00:00
Michael Klishin f99245c5b6 Wording 2017-12-08 17:55:50 -08:00
Luke Bakken 81862adcab Fixing SetParameterCommand and tests
Fix code to fix test suite
2017-12-08 11:49:20 -08:00
Daniil Fedotov 32cf46e5c8 Fix rabbitmq-plugins enable/disable/set behavior for --online flag.
If flag is set to `--online` the commands should fail if node is not
running.
If flag is not set, they should fallback to offline mode if the
node is not running.
This corresponds to the rabbitmq-plugins.8 manpage.

Made validation aware of online flag.
Define best_effort mode to fallback if node is not running.
Requires rabbitmq/rabbitmq-server#1433

Fixes #226
[#153184802]
2017-11-27 18:49:08 +00:00
Michael Klishin 725dd80ff2 Adapt to rabbitmq/rabbitmq-server#1413 2017-10-31 15:03:19 +03:00
Michael Klishin bc32019d7c Update expectations in force_boot_command_test 2017-08-15 13:11:18 +03:00
Daniil Fedotov e34bfe2297 Merge branch 'master' into rabbitmq-cli-214-take-two 2017-08-14 14:40:35 +01:00
Daniil Fedotov 568874033d Run dialyzer tests. Fix warnings.
Some types were named wrongly (list(), map())
MapSet cannot be matched to be empty. `%MapSet{}` only matches the type.
2017-08-14 14:36:38 +01:00
Michael Klishin b00e648b9c Extend execution environment validation to more commands
This also re-formats a bunch of commands to follow the same
order for the following functions:

 * merge_defaults/2
 * validate/2
 * validate_execution_environment/2
 * run/2
2017-08-11 18:06:30 +03:00
Michael Klishin efe8725f3c Merge branch 'master' into rabbitmq-cli-214-take-two 2017-08-10 14:21:42 +03:00
Daniil Fedotov 035e7305ac Merge pull request #218 from rabbitmq/timeout_list_queues
Set a timeout on list_queues and a warning if unresponsive ones are found
2017-08-09 17:24:40 +04:00
Daniil Fedotov 3542b0d281 Add timeout message to list_queues command test 2017-08-09 14:24:12 +01:00
Michael Klishin 0031c4fdf6 Make validate/2 and validate_execution_environment/2 use the same tuple tag
Per discussion with @hairyhum.
2017-08-09 01:11:14 +03:00
Michael Klishin afa605b3e9 Merge branch 'master' into rabbitmq-cli-214-take-two
Conflicts:
	lib/rabbitmq/cli/plugins/commands/enable_command.ex
2017-08-08 19:14:07 +03:00
Michael Klishin 1e65edb7df Update test expectations 2017-08-08 18:59:58 +03:00
Michael Klishin c227843e32 Make validate_execution_environment/2 use a different tuple tag for failures
Per discussion with @hairyhum.
2017-08-08 18:29:04 +03:00
Michael Klishin 6c70863dcf rabbitmq-plugins: refactor to validate_execution_environment/2 and R.C.C.Validators.chain/2 2017-08-08 03:21:07 +03:00
Michael Klishin 15565ec1d7 rabbitmq-plugins set: switch to validate_execution_environment/2 2017-08-07 16:44:19 +03:00
Michael Klishin 2e64c90913 rabbitmq-plugins enable: switch to validate_execution_environment/2 2017-08-07 16:04:30 +03:00
Michael Klishin 770258ea65 rabbitmq-plugins disable: switch to validate_execution_environment/2 2017-08-07 14:47:17 +03:00
Michael Klishin 6da66de40a forget_cluster_node: switch to validate_execution_environment/2 2017-08-04 19:15:53 +03:00
Daniil Fedotov d66235a955 Cleanup test warnings 2017-08-04 12:19:56 +01:00
Daniil Fedotov 0676410019 Test that vhost is restarted after running restart_vhost 2017-08-04 11:32:40 +01:00
Daniil Fedotov 10bb587d61 The command to restart a vhost.
The command will attempt to restart a vhost.
If restarted successfully, return exit code 0
If the vhost is already started, return exit code 0 and notify that it's already started.
If there is an error restarting, return exit code 70 and the error
Part of rabbitmq/rabbitmq-server#1321
[#149484305]
2017-08-04 11:32:40 +01:00
Jean-Sébastien Pédron 66090ae1ee test/close_all_connections_command_test.exs: Wait for one second for connections to close
... in the "close a limited number of connections in an existing vhost
closes a subset of connections" testcase. Hopefully this will fix
transient failures in CI because only one connection was closed.
2017-07-21 09:23:16 +02:00
Diana Corbacho 070ac897cc Use gb and bytes units 2017-07-14 10:14:25 +01:00
Michael Klishin 4383c3e280 Tests, refactoring 2017-07-14 03:33:46 +03:00
Michael Klishin 6e49d8f516 Cosmetics 2017-07-13 19:36:26 +03:00
Michael Klishin 2d758a9913 Whitespace 2017-07-13 05:43:24 +03:00
Michael Klishin a710114e1e Spam 2017-07-11 15:38:15 +03:00
Michael Klishin de41a1081a Introduce rabbitmq-diagnostics erlang_version 2017-07-11 15:28:12 +03:00
Michael Klishin c26a7a5909 Introduce rabbitmq-diagnostics server_version 2017-07-11 13:26:05 +03:00
Michael Klishin e61e5c9289 Cosmetics 2017-07-11 13:25:28 +03:00
Michael Klishin ca20f8a0d6 Make CLI tools diagnostics message more detailed
Our current message is informative enough but it ends with a "nodedown".
Emperical evidence suggests that once a user sees it, they stop reading.
Providing a hint that there will be diagnostics output below is step 1.

Step 2 is improving the diagnostics section. It now

  * Calls out three most common groups of issues explicitly
  * Suggests what documentation guides can contain helpful information

There are rabbitmq-server and rabbitmq-common commits that make
similar improvements to the server-supplied part of the diagnostics
message.

Per discussion with the team.
2017-07-04 22:34:39 +03:00
Michael Klishin 5774bc64e5 Merge branch 'master' into rabbitmq-cli-encode-commands 2017-07-03 15:52:07 +03:00
Daniil Fedotov 58304ffc95 Split encode command tests to separate commands 2017-07-03 12:11:34 +01:00
Michael Klishin 9b9ebe7f29 Reduce probability of running into server#1280
When tests are being run in a loop, it is possible to reach max
supervisor restart intensity even with decent handling of concurrent
vhost setup/deletion.
2017-06-30 16:42:37 +03:00
Michael Klishin b7b5223a39 list_vhost_limits: handle errors before serialising results
Also update tests and format no_such_vhost errors in a more sensible
way.
2017-06-30 14:43:09 +03:00
Michael Klishin e1ae05ec64 A typo 2017-06-30 09:00:16 +03:00
Michael Klishin 2d60573f03 Make these tests more resilient to node data variations
E.g. if other test suites created a bunch of users
first. We should not assume that there's only one user
present.
2017-06-16 19:29:38 +03:00
Daniil Fedotov 89c9a7d6aa Exec command tests 2017-06-08 18:37:34 +01:00
Daniil Fedotov 1641ecbc11 Improve wait command.
Do not call await_startup on rabbitmq node, instead do it on
rabbitmqctl node, so even if net_ticktime is low, it won't fail
with nodedown.
2017-06-08 18:15:21 +01:00
Daniil Fedotov b802fcdf87 Do not try to connect to the RabbitMQ node before executing command
Commands are supposed to return bardpc errors, which are handled by output,
so there is no need to connect to the node before calling the run function.
2017-06-07 16:21:53 +01:00
Daniil Fedotov b8d6042046 Quiet mode for wait command will suppress log messages 2017-06-07 14:22:59 +01:00
Jean-Sébastien Pédron cd377eeb0f Merge branch 'rabbitmq-cli-wait-stages' 2017-06-07 13:42:36 +02:00
Daniil Fedotov fe2568e6ba Fix function arity when testing handle_command_output 2017-06-06 12:20:18 +01:00
Daniil Fedotov 27fc29914c Test exec command 2017-06-06 12:07:00 +01:00
Daniil Fedotov 5c98699a29 Add new test to check argument processing typical to multiple commands.
Check that merge_defaults does not fail on badmatch with arbitrary args.
Check that info keys can be a comma-separated list
2017-06-06 12:06:17 +01:00
Daniil Fedotov b4a8789ed1 Wait in stages.
Make wait command work in stages with timeouts.
First wait for a pid file to appear (times out)
Then wait for erlang distribution to start on the node (times out)
Then wait for application to be running in the node (does not time out)

Default timeout is set to 10 seconds, which should be enough to
write a pid file and start distribution.
2017-06-02 16:48:34 +01:00
Daniil Fedotov 6cf003ed03 Typo in info message 2017-06-02 14:35:52 +01:00
Daniil Fedotov 48e4c376f9 Check that there are no errors in report command output 2017-06-02 12:34:45 +01:00
Daniil Fedotov fe8df8a2d7 Trace on/off commands output test 2017-06-02 12:30:45 +01:00
Daniil Fedotov 5b42862016 Fix tests 2017-05-24 13:46:34 +01:00
Daniil Fedotov 60deb8514d Improve error reporting.
badrpc errors are handled in Rabbitmqctl module.
Report errors from node discovery
Add helpers to skip errors in formatters.
2017-05-24 12:08:03 +01:00
Michael Klishin a10ecbdb7a This command belongs to diagnostics, not ctl 2017-04-30 01:27:44 +02:00
Michael Klishin 48f79daa09 Don't output backend information; declare a formatter instead of delegating to it 2017-04-30 01:25:27 +02:00
Gabriele Santomaggio 5b8cdf37a1 Rename list_discover_peers with discover_peers 2017-04-28 18:47:35 +02:00
Gabriele Santomaggio 4fa68912a4 Format result
Add Backend type
Add simple unit test
2017-04-28 18:12:04 +02:00
Michael Klishin 1805012f77 Merge branch 'master' into rabbitmq-cli-shutdown 2017-04-07 22:31:54 +02:00
Michael Klishin ac8b32f61a Merge branch 'master' into rabbitmq-cli-180
Conflicts:
	lib/rabbitmq/cli/core/distribution.ex
2017-04-05 15:03:52 +03:00
Daniil Fedotov 5c18bcf8b0 Test shutdown command validation. 2017-04-05 12:00:32 +01:00
Daniil Fedotov 62a44ac641 Optimize rabbitmqctl startup.
Plugins dirs are added to ERL_LIBS by shell scripts, we try to load
enabled plugins first and scan plugins dir only if some of them
are not found.
When discovering plugins, we can load applications only for enabled ones.
EPMD can be started only after initial `net_kernel:start` call failed.
We don't need to discover all commands every time, only if a command is not
in the `rabbitmqctl` application modules.
[finishes #143025009]
2017-04-04 14:06:53 +01:00
Daniil Fedotov 1e1cb92a44 Make it possible to specify erlang cookie from command line
Add new flag `--erlang-cookie` and environment variable `RABBITMQ_ERLANG_COOKIE`
to configure a cookie for CLI to connect to RabbitMQ node.
2017-04-03 14:46:26 +01:00
Daniil Fedotov 00a298961a Print diagnostics on nodedown error
[finishes #142492945]
2017-03-31 11:28:41 +01:00
Michael Klishin 2dc56b3737 hipe_compile: reject blank, non-existent paths and those with insufficient permissions
References #178.
2017-03-14 01:49:04 +03:00
Michael Klishin ef98536ab4 rabbitmqctl hipe_compile WIP 2017-03-10 01:01:03 +03:00
Gerhard Lazu 4c6e83f8f5 Fix help command test
It would sometimes fail, based on the order of tests
2017-03-09 15:12:45 +00:00
Jean-Sébastien Pédron 61ba37f3f7 Fix all warnings reported by Elixir 1.4.x in the testsuite 2017-02-28 16:16:54 +01:00
Diana Corbacho 87331bb95e Exclude applications that are not RabbitMQ plugins from the list of plugins 2017-02-27 14:52:40 +00:00
Michael Klishin ec9cadbbb2 Wording 2017-02-21 19:52:06 +03:00
Michael Klishin 691b88670d Merge branch 'master' into rabbitmq-cli-10 2017-02-21 11:34:07 +03:00
Michael Klishin 0bbecbca8a Wait a tad to ensure all connections are closed and accounted for 2017-02-21 02:10:35 +03:00
Michael Klishin ad483d1f4e Tiny refactoring 2017-02-21 02:00:43 +03:00
Michael Klishin 9f5384838e Set enable plugins before running this test 2017-02-21 01:45:06 +03:00
Daniil Fedotov 95fe5c96fd Document aliases. Improve eval command to accept bound arguments 2017-02-16 12:41:26 +00:00
Daniil Fedotov 2b4012127e Support aliases
Fixes #10

Loads aliases in "name = command_name [arguments and options]" format from --aliases-file
2017-02-15 18:03:45 +00:00
Daniil Fedotov 8efb8a32ab Do not use Mix in production code.
Fixes #174

Mix is not bundled into the escript file, so sould not
be used in the code.
2017-02-15 10:46:08 +00:00
Michael Klishin 187bb25e82 Remove a couple of non-essential but fairly fragile tests
Incorrect help output is impossible to not notice (or hear
about from the users very quickly) but currently some tests
depend on command scoping (in that if an earlier test loaded
some extra commands it messes up with `help` output).
2017-02-07 15:43:24 +03:00
Michael Klishin 879df89a86 Merge branch 'master' into rabbitmq-server-1085 2017-02-05 23:24:24 +03:00
Michael Klishin abf7bab4d2 Don't match on exact error message
References rabbitmq/rabbitmq-common#164.
2017-02-02 00:13:13 +03:00
Arnaud Cogoluègnes 62cdd4d7fc Merge branch 'master' into rabbitmq-server-1085 2017-01-31 17:20:52 +01:00
Michael Klishin 54d98e99de Make these two tests pass
They are arguably not worth keeping at this point because they depend
on the exact output formatting and don't contribute much. It is extremely
unlikely that we will leave out info items and not notice it immediately
given that this CLI generation has already been integrated.
2017-01-27 18:44:14 +03:00
Michael Klishin 2a9c24af2c Merge branch 'master' into rabbitmq-server-release-12 2017-01-27 18:33:19 +03:00
Jean-Sébastien Pédron 61d8bb836e Merge pull request #171 from rabbitmq/rabbitmq-cli-170
Validate enabled plugins version requirements
2017-01-27 16:29:04 +01:00
Daniil Fedotov 0e13568ec3 Move plugin validation from `validate` to `run` 2017-01-27 14:55:09 +00:00
Daniil Fedotov 77860364bb Merge branch 'master' into rabbitmq-server-release-12 2017-01-27 10:42:58 +00:00
Daniil Fedotov d76229a3d1 Test plugin version validation when enabling all plugins 2017-01-26 16:28:01 +00:00
Daniil Fedotov df95a411c7 Format user_already_exists error 2017-01-26 12:33:56 +00:00
Daniil Fedotov 52ad0d2a39 Validate enabled plugins version requirements 2017-01-26 12:21:20 +00:00
Daniil Fedotov a5857e13d8 Handle auto-completion line as argv, not a single argument
It's easier to detect a script name if passed as argv list.
Arguments can be parsed with quoted spaces (e.g. in directory path)
2017-01-24 14:40:31 +00:00
Daniil Fedotov b58da01921 More tests for autocomplete 2017-01-24 12:35:22 +00:00
Daniil Fedotov 1a7bdc871b Fix some compiler warnings in tests 2017-01-24 12:33:48 +00:00
Daniil Fedotov 3871c4ccde Support autocompletion with different script names 2017-01-24 12:30:12 +00:00
Daniil Fedotov 6288d75472 Cleanup compiler warnings 2017-01-24 09:59:00 +00:00
Arnaud Cogoluègnes 57f2eff218 Add read to topic permissions
Part of rabbitmq/rabbitmq-server#1085
2017-01-23 10:12:03 +01:00
Michael Klishin ed68f0e957 Merge pull request #166 from rabbitmq/rabbitmq-event-exchange-10
Provide cli user as user who performs action for event notifications
2017-01-21 02:05:19 +03:00
Daniil Fedotov b7fb43fb48 Fix auto complete module to support new parser API 2017-01-18 15:38:33 +00:00
Michael Klishin ee34fac5bd Merge branch 'master' into rabbitmq-event-exchange-10 2017-01-17 20:28:03 +03:00
Michael Klishin 8c984eac31 Merge branch 'master' into rabbitmq-cli-165 2017-01-17 18:38:27 +03:00
Michael Klishin 5b473b085c Close all connections before this test 2017-01-17 18:38:14 +03:00
Daniil Fedotov bb57a213c0 List vhost limits command 2017-01-17 13:02:09 +00:00
Diana Corbacho fd6ba841cd Provide cli user as user who performs action for event notifications 2017-01-17 09:01:14 +00:00
Daniil Fedotov cea4e1803c Adopt tests to the new rabbit_vhost_limits:list API 2017-01-16 12:09:10 +00:00
Michael Klishin 98ff75da70 Don't assume there aren't any topic permissions at the start of this test 2017-01-13 15:01:13 +03:00
Michael Klishin 5e15f5c2d2 Merge branch 'master' into rabbitmq-server-505 2017-01-12 12:58:27 +03:00
Daniil Fedotov 5c2d9bbc7b Close connections for every test 2017-01-11 14:17:26 +00:00
Jean-Sébastien Pédron 5905f1c40a Update copyright line to year 2017 2017-01-10 15:42:40 +01:00
Michael Klishin 82a4b4abae Close all connections first in these tests 2017-01-07 05:26:33 +08:00
Michael Klishin 6c5c35e4b1 Wording 2017-01-07 05:13:57 +08:00
Michael Klishin b12edd9b6c Cosmetics 2017-01-07 03:43:22 +08:00
Diana Corbacho b2b804eda9 Limit number of connections to close 2017-01-06 15:15:31 +01:00
Diana Corbacho da8e333209 Test close all connections command 2017-01-06 13:54:48 +01:00
Arnaud Cogoluègnes 50f5738b02 Rename name to exchange in topic permissions
References rabbitmq/rabbitmq-server#505
2017-01-03 12:01:33 +01:00
Jean-Sébastien Pédron e9121fe08c {enable,disable}_plugins_command_test.exs: Adapt test
... after change in 530a9c7d83.

[#136769947]
2016-12-29 18:14:07 +01:00
Jean-Sébastien Pédron 6864f7e510 help_command_test.exs: Fix warning about unused alias 2016-12-29 17:52:54 +01:00
Arnaud Cogoluègnes 6160bdd57e Merge branch 'master' into rabbitmq-server-505 2016-12-27 16:43:57 +01:00
Daniil Fedotov ab392e2737 Fix arguments to restore vm_watermark in test 2016-12-23 13:32:19 +00:00
Daniil Fedotov 30b41ba267 Support start from common_test tests 2016-12-23 12:12:33 +00:00
Arnaud Cogoluègnes 8d95b7455a Fix topic authorisation tests
References rabbitmq/rabbitmq-server#505
2016-12-22 17:42:03 +01:00
Arnaud Cogoluègnes c7a11fad38 Merge branch 'master' into rabbitmq-server-505 2016-12-22 17:09:06 +01:00
Arnaud Cogoluègnes 1dcc44d5f7 Add topic authorisation commands
References rabbitmq/rabbitmq-server#505
2016-12-22 16:50:59 +01:00
Daniil Fedotov 22aed07b7d Get cluster name using rabbit_nodes to avoid writing not_found 2016-12-22 15:48:58 +00:00
Diana Corbacho 7b689ae633 Detailed error message in memory threshold validation 2016-12-22 12:13:46 +01:00
Michael Klishin 544e7155e5 Cosmetics, wording 2016-12-16 21:16:07 +03:00
Arnaud Cogoluègnes 93ca16c5ff Add global parameters commands
Part of rabbitmq/rabbitmq-mqtt#73
2016-12-16 16:41:29 +01:00
Gerhard Lazu 240c7c0862 Merge pull request #156 from rabbitmq/rabbitmq-cli-153
Load .ez plugins without version
2016-12-14 17:00:40 +00:00
Gerhard Lazu 4d46936749 Be more specific about what is being stopped on `stop_app`
rabbitmq/rabbitmq-server#1043
2016-12-14 12:04:54 +00:00