2014-04-14 12:02:44 +00:00
|
|
|
# This test runs rabbitmq and checks if rabbitmq is up and running.
|
2014-03-10 10:10:32 +00:00
|
|
|
|
2022-09-23 13:39:06 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ... }:
|
|
|
|
let
|
|
|
|
# in real life, you would keep this out of your repo and deploy it to a safe
|
|
|
|
# location using safe means.
|
|
|
|
configKeyPath = pkgs.writeText "fake-config-key" "hOjWzSEn2Z7cHzKOcf6i183O2NdjurSuoMDIIv01";
|
|
|
|
in
|
|
|
|
{
|
2014-06-28 14:04:49 +00:00
|
|
|
name = "rabbitmq";
|
2021-01-10 19:08:30 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2024-04-21 07:15:22 +00:00
|
|
|
maintainers = [ offline ];
|
2015-07-12 10:09:40 +00:00
|
|
|
};
|
2014-03-10 10:10:32 +00:00
|
|
|
|
2022-03-20 23:15:30 +00:00
|
|
|
nodes.machine = {
|
2021-08-30 08:11:49 +00:00
|
|
|
services.rabbitmq = {
|
|
|
|
enable = true;
|
|
|
|
managementPlugin.enable = true;
|
2022-09-23 13:39:06 +00:00
|
|
|
|
|
|
|
# To encrypt:
|
|
|
|
# rabbitmqctl --quiet encode --cipher blowfish_cfb64 --hash sha256 \
|
|
|
|
# --iterations 10000 '<<"dJT8isYu6t0Xb6u56rPglSj1vK51SlNVlXfwsRxw">>' \
|
|
|
|
# "hOjWzSEn2Z7cHzKOcf6i183O2NdjurSuoMDIIv01" ;
|
|
|
|
config = ''
|
|
|
|
[ { rabbit
|
|
|
|
, [ {default_user, <<"alice">>}
|
|
|
|
, { default_pass
|
|
|
|
, {encrypted,<<"oKKxyTze9PYmsEfl6FG1MxIUhxY7WPQL7HBoMPRC/1ZOdOZbtr9+DxjWW3e1D5SL48n3D9QOsGD0cOgYG7Qdvb7Txrepw8w=">>}
|
|
|
|
}
|
|
|
|
, {config_entry_decoder
|
|
|
|
, [ {passphrase, {file, <<"${configKeyPath}">>}}
|
|
|
|
, {cipher, blowfish_cfb64}
|
|
|
|
, {hash, sha256}
|
|
|
|
, {iterations, 10000}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
% , {rabbitmq_management, [{path_prefix, "/_queues"}]}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
].
|
|
|
|
'';
|
2021-08-30 08:11:49 +00:00
|
|
|
};
|
2021-08-02 13:23:07 +00:00
|
|
|
# Ensure there is sufficient extra disk space for rabbitmq to be happy
|
|
|
|
virtualisation.diskSize = 1024;
|
2014-03-10 10:10:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2019-11-25 09:35:19 +00:00
|
|
|
machine.start()
|
2014-04-14 12:02:44 +00:00
|
|
|
|
2019-11-25 09:35:19 +00:00
|
|
|
machine.wait_for_unit("rabbitmq.service")
|
|
|
|
machine.wait_until_succeeds(
|
2020-04-07 06:25:48 +00:00
|
|
|
'su -s ${pkgs.runtimeShell} rabbitmq -c "rabbitmqctl status"'
|
2019-11-25 09:35:19 +00:00
|
|
|
)
|
2022-06-11 12:22:53 +00:00
|
|
|
machine.wait_for_open_port(15672)
|
2022-09-23 13:39:06 +00:00
|
|
|
|
|
|
|
# The password is the plaintext that was encrypted with rabbitmqctl encode above.
|
|
|
|
machine.wait_until_succeeds(
|
|
|
|
'${pkgs.rabbitmq-java-client}/bin/PerfTest --time 10 --uri amqp://alice:dJT8isYu6t0Xb6u56rPglSj1vK51SlNVlXfwsRxw@localhost'
|
|
|
|
)
|
2014-03-10 10:10:32 +00:00
|
|
|
'';
|
2014-04-14 12:02:44 +00:00
|
|
|
})
|