Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the need for Docker for a default run [take 2] #386

Merged
merged 10 commits into from
Dec 31, 2018
Merged

Remove the need for Docker for a default run [take 2] #386

merged 10 commits into from
Dec 31, 2018

Conversation

gsmet
Copy link
Member

@gsmet gsmet commented Dec 23, 2018

Supersedes #381 .

Better reviewed commit per commit as I cleaned up a few things.

No docker by default

To start the Docker containers, you now need to use -Ddocker.

MariaDB and PostgreSQL testing disabled by default

MariaDB and PostgreSQL examples are built by default but not tested. You need to use -Dtest-postgresql and -Dtest-mariadb to enable testing (+ -Ddocker if you want to rely on the Docker containers).

The strict example is executed with H2 by default but can be executed with PostgreSQL using -Dtest-postgresql. That's what is done on CI.

Test resource management

I added a @ShamrockTestResource annotation to be able to declare test resources. The current example in the code is the simple version as I declared the annotations on the lifecycle manager but we could imagine having lifecycle managers in separate jars.

I now index the test classes using Jandex to discover these annotations. I think the overhead should be negligible compared to running the tests. Open to discussion if you have better ideas on how to solve this issue.

In passing, fix a few corner cases when testing failed deployment.
Note that this requires to index the test classes with Jandex.
For the strict example, it's still possible to test with PostgreSQL by
using -Dtest-postgresql (and -Ddocker if you want to start a Docker
container).
You need to use -Dtest-mariadb to enable testing and -Ddocker to run
the MariaDB server in a Docker container.
You need to use -Dtest-postgresql to enable testing and -Ddocker to run
the PostgreSQL server in a Docker container.
It's now the tests that are disabled by default.
@gsmet gsmet added this to the 0.3.0 milestone Dec 23, 2018
@gsmet gsmet modified the milestones: 0.3.0, 0.4.0 Dec 26, 2018
Copy link
Member

@rsvoboda rsvoboda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments to update contributing.md and to remove some System.out.println.

System.out.println translates to (sometimes unnecessary && hard to control) IO operations which can slower CI runs. Reduction of System.out.println in WildFly codebase helped to speed up and stabilise CI runs, it might not be such a pain in Azure environment.


Docker is not strictly necessary: it is used to run the MariaDB and PostgreSQL tests which are not enabled by default. However it is a recommended install if you plan to work on Shamrock JPA support:

* Check [the installation guide](https://docs.docker.com/install/), and [the MacOS installation guide](https://docs.docker.com/docker-for-mac/install/)
* If you just install docker, be sure that your current user can run a container (no root required).
On Linux, check [the post-installation guide](https://docs.docker.com/install/linux/linux-postinstall/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build section could mention some details from description of this PR:

MariaDB and PostgreSQL examples are built by default but not tested. You need to use -Dtest-postgresql
and -Dtest-mariadb to enable testing (+ -Ddocker if you want to rely on the Docker containers).

The strict example is executed with H2 by default but can be executed with PostgreSQL using -Dtest-postgresql.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I wasn't sure we should enter into this level of details here. @cescoffier WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if these instructions should not be added to the README of these modules. If we add all the details for all modules, it would quickly become out of track.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a README.md in each example explaining how to run the tests.

try {
tcpServer = Server.createTcpServer();
tcpServer.start();
System.out.println("[INFO] H2 database started in TCP server mode");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be System.out.println suppressed in this class ? Line 19 + 29

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, in the end, the idea would be to have the possibility to inject a logger here, e.g. when you are in a Maven build, you could get the Maven logger and log the info properly.

For now, we don't have anything better than this.

try {
tcpServer = Server.createTcpServer();
tcpServer.start();
System.out.println("[INFO] H2 database started in TCP server mode");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be System.out.println suppressed ? Line 19 + 29

try {
tcpServer = Server.createTcpServer();
tcpServer.start();
System.out.println("[INFO] H2 database started in TCP server mode");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be System.out.println suppressed in this class ? Line 19 + 29

@stuartwdouglas stuartwdouglas merged commit 3d35d97 into quarkusio:master Dec 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants