yuzutech / kroki

Creates diagrams from textual descriptions!
https://kroki.io
MIT License
2.92k stars 218 forks source link

Build fails due to `should_return_an_unicode_text_diagram` test failure using Ubuntu 21.10 #1063

Open MarcelWaldvogel opened 2 years ago

MarcelWaldvogel commented 2 years ago

I am trying to generate the docker image to test a few improvements I'm working on. However, the tests fail to find the Bouncy Castle stuff and (apparently) therefore the JARs are not built, either.

[INFO] Running io.kroki.server.ServerSSLTest
...
22:43:42.086 [main] DEBUG i.n.h.ssl.util.SelfSignedCertificate - Failed to generate a self-signed X.509 certificate using Bouncy Castle:
java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
    at io.netty.handler.ssl.util.SelfSignedCertificate.<init>(SelfSignedCertificate.java:240)
    at io.netty.handler.ssl.util.SelfSignedCertificate.<init>(SelfSignedCertificate.java:166)
    at io.netty.handler.ssl.util.SelfSignedCertificate.<init>(SelfSignedCertificate.java:115)

Neither make installLocalDependencies nor apt install ibbcpkix-java libbcmail-java (the two non-doc Bouncy packages that were not yet installed on Ubuntu 21.10) helps.

What are the additional steps to perform?

PS: Trying to build the server independently does not work as it will then not find the umlet package.

ggrossetie commented 2 years ago

You can take a look at the steps executed by GitHub Actions: https://github.com/yuzutech/kroki/runs/4752957437?check_suite_focus=true

Which version of java are you using?

I confirm that you need to build from the root directory otherwise local dependencies (umlet) won't be installed and, as a result, won't be resolved (missing from Maven reactor).

ggrossetie commented 2 years ago

I can see the same stack trace in GitHub Actions but the test seems to be running fine and the log level (debug) might indicate that this isn't actually an error. I guess SelfSignedCertificate.java will fallback on another provider. I need to take a closer look at the implementation of SelfSignedCertificate.java.

And we might need to tune the logger when running tests to make it quiet.

ggrossetie commented 2 years ago

Take a look at: https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/util/SelfSignedCertificate.java#L238-L255

MarcelWaldvogel commented 2 years ago

Yes, removing those many long stack traces from the terminal output would definitely help keeping track of the actual problem.

So then the reason it won't build is probably further down:

[ERROR] Tests run: 50, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.785 s <<< FAILURE! - in io.kroki.server.service.PlantumlServiceTest
[ERROR] should_return_an_unicode_text_diagram  Time elapsed: 0.023 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: 

expected: 
  "     ?????          ???????
       ?Bob?          ?Alice?
       ?????          ???????
         ?    hello      ?   
         ???????????????>?   
       ?????          ???????
       ?Bob?          ?Alice?
       ?????          ???????
  "
 but was: 
  "     ???????????????          ?????????????????????
       ???Bob???          ???Alice???
       ???????????????          ?????????????????????
         ???    hello      ???   
         ?????????????????????????????????????????????>???   
       ???????????????          ?????????????????????
       ???Bob???          ???Alice???
       ???????????????          ?????????????????????
  "
    at io.kroki.server.service.PlantumlServiceTest.should_return_an_unicode_text_diagram(PlantumlServiceTest.java:336)

[INFO] Running io.kroki.server.service.C4PlantumlServiceTest

(Yes, the question marks are actual question marks in the terminal output)

OR

[INFO] Running io.kroki.server.action.CommanderTest
[ERROR] Tests run: 16, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.165 s <<< FAILURE! - in io.kroki.server.action.CommanderTest
[ERROR] should_convert_large_diagram  Time elapsed: 0.035 s  <<< ERROR!
java.io.IOException: Broken pipe
    at io.kroki.server.action.CommanderTest.should_convert_large_diagram(CommanderTest.java:95)

