From bb88600df886565fc67357c2e3d423ee50c7aa22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 25 Apr 2018 11:38:26 +0200 Subject: [PATCH 1/2] Update documentation to run tests [#157080754] Fixes #359 --- Makefile | 6 +++- RUNNING_TESTS.md | 81 ++++++++++++++++++++++++++++-------------------- 2 files changed, 52 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index 8bb2365baf..010b2342a0 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ MVN_FLAGS += -Ddeps.dir="$(abspath $(DEPS_DIR))" all: deps $(MVN) $(MVN_FLAGS) compile -deps: $(DEPS_DIR)/rabbit +deps: $(DEPS_DIR)/rabbit $(DEPS_DIR)/rabbitmq-ct-helpers @: dist: clean @@ -26,6 +26,10 @@ $(DEPS_DIR)/rabbit: git clone https://github.com/rabbitmq/rabbitmq-server.git $@ $(MAKE) -C $@ fetch-deps DEPS_DIR="$(abspath $(DEPS_DIR))" +$(DEPS_DIR)/rabbitmq-ct-helpers: + rm -rf $(DEPS_DIR)/rabbitmq_ct_helpers + git clone https://github.com/rabbitmq/rabbitmq-ct-helpers.git $(DEPS_DIR)/rabbitmq_ct_helpers + tests: deps $(MVN) $(MVN_FLAGS) verify diff --git a/RUNNING_TESTS.md b/RUNNING_TESTS.md index 157b2e1ff9..2619d9699f 100644 --- a/RUNNING_TESTS.md +++ b/RUNNING_TESTS.md @@ -19,21 +19,21 @@ 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. +`./mvnw 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: +To easily fullfil all those requirements, you should use `make deps` to +fetch the dependencies in the `deps` directory. +You then run Maven with the `deps.dir` property set like this: ``` -deps -|-- rabbitmq_codegen -`-- rabbit +./mvnw -Ddeps.dir=$(pwd)/deps verify ``` -You then run Maven with the `deps.dir` property set like this: +The previous command launches tests against the blocking IO connector. If you want +to run the tests against the NIO connector, add `-P use-nio` to the command line: + ``` -mvn -Ddeps.dir=/path/to/deps verify +./mvnw -Ddeps.dir=$(pwd)/deps verify -P use-nio ``` For details on running specific tests, see below. @@ -47,47 +47,45 @@ top-level directory of the source tree: * To run the client unit tests: ``` -mvn -Ddeps.dir=/path/to/deps verify -Dit.test=ClientTests +./mvnw -Ddeps.dir=$(pwd)/deps verify -Dit.test=ClientTests ``` * To run the functional tests: ``` -mvn -Ddeps.dir=/path/to/deps verify -Dit.test=FunctionalTests +./mvnw -Ddeps.dir=$(pwd)/deps verify -Dit.test=FunctionalTests ``` * To run a single test: - ``` -mvn -Ddeps.dir=/path/to/deps verify -Dit.test=DeadLetterExchange +``` +./mvnw -Ddeps.dir=$(pwd)/deps/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 +rabbitmq-java-client$ ./mvnw -Ddeps.dir=$(pwd)/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] Building RabbitMQ Java Client 5.3.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] 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] --- maven-resources-plugin:3.0.2:resources (default-resources) @ amqp-client --- [INFO] Using 'UTF-8' encoding to copy filtered resources. -[INFO] Copying 1 resource +[INFO] Copying 2 resources [INFO] -[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ amqp-client --- +[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ amqp-client --- [INFO] Nothing to compile - all classes are up to date [INFO] +[INFO] --- maven-bundle-plugin:3.2.0:manifest (bundle-manifest) @ amqp-client --- +[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 --- @@ -100,19 +98,31 @@ rabbitmq-java-client$ mvn -Ddeps.dir=/path/to/deps verify -Dit.test=ClientTests [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] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ amqp-client --- [INFO] Using 'UTF-8' encoding to copy filtered resources. -[INFO] Copying 3 resources +[INFO] Copying 5 resources [INFO] -[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ amqp-client --- +[INFO] --- maven-compiler-plugin:3.6.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] Building jar: .../rabbitmq-java-client/target/amqp-client-5.3.0-SNAPSHOT.jar +[INFO] +[INFO] >>> maven-source-plugin:3.0.1:jar (default) > generate-sources @ amqp-client >>> +[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-source-plugin:3.0.1:jar (default) < generate-sources @ amqp-client <<< +[INFO] +[INFO] +[INFO] --- maven-source-plugin:3.0.1:jar (default) @ amqp-client --- +[INFO] Building jar: .../rabbitmq-java-client/target/amqp-client-5.3.0-SNAPSHOT-sources.jar [INFO] [INFO] --- groovy-maven-plugin:2.0:execute (start-test-broker-A) @ amqp-client --- [INFO] @@ -123,14 +133,14 @@ rabbitmq-java-client$ mvn -Ddeps.dir=/path/to/deps verify -Dit.test=ClientTests [INFO] --- maven-failsafe-plugin:2.19.1:integration-test (integration-test) @ amqp-client --- ------------------------------------------------------- - T E S T S +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 +Tests run: 121, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 58.869 sec - in com.rabbitmq.client.test.ClientTests Results : -Tests run: 50, Failures: 0, Errors: 0, Skipped: 0 +Tests run: 121, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- groovy-maven-plugin:2.0:execute (stop-test-broker-B) @ amqp-client --- @@ -141,9 +151,9 @@ Tests run: 50, Failures: 0, Errors: 0, Skipped: 0 [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] Total time: 01:31 min +[INFO] Finished at: 2018-04-25T11:33:54+02:00 +[INFO] Final Memory: 26M/336M [INFO] ------------------------------------------------------------------------ ``` @@ -163,3 +173,6 @@ profile: ``` mvn verify -P '!setup-test-cluster' ``` + +Note that by doing so some tests will fail as they require `rabbitmqctl` to +control the running nodes. \ No newline at end of file From 6d7253af8ff72841153ba1ea610294dc614ce84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Wed, 25 Apr 2018 16:00:37 +0200 Subject: [PATCH 2/2] Don't repeat rabbitmq-ct-helpers task in Makefile [#157080754] Fixes #359 --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 010b2342a0..f38700bf84 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ MVN_FLAGS += -Ddeps.dir="$(abspath $(DEPS_DIR))" all: deps $(MVN) $(MVN_FLAGS) compile -deps: $(DEPS_DIR)/rabbit $(DEPS_DIR)/rabbitmq-ct-helpers +deps: $(DEPS_DIR)/rabbit $(DEPS_DIR)/rabbitmq_ct_helpers @: dist: clean @@ -26,8 +26,7 @@ $(DEPS_DIR)/rabbit: git clone https://github.com/rabbitmq/rabbitmq-server.git $@ $(MAKE) -C $@ fetch-deps DEPS_DIR="$(abspath $(DEPS_DIR))" -$(DEPS_DIR)/rabbitmq-ct-helpers: - rm -rf $(DEPS_DIR)/rabbitmq_ct_helpers +$(DEPS_DIR)/rabbitmq_ct_helpers: git clone https://github.com/rabbitmq/rabbitmq-ct-helpers.git $(DEPS_DIR)/rabbitmq_ct_helpers tests: deps