-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
JHipster mvnw verify fails due to an infinite loop (due to circular relationships) in the test generated entity code. #19801
Comments
This issue is stale because it has been open for too long without any activity. |
Yes, this issue still applies and is still a problem |
@naris please add a |
@mshima I have added the resilts of jhipster info to the description. |
JHipster has completed the sample check This check uses |
@mshima , We use the generator-jhipster-primeng-blueprint blueprint, which the automated sample check complains about (Indeed I always have to use --skip-checks). However, that blueprint does not affect the backend tests this issue is about. |
I have removed the blueprint from the jhipster info in the issue description |
Blueprints should be disabled at checks. |
If a circular dependency with all required relationship is found. Every entity cannot be tested without bootstrapping the database. At cypress if entity A has a required relationship with entity B and entity b has a required relationship with entity C the entity A test is skipped. I don’t recall much about junit behavior with relationships. |
An example. There are 2 entities in the JDL above, UPC & Platform that have a OneToMany relationship ( UPC{platforms required} to Platform{upc required}). The generated test code for UPC has a method called createEntity that calls Platform.createEntity() that calls UPC.createEntity() which then goes into an infinite loop with only 2 tables with a ManyToOne relationship Here is an example of the generated test code in which I have had to comment out all the tests that produce infinite loops (even though there aren't any circular references -- I don't actually have any circular references) |
I’ve switched to PostgreSQL due to missing testcontainer support with oracle. |
I can't use containers as my company won't license docker for my team. Also, my project has some native sql queries that require oracle specific functions (listagg() & dbms_lob.substr()) which would make using another DB for testing problematic. However, yeah -- those are my problems and the issue is really generic and not specific to my use case so you should indeed use another DB and/or the oracle testcontainer |
CI confirmed the bug with the provided sample. |
Overview of the issue
I have a project with entities with relationships that refer to each other. There is an UPC Entity with a ManyToOne relationship with a Platform entity with a ManytoOne relationship to a Category entity.
The generated test code has a CategoryResourceIT class with this getAllCategoriesByPlatformIsEqualToSomething() method:
which has a call to platform = PlatformResourceIT.createEntity(em) which is here:
Which calls UPCResourceIT.createEntity(em) which had already been called and starts a infinite loop or circular references that continues until there is a stack overflow :(
Motivation for or Use Case
Running ./mvnw verify on a newly generated project, with no changes whosoever, should not ever fail.
Reproduce the error
Generate a jhipster project. Generate entities with the JDL shown below. run ./mvnw verify
Related issues
#19800
Suggest a Fix
I am still researching this issue, I have do not have a fix at this time.
JHipster Version(s)
7.8.1, but this applies to all versions of jhipster.
JHipster configuration
JDL definitions
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions
Environment and Tools
openjdk version "17.0.6" 2023-01-17 LTS
OpenJDK Runtime Environment Microsoft-7209853 (build 17.0.6+10-LTS)
OpenJDK 64-Bit Server VM Microsoft-7209853 (build 17.0.6+10-LTS, mixed mode, sharing)
git version 2.40.1.windows.1
node: v16.8.0
npm: 7.21.0
Browsers and Operating System
Windows, Edge
The text was updated successfully, but these errors were encountered: