jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.5k stars 4.02k forks source link

Integration test [KafkaResourceIT] always failing in a newly created gateway app #19957

Closed artyomsv closed 9 months ago

artyomsv commented 2 years ago
Overview of the issue

I have created to applications using hipster: microservice and gateway. In the microservice all the tests are successfully executed, but in the gateway KafkaResourceIT.producesMessages always failing with an error

2022-10-08 12:42:12.023 ERROR 38820 --- [           main] o.s.t.w.reactive.server.ExchangeResult   : Request details for assertion failure:

> POST /api/gateway-kafka/publish?message=value-produce
> WebTestClient-Request-Id: [1]

No content

< 403 FORBIDDEN Forbidden
< Content-Type: [text/plain]
< Cache-Control: [no-cache, no-store, max-age=0, must-revalidate]
< Pragma: [no-cache]
< Expires: [0]
< X-Content-Type-Options: [nosniff]
< X-Frame-Options: [DENY]
< X-XSS-Protection: [1 ; mode=block]
< Permissions-Policy: [camera=(), fullscreen=(self), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), sync-xhr=()]
< Content-Security-Policy: [default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:]
< Referrer-Policy: [strict-origin-when-cross-origin]

An expected CSRF token cannot be found

java.lang.AssertionError: Status expected:<204 NO_CONTENT> but was:<403 FORBIDDEN>
Expected :204 NO_CONTENT
Actual   :403 FORBIDDEN

I have tried both IDE test execution and using Maven in PowerShell

Motivation for or Use Case

Newly created service should not fail on any tests execution

Reproduce the error

create gateway app with my config and run the tests

Related issues
Suggest a Fix
JHipster Version(s)

JHipster 7.9.3

JHipster configuration
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "gateway",
    "authenticationType": "oauth2",
    "baseName": "gateway",
    "blueprints": [],
    "buildTool": "maven",
    "cacheProvider": "no",
    "clientFramework": "react",
    "clientPackageManager": "npm",
    "clientTheme": "darkly",
    "clientThemeVariant": "dark",
    "creationTimestamp": 1665187227268,
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "devServerPort": 9060,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": false,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "entitySuffix": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.9.3",
    "jwtSecretKey": "***",
    "languages": ["en", "de"],
    "messageBroker": "kafka",
    "microfrontend": true,
    "microfrontends": [
      {
        "baseName": "app1"
      },
      {
        "baseName": "app2"
      }
    ],
    "monorepository": true,
    "nativeLanguage": "en",
    "otherModules": [],
    "packageName": "com.company.gateway",
    "pages": [],
    "prodDatabaseType": "postgresql",
    "reactive": true,
    "searchEngine": false,
    "serverPort": "8080",
    "serverSideOptions": ["messageBroker:kafka"],
    "serviceDiscoveryType": "eureka",
    "skipCheckLengthOfIdentifier": false,
    "skipClient": false,
    "skipCommitHook": true,
    "skipFakeData": false,
    "skipUserManagement": true,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": true
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Environment and Tools

openjdk version "13" 2019-09-17 OpenJDK Runtime Environment (build 13+33) OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)

git version 2.36.1.windows.1

node: v16.16.0

npm: 8.16.0

Docker version 20.10.17, build 100c701

Docker Compose version v2.10.2

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

WIndows 10 PRO with Linux

github-actions[bot] commented 9 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days