Closed mraible closed 2 years ago
Hi @mraible, @vishal423 can you please assign this issue to me? I'd like to fix this issue on my weekend. Thanks
I tried this again today with the above .yo-rc.json
and the main
branch. There are a bunch of test failures:
Summary of all failing tests
FAIL src/main/webapp/app/core/auth/account.service.spec.ts (384 MB heap size)
● Account Service › save › should call account saving endpoint with correct values
Expected one matching request for criteria "Match method: POST, URL: api/account", found none.
67 | // WHEN
68 | service.save(account).subscribe();
> 69 | const testRequest = httpMock.expectOne({ method: 'POST', url: applicationConfigService.getEndpointFor('api/account') });
| ^
70 | testRequest.flush({});
71 |
72 | // THEN
at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
at src/main/webapp/app/core/auth/account.service.spec.ts:69:36
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)
FAIL src/main/webapp/app/core/auth/auth-jwt.service.spec.ts (545 MB heap size)
● Auth JWT › Login › should clear session storage and save in local storage when rememberMe is true
Expected one matching request for criteria "Match URL: api/authenticate", found none.
48 | // WHEN
49 | service.login({ username: 'John', password: '123', rememberMe: true }).subscribe();
> 50 | httpMock.expectOne('api/authenticate').flush({ id_token: '1' });
| ^
51 |
52 | // THEN
53 | httpMock.verify();
at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
at src/main/webapp/app/core/auth/auth-jwt.service.spec.ts:50:16
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)
● Auth JWT › Login › should clear local storage and save in session storage when rememberMe is false
Expected one matching request for criteria "Match URL: api/authenticate", found none.
63 | // WHEN
64 | service.login({ username: 'John', password: '123', rememberMe: false }).subscribe();
> 65 | httpMock.expectOne('api/authenticate').flush({ id_token: '1' });
| ^
66 |
67 | // THEN
68 | httpMock.verify();
at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
at src/main/webapp/app/core/auth/auth-jwt.service.spec.ts:65:16
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)
FAIL src/main/webapp/app/account/register/register.service.spec.ts (839 MB heap size)
● RegisterService Service › Service methods › should call register endpoint with correct values
Expected one matching request for criteria "Match method: POST, URL: api/register", found none.
37 | service.save(registration).subscribe();
38 |
> 39 | const testRequest = httpMock.expectOne({
| ^
40 | method: 'POST',
41 | url: applicationConfigService.getEndpointFor('api/register'),
42 | });
at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
at src/main/webapp/app/account/register/register.service.spec.ts:39:36
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)
FAIL src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.spec.ts (871 MB heap size)
● PasswordResetFinish Service › Service methods › should call reset-password/finish endpoint with correct values
Expected one matching request for criteria "Match method: POST, URL: api/account/reset-password/finish", found none.
33 | service.save(key, newPassword).subscribe();
34 |
> 35 | const testRequest = httpMock.expectOne({
| ^
36 | method: 'POST',
37 | url: applicationConfigService.getEndpointFor('api/account/reset-password/finish'),
38 | });
at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
at src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.spec.ts:35:36
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)
FAIL src/main/webapp/app/account/password/password.service.spec.ts (757 MB heap size)
● Password Service › Service methods › should call change-password endpoint with correct values
Expected one matching request for criteria "Match method: POST, URL: api/account/change-password", found none.
33 | service.save(password2, password1).subscribe();
34 |
> 35 | const testRequest = httpMock.expectOne({
| ^
36 | method: 'POST',
37 | url: applicationConfigService.getEndpointFor('api/account/change-password'),
38 | });
at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
at src/main/webapp/app/account/password/password.service.spec.ts:35:36
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)
FAIL src/main/webapp/app/account/password-reset/init/password-reset-init.service.spec.ts (803 MB heap size)
● PasswordResetInit Service › Service methods › should call reset-password/init endpoint with correct values
Expected one matching request for criteria "Match method: POST, URL: api/account/reset-password/init", found none.
32 | service.save(mail).subscribe();
33 |
> 34 | const testRequest = httpMock.expectOne({
| ^
35 | method: 'POST',
36 | url: applicationConfigService.getEndpointFor('api/account/reset-password/init'),
37 | });
at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
at src/main/webapp/app/account/password-reset/init/password-reset-init.service.spec.ts:34:36
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)
FAIL src/main/webapp/app/admin/logs/logs.service.spec.ts (777 MB heap size)
● Logs Service › Service methods › should change log level
Expected one matching request for criteria "Match method: POST, URL: (any)", found none.
25 | service.changeLevel('main', 'ERROR').subscribe();
26 |
> 27 | const req = httpMock.expectOne({ method: 'POST' });
| ^
28 | expect(req.request.body).toEqual({ configuredLevel: 'ERROR' });
29 | });
30 | });
at HttpClientTestingBackend.expectOne (node_modules/@angular/common/fesm2020/http/testing.mjs:288:19)
at src/main/webapp/app/admin/logs/logs.service.spec.ts:27:28
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4331:34)
Test Suites: 7 failed, 43 passed, 50 total
Tests: 8 failed, 198 passed, 206 total
Snapshots: 0 total
Time: 13.508 s
Ran all test suites.
> Task :webapp_test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':webapp_test'.
> Process 'command '/Users/mraible/Downloads/21p/.gradle/npm/npm-v8.18.0/bin/npm'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 44s
The test failures seem to happen because of the jwtSecretKey
. I deleted it from .yo-rc.json
and regenerated the application. Then, I ran:
./gradlew -Pprod test sonarqube
The tests still fail:
Test Suites: 7 failed, 43 passed, 50 total
Tests: 8 failed, 198 passed, 206 total
Snapshots: 0 total
Time: 13.053 s
Ran all test suites.
> Task :webapp_test FAILED
@mraible main is having this problem too. Probably caused by https://github.com/jhipster/generator-jhipster/issues/19504
@UbaidurRehman1 have you managed to identify the problem? Can I take a look to clear 7.9.3 milestone?
Hi @mshima I am not able to identify the problem yet, if its urgent then please go ahead.
Thanks
Re-assigned to @mshima.
@DanielFran bug bounty claimed https://opencollective.com/generator-jhipster/expenses/172338
@mshima approved
Overview of the issue
I created a new application with the
main
branch today and when I try to test its code quality with Sonar, I get an error.Command used (from the application's
README
):Error:
Sending the data to Sonar seems to have worked, but this error at the end is frightening.
Motivation for or Use Case
It'd be sweet if all the commands I show in the JHipster Mini-Book function without error.
Reproduce the error
Create a new app with the
.yo-rc.json
below. Start all the Docker containers theprod
profile needs, plus Sonar.Then, run all of the tests and the
sonarqube
task:JHipster Version(s)
main
branchJHipster 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 "11.0.2" 2019-01-15 OpenJDK Runtime Environment 18.9 (build 11.0.2+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
git version 2.32.1 (Apple Git-133)
node: v16.16.0
npm: 8.11.0
Docker version 20.10.17, build 100c701
docker-compose version 1.29.2, build 5becea4c
Browsers and Operating System