Commit Graph

847 Commits

Author SHA1 Message Date
Michael Klishin d84340959b Make sure the app is started in these tests 2019-07-18 18:50:43 +03:00
Michael Klishin 37450cc0dc Drop --[no-]interactive support
Per discussion with @lukebakken.

It serves no purpose and to make scripting with stream
redirection work we had to make validation changes that make
that flag irrelevant and even confusing.

The only downside of this behavior is that something like

rabbitmqctl add_user --silent "a-username"

(without a password or redirected stream, with suppressed output)
would "hang" waiting for stdin input. If --silent is omitted
there would be an input prompt, making it clearer what's going on.

Closes #365 with a different behavior from the originally suggested.
2019-07-10 19:08:19 -07:00
Michael Klishin b890fe787b Ditto for ctl change_password
Part of #365.
2019-07-11 00:21:11 +03:00
Michael Klishin 865af70a98 ctl add_user: make password optional, accept it via stdin
Part of #365.
2019-07-10 23:27:29 +03:00
Michael Klishin 358aec5840 ctl authenticate_user: make password optional, accept it via stdin
Part of #365.
2019-07-10 02:17:12 +03:00
Michael Klishin b8acce6a85 Squash a compile warning
(cherry picked from commit 2a8fd5c1b2eae73f936991b17dfaa6fbd0fdbf85)
2019-07-08 03:23:55 +03:00
Michael Klishin 462b480f16 Same as d3c01b3a1f1a65d1d935c3e6e0441388da44ba57 in more places
(cherry picked from commit 68c8d204c08eb9956925e0fb71608a0737f3e771)
2019-07-06 20:31:43 +03:00
Michael Klishin 535f00e08f Let Lager's log message rate lapse before logging in these tests
Otherwise some log messages we assert on might be dropped.

(cherry picked from commit d3c01b3a1f1a65d1d935c3e6e0441388da44ba57)
2019-07-06 18:47:11 +03:00
Michael Klishin 1f07517c96 Wording 2019-07-06 18:08:05 +03:00
Michael Klishin 4f179948ad Cosmetics 2019-07-06 18:07:28 +03:00
Michael Klishin fe1e95a28c Wording 2019-07-06 17:59:49 +03:00
Michael Klishin 7de3958482 Await log update in this test 2019-07-06 17:57:54 +03:00
Michael Klishin ff051eec63 Test expectation update 2019-07-06 17:39:49 +03:00
Michael Klishin e50489eba7 Display 50 lines by default; cosmetics 2019-07-06 13:47:39 +03:00
Michael Klishin 435670c083 Update test expectations 2019-07-04 18:57:40 +02:00
Daniil Fedotov 78cc33420e Log commands tests 2019-06-27 13:46:08 -04:00
Michael Klishin 0ab7e36893 These two annotations are not used 2019-06-13 15:40:49 +03:00
Diana Corbacho f9bf3154a9 Command to log schema information
Logs by default name, cookie, active_replicas and user_properties
Any other mnesia property can be requested as info key