Anyway, at the end of LANG=C make buildServer, the following is printed:

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   PlantumlServiceTest.should_return_an_unicode_text_diagram:336 
expected: 
  "     ?????          ???????
       ?Bob?          ?Alice?
       ?????          ???????
         ?    hello      ?   
         ???????????????>?   
       ?????          ???????
       ?Bob?          ?Alice?
       ?????          ???????
  "
 but was: 
  "     ???????????????          ?????????????????????
       ???Bob???          ???Alice???
       ???????????????          ?????????????????????
         ???    hello      ???   
         ?????????????????????????????????????????????>???   
       ???????????????          ?????????????????????
       ???Bob???          ???Alice???
       ???????????????          ?????????????????????
  "
[ERROR] Errors: 
[ERROR]   CommanderTest.should_convert_large_diagram:95 ? IO Broken pipe
[INFO] 
[ERROR] Tests run: 150, Failures: 1, Errors: 1, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for kroki 0.16.0:
[INFO] 
[INFO] kroki .............................................. SUCCESS [  0.125 s]
[INFO] umlet .............................................. SUCCESS [  1.205 s]
[INFO] kroki-server ....................................... FAILURE [ 12.267 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.701 s
[INFO] Finished at: 2022-01-15T14:14:39+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project kroki-server: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/marcel/Repos/kroki/server/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :kroki-server
make: *** [Makefile:17: buildServer] Error 1

This happens with the current tip of the main branch on Ubuntu 21.10 with openjdk 11.0.13. If I might guess (without looking closer at the code), it could be a UTF-8 (double?) encoding problem.

MarcelWaldvogel commented 2 years ago

Commented out the @Test in front of should_convert_large_diagram() and should_return_an_unicode_text_diagram() as a temporary workaround. Now the jars lie in server/target, so I can continue building.

ggrossetie commented 2 years ago

This happens with the current tip of the main branch on Ubuntu 21.10 with openjdk 11.0.13. If I might guess (without looking closer at the code), it could be a UTF-8 (double?) encoding problem.

Not sure, it's running fine on Ubuntu 18.04.6 LTS (GitHub Actions) and also running fine on my machine Ubuntu 20.04.3 LTS. I'm using:

$ mvn -v
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /home/guillaume/tool/maven3
Java version: 11.0.6, vendor: Oracle Corporation, runtime: /home/guillaume/tool/jdk-11.0.6
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-94-generic", arch: "amd64", family: "unix"
$ java --version
java 11.0.6 2020-01-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode
$ env | grep UTF
LANG=fr_FR.UTF-8
LC_ALL=fr_FR.UTF-8
MarcelWaldvogel commented 2 years ago

Indeed, compiling on 20.04 (with OpenJDK, apt install maven openjdk-11-jdk-headless) works like a charm.

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=21.10
DISTRIB_CODENAME=impish
DISTRIB_DESCRIPTION="Ubuntu 21.10"
$ mvn --version
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.13, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "5.13.0-25-generic", arch: "amd64", family: "unix"
$ java --version
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.21.10)
OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.21.10, mixed mode, sharing)
$ env | grep UTF
LC_ADDRESS=de_CH.UTF-8
LC_NAME=de_CH.UTF-8
LC_MONETARY=de_CH.UTF-8
LC_PAPER=de_CH.UTF-8
LANG=de_DE.UTF-8
LC_IDENTIFICATION=de_CH.UTF-8
LC_TELEPHONE=de_CH.UTF-8
LC_MEASUREMENT=de_CH.UTF-8
LC_TIME=de_CH.UTF-8
LC_NUMERIC=de_CH.UTF-8

Seems to be an OS/library regression issue, then.

BTW: What do you use as language identifier for you shell code blocks?

ggrossetie commented 2 years ago

BTW: What do you use as language identifier for you shell code blocks?

I'm using console.

Seems to be an OS/library regression issue, then.

I guess we will find out when Ubuntu 22.04 LTS comes out (and is available on GitHub Actions: https://github.com/actions/virtual-environments).