nerdfonts: fix wrong attribute name in error message (#364463)
[NixPkgs.git] / pkgs / servers / elasticmq-server-bin / elasticmq-test.nix
blobbd7f43c86893e01e345010c15d900799eefc9e58
2   elasticmq-server,
3   python3Packages,
4   runCommand,
5   writeText,
6 }:
8 runCommand "${elasticmq-server.name}-tests"
9   (
10     let
11       commonPy = ''
12         import boto3
13         client = boto3.resource(
14           "sqs",
15           endpoint_url="http://localhost:9324",
16           region_name="elasticmq",
17           aws_secret_access_key="x",
18           aws_access_key_id="x",
19           use_ssl=False,
20         )
21         queue = client.get_queue_by_name(QueueName="foobar")
22       '';
23     in
24     {
25       buildInputs = with python3Packages; [
26         python
27         boto3
28       ];
29       emqConfig = writeText "emq-test.conf" ''
30         generate-node-address = true
32         queues {
33           foobar {}
34         }
35       '';
36       putMessagePy = writeText "put_message.py" ''
37         ${commonPy}
38         queue.send_message(MessageBody="bazqux")
39       '';
40       checkMessagePy = writeText "check_message.py" ''
41         ${commonPy}
42         messages = queue.receive_messages()
43         print(f"Received {messages!r}")
44         assert len(messages) == 1
45         assert messages[0].body == "bazqux"
46       '';
47     }
48   )
49   ''
50     JAVA_TOOL_OPTIONS="-Dconfig.file=$emqConfig" ${elasticmq-server}/bin/elasticmq-server &
51     SERVER_PID=$!
52     sleep 10
54     python $putMessagePy
55     python $checkMessagePy
56     touch $out
58     # needed on darwin
59     kill $SERVER_PID
60   ''