kitodo / kitodo-production

Kitodo.Production is a workflow management tool for mass digitization and is part of the Kitodo Digital Library Suite.
http://www.kitodo.org/software/kitodoproduction/
GNU General Public License v3.0
63 stars 63 forks source link

"mvn clean package" fails on freshly checked out project #723

Closed Ishiido closed 6 years ago

Ishiido commented 7 years ago

there are tests that fail as they probably require preconditions

Results :

Failed tests:   shouldAddType(org.kitodo.data.elasticsearch.index.IndexRestClientTest): Add of type has failed - document id 1!

Tests in error: 
  org.kitodo.data.elasticsearch.search.SearchRestClientTest: Connection refused
  org.kitodo.data.elasticsearch.search.SearcherTest: Connection refused
  shouldAddDocument(org.kitodo.data.elasticsearch.index.IndexRestClientTest): Connection refused
  shouldDeleteType(org.kitodo.data.elasticsearch.index.IndexRestClientTest): Connection refused
  shouldDeleteDocument(org.kitodo.data.elasticsearch.index.IndexRestClientTest): Connection refused

Tests run: 28, Failures: 1, Errors: 5, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Kitodo Production .................................. SUCCESS [  3.746 s]
[INFO] OpacPica-Plugin .................................... SUCCESS [  7.035 s]
[INFO] Kitodo - Data Management ........................... FAILURE [  9.814 s]
[INFO] Kitodo - API ....................................... SKIPPED
[INFO] Kitodo - Core ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
beatrycze-volk commented 7 years ago

It is necessary to have running ElasticSearch server to build the project.

Ishiido commented 7 years ago

Ah - I see. Then https://github.com/kitodo/kitodo-production/blob/master/README.md gives incorrect instructions on how to run a build process. Should the relevant tests be ignored by annotation?

I have no idea on setting up ElasticSearch.

henning-gerhardt commented 7 years ago

README in master branch got new instructions for ElasticSearch (version, installation, ...). I hope this helps you.

stweil commented 7 years ago

I got the same build error.

Is it possible to skip tests which cannot work because of missing preconditions (for example no ElasticSearch server) and report that only without a build failure? I appreciate that tests are run by default, but it would also be good to allow simple builds with incomplete tests.

henning-gerhardt commented 7 years ago

So far as I know is there no way to skip the test execution if a necessary dependency is not available.

Ishiido commented 7 years ago

Just annotate the RELEVANT Tests with "ignore" to suppress test execution for this test. If you don't do that all users who consider elasticsearch-install as a burden will suppress execution of ALL tests by -Dmaven.test.skip=true (which is worse...).

beatrycze-volk commented 7 years ago

Basically those users will not be able to use Kitodo. Every insert of new object to database triggers also insert to index. Very soon also every search will be performed on index. Without ElasticSearch will be only possible to log in.

stweil commented 7 years ago

@Beacze, building and using Kitodo does not necessarily happen on the same machine. I use quite a lot of machines where I run builds for different projects, but only two machines where I run Kitodo. Not every code change requires a full test, sometimes it is sufficient to test whether Java compiles.

henning-gerhardt commented 7 years ago

@stweil : If you really want to skip all tests on build time, then you should add -Dmaven.test.skip=true to your Maven command as mentioned by @Ishiido .

Ishiido commented 7 years ago

That's the point: you don't want to skip all the test just because you KNOW that 2 tests cannot be performed. Maybe we have a different idea about distributing the software. As @stweil quoted it is one thing to build the software and completely another thing to run it. I guess you and the Kitodo group do not think that the way of distribution could be / should be GitHub (and forcing all users to checkout and build). I guess you plan to supply a WAR file of a specific version at a specific point. It is clear that you need elasticsearch to run Kitodo.Production productively but maybe it is not necessary to have it installed (and running) on each developer's machine. In my everyday business here I unfortunately had to "ignore" some tests I would like to run every time I build but the environment constantly changes here and not all cases can be mocked ...

beatrycze-volk commented 7 years ago

PR #873 solves this problem completely.

henning-gerhardt commented 7 years ago

@Ishiido and @stweil : is this issue fixed for you as PR #873 is merged?

stweil commented 7 years ago

Yes, I think it is fixed (thank you @Beacze), although I have not tested the latest version up to now.

Kathrin-Huber commented 6 years ago

@henning-gerhardt This Issue should be closed :)

henning-gerhardt commented 6 years ago

Closing as no reaction was given and issue should be fixed.