Commit Graph

54 Commits

Author SHA1 Message Date
dcorbacho 679ca254f3 Switch to Mozilla Public License 2.0 (MPL 2.0) 2020-07-11 19:23:07 +01:00
Michael Klishin 921d349e37 Make --help, help usage help messages consistent
* `help` printed an "Error:" at the top for no reason
 * `help [command]` with a non-existent command did not offer a suggestion
   like an attempt to invoke a non-existent command would
 * Exit codes were not consistent
 * `help --list-commands` had line break issues

With this change,

  * `help` is consistent with --help
  * `help [command]` is consistent with `[command] --help`
  * If a command is not found, either during the execution flow
    or `help [commnad]`, we consistently attempt a Jaro distance suggestion
  * Successful or effectively successful exits from the `help`
    command do not produce any error messages at the top
2020-06-29 03:57:52 +03:00
Michael Klishin 2bd6c95375 Rely on rabbit_env to infer node name
During the 3.8.4 cycle we have backported `rabbit_env` to v3.8.x.
Instead of messing with env variable prefixing, it tries both
RABBITMQ_{VAR} and {VAR} environment variables. However,
in CLI tools node name currently only picks up RABBITMQ_NODENAME,
so environments where node name has to be explicitly configured
via rabbitmq-env.conf:

NODENAME=rabbit@our.custom.hostname

would not pick this node name up. RABBITMQ_NODENAME had to be added
as a workaround.

With this change the behavior of CLI tools and the server is closer.

Note that this updates a few places which used `Config.get_option/2`
to get a "default node name" which more often than not ended up
being a node prefix ("rabbit"). Those tests had to be updated
to use `Config.default/1`.

Closes #421.
References c8e766dec7, 8a5ab87038.
2020-05-28 02:54:33 +03:00
Jean-Sébastien Pédron 0e15591bf5 Update copyright (year 2020) 2020-03-10 15:39:56 +01:00
Michael Klishin 73776fbf04 (c) bump 2019-12-29 05:50:26 +03:00
Michael Klishin 8b7c83bf6e Rename a test file 2019-12-11 04:56:04 +03:00
Michael Klishin 7c5933052e Finish ctl import_definitions 2019-11-16 06:46:26 +03:00
Michael Klishin 99e9b0b2b6 Simplify these assertions a bit 2019-10-08 09:41:31 -05:00
Arnaud Cogoluègnes f0bba26e8c Add test for certificate expiration verification
References #304, #305
2019-10-08 16:10:04 +02:00
Michael Klishin c7e60774d0 Minor Prometheus listener description edits 2019-09-26 13:05:32 +03:00
Arnaud Cogoluègnes 67a38fc2e9 Handle empty output in JSON stream
Some streaming commands with a duration argument can send the empty
string as the output (along with a finishing marker). This case was not
handled properly and would result in a stack trace when the command
returned once the duration has elapsed.
2019-09-25 16:56:47 +02: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 60fc0ee25c Update helper tests
(cherry picked from commit dd022e3be2)
2019-04-12 01:45:09 +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 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 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 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
Josh Soref 0ef7adafe7 spelling: mysterious 2019-02-24 02:01:00 -05: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
Michael Klishin 92851c4f88 Test modules should be named *_test.exs 2019-02-03 05:12:23 +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 df39f2ccd1 Update (c) year in tests 2019-01-21 11:15:48 +03:00
Michael Klishin 6ae2a395af Squash a warning 2019-01-20 09:08:55 +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
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 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
Michael Klishin ef98536ab4 rabbitmqctl hipe_compile WIP 2017-03-10 01:01:03 +03: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
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
Daniil Fedotov b7fb43fb48 Fix auto complete module to support new parser API 2017-01-18 15:38:33 +00:00