[#164550205]
2019-06-13 13:08:29 +01:00
Michael Klishin 54898185c5 Update test assertions 2019-05-29 14:03:08 +01:00
Michael Klishin dde11237e4 Basic tests for Diagnostics.CheckVirtualHostsCommand 2019-05-29 13:58:29 +01:00
Jean-Sébastien Pédron 5b6b9a7a69 test: Increase some timeouts so the testsuite passes on slow VMs 2019-05-14 17:51:42 +02:00
Michael Klishin 8ddd777c84 Re-enable a Diagnostics.ObserverCommand test 2019-05-11 11:07:53 +03:00
Michael Klishin e840b5a6a4 Basic tests for Diagnostics.ObserverCommand 2019-05-11 00:22:29 +03:00
Jean-Sébastien Pédron 2c03dc56c2 test/ctl/*feature_flags*: Use arbitrary feature flags, not `quorum_queue`
This allows to backport the test to v3.7.x.
2019-05-06 15:37:40 +02:00
Michael Klishin a61357b7e4 Cosmetics 2019-04-29 00:57:55 +03:00
Michael Klishin af32abbcd9 Merge pull request #351 from rabbitmq/rabbitmq-cli-345
Improve error reporting for invalid node names
2019-04-26 16:38:08 +03:00
Michael Klishin 8e7a02ff81 Naming 2019-04-25 20:13:39 +03:00
Michael Klishin 4cb2d05c9c Improve error reporting of invalid node names
While at it, format errors thrown in a few more risky
code paths.

Closes #345.
2019-04-25 17:15:25 +03:00
Michael Klishin ab5143e7df diagnostics erlang_version: support --offline
Closes #315.
2019-04-25 15:01:18 +03:00
Michael Klishin 3d5281508b Merge pull request #347 from rabbitmq/rabbitmq-cli-342
Add a flag to cipher_suites command to get all ciphers. Add --format flag to select format. Remove openssl_format flag
2019-04-25 04:19:42 +03:00
Michael Klishin 50f4d42fac Wording 2019-04-25 04:17:06 +03:00
Daniil Fedotov a74f8b930e Replace multiple format flags with a single `--format` flag. 2019-04-24 17:22:54 -04:00
Daniil Fedotov b53a16681a Add more flags to cipher_suites command to return all available suites and more formats.
Support new map format for cipher suites added in OTP-20.3
Support --all flag to get all available ciphers

Addresses #342
Depends on changes in rabbitmq-server
2019-04-24 15:37:28 -04:00
Michael Klishin d01b25574c Upgrade to amqp ~> 1.2, start amqp app before connecting 2019-04-24 22:37:05 +03:00
Michael Klishin 3bdfae0392 Give queue proceess and client some time to boot before consuming in slower CI environments 2019-04-24 22:09:44 +03:00
Michael Klishin d926bc26b8 enable_feature_flag: handle cases where target node does not support the flag
or any flags.

[#163980302]
2019-04-20 02:44:22 +03:00
Michael Klishin 81b84244af One more JSON formatting test case 2019-04-19 05:19:46 +03:00
Michael Klishin 95a7d37f1a New integration suite: JSON formatter 2019-04-19 05:17:28 +03:00
Michael Klishin 11774a3ff1 cluster_status: list RabbitMQ and Erlang versions
Per suggestion from @gerhard.
2019-04-19 05:17:12 +03:00
Michael Klishin 11f0b45732 cluster_status: rework output format, support JSON formatter
[#165435068]
2019-04-18 04:00:05 +04:00
Michael Klishin 69b5784410 Reset an unintionally lowered timeout in this test 2019-04-12 04:12:50 +04:00
Michael Klishin 45b48f2f04 Merge branch 'master' into rabbitmq-cli-340 2019-04-12 02:30:39 +04:00
Michael Klishin 66d6cf1173 Update :badrpc test cases to be more resilient (part 2)
On some networks the response is a timeout, not a nodedown. That's
acceptable for this test.
2019-04-12 02:27:15 +04:00
Michael Klishin 60fc0ee25c Update helper tests
(cherry picked from commit dd022e3be2)
2019-04-12 01:45:09 +04:00
Michael Klishin 796c973a1c Extract Core.Memory from Core.Helpers
In preparation for #340.

(cherry picked from commit 990e38a245)
2019-04-12 01:44:58 +04:00
Michael Klishin 001087d945 Update :badrpc test cases to be more resilient
On some networks the response is a timeout, not a nodedown. That's
acceptable for this test.
2019-04-12 01:43:54 +04:00
Michael Klishin dd022e3be2 Update helper tests 2019-04-12 01:43:36 +04:00
Michael Klishin 990e38a245 Extract Core.Memory from Core.Helpers
In preparation for #340.
2019-04-11 22:09:16 +04:00
Michael Klishin b7932ab6d4 Extract Core.Alarms and Core.Listeners from Diagnostics.Helpers 2019-04-11 01:38:20 +03:00
Michael Klishin 9cb776c98e Squash a warning 2019-04-10 15:22:38 +03:00
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