rabbitmq-server/deps/amqp_client/test/unit_SUITE.erl

372 lines
16 KiB
Erlang
Raw Normal View History

%% This Source Code Form is subject to the terms of the Mozilla Public
%% License, v. 2.0. If a copy of the MPL was not distributed with this
%% file, You can obtain one at https://mozilla.org/MPL/2.0/.
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
%%
2023-01-02 12:17:36 +08:00
%% Copyright (c) 2016-2023 VMware, Inc. or its affiliates. All rights reserved.
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
%%
-module(unit_SUITE).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
-include("amqp_client.hrl").
-compile(export_all).
all() ->
[
amqp_uri_parsing,
amqp_uri_accepts_string_and_binaries,
amqp_uri_remove_credentials,
uri_parser_accepts_string_and_binaries,
route_destination_parsing,
rabbit_channel_build_topic_variable_map
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
].
%% -------------------------------------------------------------------
%% AMQP URI parsing.
%% -------------------------------------------------------------------
amqp_uri_parsing(_Config) ->
%% From the spec (adapted)
?assertMatch({ok, #amqp_params_network{username = <<"user">>,
password = <<"pass">>,
host = "host",
port = 10000,
virtual_host = <<"vhost">>,
heartbeat = 5}},
amqp_uri:parse(
"amqp://user:pass@host:10000/vhost?heartbeat=5")),
?assertMatch({ok, #amqp_params_network{username = <<"usera">>,
password = <<"apass">>,
host = "hoast",
port = 10000,
virtual_host = <<"v/host">>}},
amqp_uri:parse(
"aMQp://user%61:%61pass@ho%61st:10000/v%2fhost")),
?assertMatch({ok, #amqp_params_direct{}}, amqp_uri:parse("amqp://")),
?assertMatch({ok, #amqp_params_direct{username = <<"">>,
virtual_host = <<"">>}},
amqp_uri:parse("amqp://:@/")),
% https://github.com/rabbitmq/rabbitmq-server/issues/1663
?assertEqual({error,{port_requires_host,"amqp://:1234"}},
amqp_uri:parse("amqp://:1234")),
?assertMatch({ok, #amqp_params_network{host = "localhost",
port = 1234}},
amqp_uri:parse("amqp://localhost:1234")),
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
?assertMatch({ok, #amqp_params_network{username = <<"">>,
password = <<"">>,
virtual_host = <<"">>,
host = "host"}},
amqp_uri:parse("amqp://:@host/")),
?assertMatch({ok, #amqp_params_direct{username = <<"user">>}},
amqp_uri:parse("amqp://user@")),
?assertMatch({ok, #amqp_params_network{username = <<"user">>,
password = <<"pass">>,
host = "localhost"}},
amqp_uri:parse("amqp://user:pass@localhost")),
?assertMatch({ok, #amqp_params_network{host = "host",
virtual_host = <<"/">>}},
amqp_uri:parse("amqp://host")),
?assertMatch({ok, #amqp_params_network{port = 10000,
host = "localhost"}},
amqp_uri:parse("amqp://localhost:10000")),
?assertMatch({ok, #amqp_params_direct{virtual_host = <<"vhost">>}},
amqp_uri:parse("amqp:///vhost")),
?assertMatch({ok, #amqp_params_network{host = "host",
virtual_host = <<"">>}},
amqp_uri:parse("amqp://host/")),
?assertMatch({ok, #amqp_params_network{host = "host",
virtual_host = <<"/">>}},
amqp_uri:parse("amqp://host/%2f")),
?assertMatch({ok, #amqp_params_network{host = "::1"}},
amqp_uri:parse("amqp://[::1]")),
2019-02-13 04:25:31 +08:00
%% Various other cases
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
?assertMatch({ok, #amqp_params_network{host = "host", port = 100}},
amqp_uri:parse("amqp://host:100")),
?assertMatch({ok, #amqp_params_network{host = "::1", port = 100}},
amqp_uri:parse("amqp://[::1]:100")),
?assertMatch({ok, #amqp_params_network{host = "host",
virtual_host = <<"blah">>}},
amqp_uri:parse("amqp://host/blah")),
?assertMatch({ok, #amqp_params_network{host = "host",
port = 100,
virtual_host = <<"blah">>}},
amqp_uri:parse("amqp://host:100/blah")),
?assertMatch({ok, #amqp_params_network{host = "::1",
virtual_host = <<"blah">>}},
amqp_uri:parse("amqp://[::1]/blah")),
?assertMatch({ok, #amqp_params_network{host = "::1",
port = 100,
virtual_host = <<"blah">>}},
amqp_uri:parse("amqp://[::1]:100/blah")),
?assertMatch({ok, #amqp_params_network{username = <<"user">>,
password = <<"pass">>,
host = "host"}},
amqp_uri:parse("amqp://user:pass@host")),
?assertMatch({ok, #amqp_params_network{username = <<"user">>,
password = <<"pass">>,
port = 100}},
amqp_uri:parse("amqp://user:pass@host:100")),
?assertMatch({ok, #amqp_params_network{username = <<"user">>,
password = <<"pass">>,
host = "::1"}},
amqp_uri:parse("amqp://user:pass@[::1]")),
?assertMatch({ok, #amqp_params_network{username = <<"user">>,
password = <<"pass">>,
host = "::1",
port = 100}},
amqp_uri:parse("amqp://user:pass@[::1]:100")),
%% TLS options
?assertEqual({error,{port_requires_host,"amqps://:5671"}},
amqp_uri:parse("amqps://:5671")),
?assertMatch({ok, #amqp_params_network{host = "localhost",
port = 5671}},
amqp_uri:parse("amqps://localhost:5671")),
{ok, #amqp_params_network{host = "host1", ssl_options = TLSOpts1}} =
amqp_uri:parse("amqps://host1/%2f?cacertfile=/path/to/cacertfile.pem"),
2020-04-01 19:06:44 +08:00
Exp1 = [
{cacertfile,"/path/to/cacertfile.pem"},
{server_name_indication,"host1"}
],
?assertEqual(lists:usort(Exp1), lists:usort(TLSOpts1)),
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
{ok, #amqp_params_network{host = "host3", ssl_options = TLSOpts3}} =
amqp_uri:parse("amqps://host3/%2f?verify=verify_peer"
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
"&fail_if_no_peer_cert=true"),
Exp3 = [{fail_if_no_peer_cert, true},
2020-04-01 19:06:44 +08:00
{verify, verify_peer},
{server_name_indication,"host3"}],
?assertEqual(lists:usort(Exp3), lists:usort(TLSOpts3)),
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
{ok, #amqp_params_network{host = "host4", ssl_options = TLSOpts4}} =
amqp_uri:parse("amqps://host4/%2f?cacertfile=/path/to/cacertfile.pem"
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
"&certfile=/path/to/certfile.pem"
"&password=topsecret"
"&depth=5"),
Exp4 = [{certfile, "/path/to/certfile.pem"},
{cacertfile,"/path/to/cacertfile.pem"},
{password, "topsecret"},
2020-04-01 19:06:44 +08:00
{depth, 5},
{server_name_indication,"host4"}],
?assertEqual(lists:usort(Exp4), lists:usort(TLSOpts4)),
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
{ok, #amqp_params_network{host = "host7", ssl_options = TLSOpts7}} =
amqp_uri:parse("amqps://host7/%2f?server_name_indication=disable"),
?assertEqual(lists:usort([{server_name_indication, disable}]),
lists:usort(TLSOpts7)),
{ok, #amqp_params_network{host = "127.0.0.1", ssl_options = TLSOpts8}} =
amqp_uri:parse("amqps://127.0.0.1/%2f?server_name_indication=disable"
"&verify=verify_none"),
?assertEqual(lists:usort([{server_name_indication, disable},
{verify, verify_none}]),
lists:usort(TLSOpts8)),
{ok, #amqp_params_network{host = "127.0.0.1", ssl_options = TLSOpts9}} =
amqp_uri:parse("amqps://127.0.0.1/%2f?cacertfile=/path/to/cacertfile.pem"
"&certfile=/path/to/certfile.pem"
"&password=topsecret"
"&depth=5"),
?assertEqual(lists:usort([{certfile, "/path/to/certfile.pem"},
{cacertfile,"/path/to/cacertfile.pem"},
{password, "topsecret"},
{depth, 5}]),
lists:usort(TLSOpts9)),
{ok, #amqp_params_network{host = "host10", ssl_options = TLSOpts10}} =
amqp_uri:parse("amqps://host10/%2f?server_name_indication=host10"
"&verify=verify_none"),
Exp10 = [{server_name_indication, "host10"},
{verify, verify_none}],
?assertEqual(lists:usort(Exp10), lists:usort(TLSOpts10)),
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
%% Various failure cases
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/pipermail/erlang-bugs/2012-June/002933.html (200) with 1 occurrences could not be migrated: ([https](https://erlang.org/pipermail/erlang-bugs/2012-June/002933.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). ## 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://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://tools.ietf.org/html/rfc3986 with 1 occurrences migrated to: https://tools.ietf.org/html/rfc3986 ([https](https://tools.ietf.org/html/rfc3986) 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.erlang.org/ with 1 occurrences migrated to: https://www.erlang.org/ ([https](https://www.erlang.org/) result 200). * http://www.rabbitmq.com with 1 occurrences migrated to: https://www.rabbitmq.com ([https](https://www.rabbitmq.com) result 200). * http://www.rabbitmq.com/ with 2 occurrences migrated to: https://www.rabbitmq.com/ ([https](https://www.rabbitmq.com/) result 200). * http://www.rabbitmq.com/build-erlang-client.html with 1 occurrences migrated to: https://www.rabbitmq.com/build-erlang-client.html ([https](https://www.rabbitmq.com/build-erlang-client.html) result 200). * http://www.rabbitmq.com/erlang-client-user-guide.html with 2 occurrences migrated to: https://www.rabbitmq.com/erlang-client-user-guide.html ([https](https://www.rabbitmq.com/erlang-client-user-guide.html) result 200). * http://www.rabbitmq.com/protocol.html with 1 occurrences migrated to: https://www.rabbitmq.com/protocol.html ([https](https://www.rabbitmq.com/protocol.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://saleyn.github.com/erlexec with 1 occurrences migrated to: https://saleyn.github.com/erlexec ([https](https://saleyn.github.com/erlexec) result 301). * http://www.erlang.org/doc/man/gen_tcp.html with 1 occurrences migrated to: https://www.erlang.org/doc/man/gen_tcp.html ([https](https://www.erlang.org/doc/man/gen_tcp.html) result 301). * http://www.erlang.org/doc/man/inet.html with 1 occurrences migrated to: https://www.erlang.org/doc/man/inet.html ([https](https://www.erlang.org/doc/man/inet.html) result 301). * http://www.mozilla.org/MPL/ with 27 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 16:14:58 +08:00
?assertMatch({error, _}, amqp_uri:parse("https://www.rabbitmq.com")),
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
?assertMatch({error, _}, amqp_uri:parse("amqp://foo:bar:baz")),
?assertMatch({error, _}, amqp_uri:parse("amqp://foo[::1]")),
?assertMatch({error, _}, amqp_uri:parse("amqp://foo:[::1]")),
?assertMatch({error, _}, amqp_uri:parse("amqp://[::1]foo")),
?assertMatch({error, _}, amqp_uri:parse("amqp://foo:1000xyz")),
?assertMatch({error, _}, amqp_uri:parse("amqp://foo:1000000")),
?assertMatch({error, _}, amqp_uri:parse("amqp://foo/bar/baz")),
?assertMatch({error, _}, amqp_uri:parse("amqp://foo%1")),
?assertMatch({error, _}, amqp_uri:parse("amqp://foo%1x")),
?assertMatch({error, _}, amqp_uri:parse("amqp://foo%xy")),
ok.
amqp_uri_accepts_string_and_binaries(_Config) ->
[?assertMatch({ok, #amqp_params_network{username = <<"user">>,
password = <<"pass">>,
host = "host",
port = 10000,
virtual_host = <<"vhost">>,
heartbeat = 5}},
amqp_uri:parse(Uri))
|| Uri <- string_binaries_uris()],
ok.
amqp_uri_remove_credentials(_Config) ->
[?assertMatch("amqp://host:10000/vhost",
amqp_uri:remove_credentials(Uri))
|| Uri <- string_binaries_uris()],
ok.
uri_parser_accepts_string_and_binaries(_Config) ->
[?assertMatch([{fragment,[]},
{host,"host"},
{path,"/vhost"},
{port,10000},
{query,[{"heartbeat","5"}]},
{scheme,"amqp"},
{userinfo,["user","pass"]}],
uri_parser:parse(Uri, []))
|| Uri <- string_binaries_uris()],
ok.
string_binaries_uris() ->
["amqp://user:pass@host:10000/vhost?heartbeat=5", <<"amqp://user:pass@host:10000/vhost?heartbeat=5">>].
Switch testsuite to common_test All tests were moved from `test_util.erl` and `negative_test_util.erl` to `unit_SUITE.erl` and `system_SUITE.erl`. `unit_SUITE.erl` has only unit tests and doesn't need a running broker. `system_SUITE.erl` has system integration tests and takes care of starting and setting up a broker itself. `make tests` automatically runs common_test tests. All our specific Makefile targets are not used anymore. The new testsuite just needs targets to start/stop a node and set/clear resource alarms. In `system_SUITE.erl`, almost all tests are executed with direct and network connections. Therefore, they are listed in two groups: o direct_connection_tests o network_connection_tests To run the whole testsuite: make tests To run only one group: make ct-system t=network_connection_tests To run one test in a group: make ct-system t=network_connection_tests:basic_consume We also use common_test to handle the tests which are repeated 100 times. The started node stores all its data in a subdirectory of the `logs` directory and not in `/tmp`. This allows to keep the database and log files for each run of the testsuite. erlang.mk is updated at the same time: we don't need to disable any Erlang.mk plugins anymore. Many helper functions will be moved to rabbitmq-common or rabbitmq-test, once we are happy with them, so they can be used in other testsuites. V2: Move helper functions to rabbit_ct_helpers.erl. V3: Get rid of last eunit bits. V4: Improve executed command quoting. V5: Use rabbitmq-common to create TLS certificates and drop dependency to rabbitmq-test. Fixes #39.
2016-03-08 20:23:03 +08:00
%% -------------------------------------------------------------------
%% Route destination parsing.
%% -------------------------------------------------------------------
route_destination_parsing(_Config) ->
%% valid queue
?assertMatch({ok, {queue, "test"}}, parse_dest("/queue/test")),
%% valid topic
?assertMatch({ok, {topic, "test"}}, parse_dest("/topic/test")),
%% valid exchange
?assertMatch({ok, {exchange, {"test", undefined}}}, parse_dest("/exchange/test")),
%% valid temp queue
?assertMatch({ok, {temp_queue, "test"}}, parse_dest("/temp-queue/test")),
%% valid reply queue
?assertMatch({ok, {reply_queue, "test"}}, parse_dest("/reply-queue/test")),
?assertMatch({ok, {reply_queue, "test/2"}}, parse_dest("/reply-queue/test/2")),
%% valid exchange with pattern
?assertMatch({ok, {exchange, {"test", "pattern"}}},
parse_dest("/exchange/test/pattern")),
%% valid pre-declared queue
?assertMatch({ok, {amqqueue, "test"}}, parse_dest("/amq/queue/test")),
%% queue without name
?assertMatch({error, {invalid_destination, queue, ""}}, parse_dest("/queue")),
?assertMatch({ok, {queue, undefined}}, parse_dest("/queue", true)),
%% topic without name
?assertMatch({error, {invalid_destination, topic, ""}}, parse_dest("/topic")),
%% exchange without name
?assertMatch({error, {invalid_destination, exchange, ""}},
parse_dest("/exchange")),
%% exchange default name
?assertMatch({error, {invalid_destination, exchange, "//foo"}},
parse_dest("/exchange//foo")),
%% amqqueue without name
?assertMatch({error, {invalid_destination, amqqueue, ""}},
parse_dest("/amq/queue")),
%% queue without name with trailing slash
?assertMatch({error, {invalid_destination, queue, "/"}}, parse_dest("/queue/")),
%% topic without name with trailing slash
?assertMatch({error, {invalid_destination, topic, "/"}}, parse_dest("/topic/")),
%% exchange without name with trailing slash
?assertMatch({error, {invalid_destination, exchange, "/"}},
parse_dest("/exchange/")),
%% queue with invalid name
?assertMatch({error, {invalid_destination, queue, "/foo/bar"}},
parse_dest("/queue/foo/bar")),
%% topic with invalid name
?assertMatch({error, {invalid_destination, topic, "/foo/bar"}},
parse_dest("/topic/foo/bar")),
%% exchange with invalid name
?assertMatch({error, {invalid_destination, exchange, "/foo/bar/baz"}},
parse_dest("/exchange/foo/bar/baz")),
%% unknown destination
?assertMatch({error, {unknown_destination, "/blah/boo"}},
parse_dest("/blah/boo")),
%% queue with escaped name
?assertMatch({ok, {queue, "te/st"}}, parse_dest("/queue/te%2Fst")),
%% valid exchange with escaped name and pattern
?assertMatch({ok, {exchange, {"te/st", "pa/tt/ern"}}},
parse_dest("/exchange/te%2Fst/pa%2Ftt%2Fern")),
ok.
parse_dest(Destination, Params) ->
rabbit_routing_util:parse_endpoint(Destination, Params).
parse_dest(Destination) ->
rabbit_routing_util:parse_endpoint(Destination).
%% -------------------------------------------------------------------
%% Topic variable map
%% -------------------------------------------------------------------
rabbit_channel_build_topic_variable_map(_Config) ->
AmqpParams = #amqp_params_direct{
adapter_info = #amqp_adapter_info{
additional_info = [
{variable_map, #{<<"client_id">> => <<"client99">>}}]}
},
%% simple case
2019-11-22 03:19:52 +08:00
?assertMatch(
#{<<"client_id">> := <<"client99">>,
<<"username">> := <<"guest">>,
<<"vhost">> := <<"default">>}, rabbit_channel:build_topic_variable_map(
[{amqp_params, AmqpParams}], <<"default">>, <<"guest">>
2019-11-22 03:19:52 +08:00
)),
%% nothing to add
AmqpParams1 = #amqp_params_direct{adapter_info = #amqp_adapter_info{}},
2019-11-22 03:19:52 +08:00
?assertMatch(
#{<<"username">> := <<"guest">>,
<<"vhost">> := <<"default">>}, rabbit_channel:build_topic_variable_map(
[{amqp_params, AmqpParams1}], <<"default">>, <<"guest">>
2019-11-22 03:19:52 +08:00
)),
%% nothing to add with amqp_params_network
AmqpParams2 = #amqp_params_network{},
2019-11-22 03:19:52 +08:00
?assertMatch(
#{<<"username">> := <<"guest">>,
<<"vhost">> := <<"default">>}, rabbit_channel:build_topic_variable_map(
[{amqp_params, AmqpParams2}], <<"default">>, <<"guest">>
2019-11-22 03:19:52 +08:00
)),
%% trying to override channel variables, but those
%% take precedence
AmqpParams3 = #amqp_params_direct{
adapter_info = #amqp_adapter_info{
additional_info = [
{variable_map, #{<<"client_id">> => <<"client99">>,
<<"username">> => <<"admin">>}}]}
},
2019-11-22 03:19:52 +08:00
?assertMatch(#{<<"client_id">> := <<"client99">>,
<<"username">> := <<"guest">>,
<<"vhost">> := <<"default">>}, rabbit_channel:build_topic_variable_map(
[{amqp_params, AmqpParams3}], <<"default">>, <<"guest">>
2019-11-22 03:19:52 +08:00
)),
ok.