... and cache it.
[Why]
It happens at least in CI that the computed start time varies by a few
seconds. I think this comes from the Erlang time offset which might be
adjusted over time.
This affects peer discovery's sorting of RabbitMQ nodes which uses that
start time to determine the oldest node. When the start time of a node
changes, it could be considered the seed node to join by some nodes but
ignored by the other nodes, leading to troubles with cluster formation.
Because `ct_master` is yet another Erlang node, and it is used
to run multiple CT nodes, meaning it is in a cluster of CT
nodes, the tests that change the net_ticktime could not
work properly anymore. This is because net_ticktime must
be the same value across the cluster.
The same value had to be set for all tests in order to solve
this. This is why it was changed to 5s across the board. The
lower net_ticktime was used in most places to speed up tests
that must deal with cluster failures, so that value is good
enough for these cases.
One test in amqp_client was using the net_ticktime to test
the behavior of the direct connection timeout with varying
net_ticktime configurations. The test now mocks the
`net_kernel:get_net_ticktime()` function to achieve the
same result.
We don't need to duplicate so many patterns in so many
files since we have a monorepo (and want to keep it).
If I managed to miss something or remove something that
should stay, please put it back. Note that monorepo-wide
patterns should go in the top-level .gitignore file.
Other .gitignore files are for application or folder-
specific patterns.
[Why]
Before `rabbitmq_prelaunch` was moved from `deps/rabbit/apps` to `deps`,
it would inherit compile flags from `deps/rabbit`. Therefore, when
`rabbit` was tested, `rabbit_logger_std_h` simply replaced the calls to
`io:put_chars/2` with an internal macro to also call `ct:log/2`.
This is not possible anymore after the move and the move broke the
console-based testcases.
[How]
`rabbit_logger_std_h` now uses an indirect internal call to a wrapper of
`io:put_chars/2`. This allows the `logging_SUITE` to mock that call and
add the addition call to `ct:log/2`.
We need to do an explicit `?MODULE:io_put_chars/2` even though a local
call would work, otherwise meck can't intercept the calls.
[Why]
`rabbit_logger_std_h` is a fork of Erlang/OTP's `logger_std_h` to:
* allow to mock the call to io:put_chars/2
* support date-based rotation
[How]
The initial fork was from Erlang/OTP 23.0. Here, we update it to
Erlang/OTP 26.1.2.
[Why]
Before `rabbitmq_prelaunch` was moved from `deps/rabbit/apps` to `deps`,
it would inherit compile flags from `deps/rabbit`. Therefore, when
`rabbit` was tested, `rabbitmq_prelaunch` would be compiled with
`-DTEST`.
After the move, this is not the case anymore. Thus, the `logging_SUITE`
testsuite can't call those internal functions anymore.
[How]
Now, the needed functions are always exported. We simply comment that
they are for internal testing purpose and should not be called in
production code.
Discovered while testing
https://github.com/rabbitmq/rabbitmq-server/pull/10108 by using the
lukebakken/docker-rabbitmq-cluster project.
That project, by default, uses longnames for node names. When testing
classic peer discovery, starting a peer node would time out every time.
Ensure `host` is set
[Why]
Building an Erlang release with this application under `apps` happened
to be problematic with Erlang.mk. Our use of deps and apps is not
exactly standard here anyway.
We also get issues with various make targets where `rabbitmq_prelaunch`
is being cleaned and not re-compiled, leading to "application not found"
errors.
[How]
So instead of fighting, move `rabbitmq_prelaunch` to the deps directory,
like all other applications.
This commit is not enough and will be followed with changes to Makefiles
and Bazel files. This is not done in this commit so the changes are
visible. Otherwise, they would be burried in the move.