File: RUNNING_TESTS.md

package info (click to toggle)
rabbitmq-java-client 5.0.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,752 kB
  • sloc: java: 24,907; xml: 1,245; python: 697; makefile: 47; sh: 25
file content (165 lines) | stat: -rw-r--r-- 5,753 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
## Overview

There are multiple test suites in the RabbitMQ Java client library;
the source for all of the suites can be found in the [src/test/java](src/test/java)
directory.

The suites are:

  * Client tests
  * Server tests
  * SSL tests
  * Functional tests
  * HA tests

All of them assume a RabbitMQ node listening on localhost:5672
(the default settings). SSL tests require a broker listening on the default
SSL port. HA tests expect a second node listening on localhost:5673.

Connection recovery tests need `rabbitmqctl` to control the running nodes.
can control the running node.

`mvn verify` will start those nodes with the appropriate configuration.

To easily fullfil all those requirements, you can use `make deps` to
fetch the dependencies. You can also fetch them yourself and use the
same layout:

```
deps
|-- rabbitmq_codegen
`-- rabbit
```

You then run Maven with the `deps.dir` property set like this:
```
mvn -Ddeps.dir=/path/to/deps verify
```

For details on running specific tests, see below.


## Running a Specific Test Suite

To run a specific test suite you should execute one of the following in the
top-level directory of the source tree:

* To run the client unit tests:

 ```
mvn -Ddeps.dir=/path/to/deps verify -Dit.test=ClientTests
```

* To run the functional tests:

 ```
mvn -Ddeps.dir=/path/to/deps verify -Dit.test=FunctionalTests
```

* To run a single test:

 ```
mvn -Ddeps.dir=/path/to/deps verify -Dit.test=DeadLetterExchange
```

For example, to run the client tests:

```
rabbitmq-java-client$ mvn -Ddeps.dir=/path/to/deps verify -Dit.test=ClientTests
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO]   ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building RabbitMQ Java Client 3.7.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- groovy-maven-plugin:2.0:execute (generate-amqp-sources) @ amqp-client ---
[INFO]
[INFO] --- build-helper-maven-plugin:1.12:add-source (add-generated-sources-dir) @ amqp-client ---
[INFO] Source directory: .../rabbitmq_java_client/target/generated-sources/src/main/java added.
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ amqp-client ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ amqp-client ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- groovy-maven-plugin:2.0:execute (remove-old-test-keystores) @ amqp-client ---
[INFO]
[INFO] --- groovy-maven-plugin:2.0:execute (query-test-tls-certs-dir) @ amqp-client ---
[INFO]
[INFO] --- keytool-maven-plugin:1.5:importCertificate (generate-test-ca-keystore) @ amqp-client ---
[WARNING] Certificate was added to keystore
[INFO]
[INFO] --- keytool-maven-plugin:1.5:importCertificate (generate-test-empty-keystore) @ amqp-client ---
[WARNING] Certificate was added to keystore
[INFO]
[INFO] --- keytool-maven-plugin:1.5:deleteAlias (generate-test-empty-keystore) @ amqp-client ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ amqp-client ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ amqp-client ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ amqp-client ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ amqp-client ---
[INFO] Building jar: .../rabbitmq_java_client/target/amqp-client-3.7.0-SNAPSHOT.jar
[INFO]
[INFO] --- groovy-maven-plugin:2.0:execute (start-test-broker-A) @ amqp-client ---
[INFO]
[INFO] --- groovy-maven-plugin:2.0:execute (start-test-broker-B) @ amqp-client ---
[INFO]
[INFO] --- groovy-maven-plugin:2.0:execute (create-test-cluster) @ amqp-client ---
[INFO]
[INFO] --- maven-failsafe-plugin:2.19.1:integration-test (integration-test) @ amqp-client ---

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.rabbitmq.client.test.ClientTests
Tests run: 50, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.732 sec - in com.rabbitmq.client.test.ClientTests

Results :

Tests run: 50, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- groovy-maven-plugin:2.0:execute (stop-test-broker-B) @ amqp-client ---
[INFO]
[INFO] --- groovy-maven-plugin:2.0:execute (stop-test-broker-A) @ amqp-client ---
[INFO]
[INFO] --- maven-failsafe-plugin:2.19.1:verify (verify) @ amqp-client ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33.707s
[INFO] Finished at: Mon Aug 08 16:22:26 CEST 2016
[INFO] Final Memory: 21M/256M
[INFO] ------------------------------------------------------------------------
```

Test reports can be found in `target/failsafe-reports`.


## Running tests against an externally provided broker or cluster

By default, if the RabbitMQ broker sources are available, the testsuite
starts automatically a cluster of two RabbitMQ nodes and runs the tests
against it.

You can also provide your own broker or cluster. To disable the
automatic test cluster setup, disable the `setup-test-cluster` Maven
profile:

```
mvn verify -P '!setup-test-cluster'
```