Skip to content
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

Spring Boot application is not covered by tests #140

Closed
munterfi opened this issue Oct 15, 2024 · 0 comments · Fixed by #141
Closed

Spring Boot application is not covered by tests #140

munterfi opened this issue Oct 15, 2024 · 0 comments · Fixed by #141
Assignees

Comments

@munterfi
Copy link
Member

munterfi commented Oct 15, 2024

When Dependabot proposes updates for dependencies, the current build passes successfully even if the Spring Boot application fails to start.

So we should add a Spring Boot Test, which also starts the application.

Example: Dependabot PR #139 passes, but while running the application locally or during CI/CD, the Spring Boot application crashes with the following error:

C:\Users\u228298\.jdks\openjdk-21.0.2\bin\java.exe -XX:TieredStopAtLevel=1 -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" "-javaagent:C:\devsbb\tools\JetBrains\IntelliJ IDEA 2023.1.2\lib\idea_rt.jar=53916:C:\devsbb\tools\JetBrains\IntelliJ IDEA 2023.1.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath C:\devsbb\code\naviqore\public-transit-service\target\classes;C:\devsbb\eaio\m2\org\projectlombok\lombok\1.18.34\lombok-1.18.34.jar;C:\devsbb\eaio\m2\org\jetbrains\annotations\26.0.1\annotations-26.0.1.jar;C:\devsbb\eaio\m2\ch\qos\logback\logback-classic\1.5.11\logback-classic-1.5.11.jar;C:\devsbb\eaio\m2\ch\qos\logback\logback-core\1.5.8\logback-core-1.5.8.jar;C:\devsbb\eaio\m2\org\slf4j\slf4j-api\2.0.16\slf4j-api-2.0.16.jar;C:\devsbb\eaio\m2\org\apache\commons\commons-compress\1.27.1\commons-compress-1.27.1.jar;C:\devsbb\eaio\m2\commons-codec\commons-codec\1.16.1\commons-codec-1.16.1.jar;C:\devsbb\eaio\m2\commons-io\commons-io\2.16.1\commons-io-2.16.1.jar;C:\devsbb\eaio\m2\org\apache\commons\commons-lang3\3.14.0\commons-lang3-3.14.0.jar;C:\devsbb\eaio\m2\org\apache\commons\commons-csv\1.11.0\commons-csv-1.11.0.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot-starter-web\3.3.4\spring-boot-starter-web-3.3.4.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot-starter\3.3.4\spring-boot-starter-3.3.4.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot\3.3.4\spring-boot-3.3.4.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot-autoconfigure\3.3.4\spring-boot-autoconfigure-3.3.4.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot-starter-logging\3.3.4\spring-boot-starter-logging-3.3.4.jar;C:\devsbb\eaio\m2\org\apache\logging\log4j\log4j-to-slf4j\2.23.1\log4j-to-slf4j-2.23.1.jar;C:\devsbb\eaio\m2\org\apache\logging\log4j\log4j-api\2.23.1\log4j-api-2.23.1.jar;C:\devsbb\eaio\m2\org\slf4j\jul-to-slf4j\2.0.16\jul-to-slf4j-2.0.16.jar;C:\devsbb\eaio\m2\jakarta\annotation\jakarta.annotation-api\2.1.1\jakarta.annotation-api-2.1.1.jar;C:\devsbb\eaio\m2\org\yaml\snakeyaml\2.2\snakeyaml-2.2.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot-starter-json\3.3.4\spring-boot-starter-json-3.3.4.jar;C:\devsbb\eaio\m2\com\fasterxml\jackson\core\jackson-databind\2.17.2\jackson-databind-2.17.2.jar;C:\devsbb\eaio\m2\com\fasterxml\jackson\core\jackson-annotations\2.17.2\jackson-annotations-2.17.2.jar;C:\devsbb\eaio\m2\com\fasterxml\jackson\core\jackson-core\2.17.2\jackson-core-2.17.2.jar;C:\devsbb\eaio\m2\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.17.2\jackson-datatype-jdk8-2.17.2.jar;C:\devsbb\eaio\m2\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.17.2\jackson-datatype-jsr310-2.17.2.jar;C:\devsbb\eaio\m2\com\fasterxml\jackson\module\jackson-module-parameter-names\2.17.2\jackson-module-parameter-names-2.17.2.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot-starter-tomcat\3.3.4\spring-boot-starter-tomcat-3.3.4.jar;C:\devsbb\eaio\m2\org\apache\tomcat\embed\tomcat-embed-core\10.1.30\tomcat-embed-core-10.1.30.jar;C:\devsbb\eaio\m2\org\apache\tomcat\embed\tomcat-embed-el\10.1.30\tomcat-embed-el-10.1.30.jar;C:\devsbb\eaio\m2\org\apache\tomcat\embed\tomcat-embed-websocket\10.1.30\tomcat-embed-websocket-10.1.30.jar;C:\devsbb\eaio\m2\org\springframework\spring-web\6.1.13\spring-web-6.1.13.jar;C:\devsbb\eaio\m2\org\springframework\spring-beans\6.1.13\spring-beans-6.1.13.jar;C:\devsbb\eaio\m2\org\springframework\spring-webmvc\6.1.13\spring-webmvc-6.1.13.jar;C:\devsbb\eaio\m2\org\springframework\spring-aop\6.1.13\spring-aop-6.1.13.jar;C:\devsbb\eaio\m2\org\springframework\spring-context\6.1.13\spring-context-6.1.13.jar;C:\devsbb\eaio\m2\org\springframework\spring-expression\6.1.13\spring-expression-6.1.13.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot-starter-actuator\3.3.4\spring-boot-starter-actuator-3.3.4.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot-actuator-autoconfigure\3.3.4\spring-boot-actuator-autoconfigure-3.3.4.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot-actuator\3.3.4\spring-boot-actuator-3.3.4.jar;C:\devsbb\eaio\m2\io\micrometer\micrometer-observation\1.13.4\micrometer-observation-1.13.4.jar;C:\devsbb\eaio\m2\io\micrometer\micrometer-commons\1.13.4\micrometer-commons-1.13.4.jar;C:\devsbb\eaio\m2\io\micrometer\micrometer-jakarta9\1.13.4\micrometer-jakarta9-1.13.4.jar;C:\devsbb\eaio\m2\io\micrometer\micrometer-core\1.13.4\micrometer-core-1.13.4.jar;C:\devsbb\eaio\m2\org\hdrhistogram\HdrHistogram\2.2.2\HdrHistogram-2.2.2.jar;C:\devsbb\eaio\m2\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;C:\devsbb\eaio\m2\jakarta\xml\bind\jakarta.xml.bind-api\4.0.2\jakarta.xml.bind-api-4.0.2.jar;C:\devsbb\eaio\m2\jakarta\activation\jakarta.activation-api\2.1.3\jakarta.activation-api-2.1.3.jar;C:\devsbb\eaio\m2\org\springframework\spring-core\6.1.13\spring-core-6.1.13.jar;C:\devsbb\eaio\m2\org\springframework\spring-jcl\6.1.13\spring-jcl-6.1.13.jar;C:\devsbb\eaio\m2\org\springframework\boot\spring-boot-starter-thymeleaf\3.3.4\spring-boot-starter-thymeleaf-3.3.4.jar;C:\devsbb\eaio\m2\org\thymeleaf\thymeleaf-spring6\3.1.2.RELEASE\thymeleaf-spring6-3.1.2.RELEASE.jar;C:\devsbb\eaio\m2\org\thymeleaf\thymeleaf\3.1.2.RELEASE\thymeleaf-3.1.2.RELEASE.jar;C:\devsbb\eaio\m2\org\attoparser\attoparser\2.0.7.RELEASE\attoparser-2.0.7.RELEASE.jar;C:\devsbb\eaio\m2\org\unbescape\unbescape\1.1.6.RELEASE\unbescape-1.1.6.RELEASE.jar;C:\devsbb\eaio\m2\org\springdoc\springdoc-openapi-starter-webmvc-ui\2.6.0\springdoc-openapi-starter-webmvc-ui-2.6.0.jar;C:\devsbb\eaio\m2\org\springdoc\springdoc-openapi-starter-webmvc-api\2.6.0\springdoc-openapi-starter-webmvc-api-2.6.0.jar;C:\devsbb\eaio\m2\org\springdoc\springdoc-openapi-starter-common\2.6.0\springdoc-openapi-starter-common-2.6.0.jar;C:\devsbb\eaio\m2\io\swagger\core\v3\swagger-core-jakarta\2.2.22\swagger-core-jakarta-2.2.22.jar;C:\devsbb\eaio\m2\io\swagger\core\v3\swagger-annotations-jakarta\2.2.22\swagger-annotations-jakarta-2.2.22.jar;C:\devsbb\eaio\m2\io\swagger\core\v3\swagger-models-jakarta\2.2.22\swagger-models-jakarta-2.2.22.jar;C:\devsbb\eaio\m2\jakarta\validation\jakarta.validation-api\3.0.2\jakarta.validation-api-3.0.2.jar;C:\devsbb\eaio\m2\com\fasterxml\jackson\dataformat\jackson-dataformat-yaml\2.17.2\jackson-dataformat-yaml-2.17.2.jar;C:\devsbb\eaio\m2\org\webjars\swagger-ui\5.17.14\swagger-ui-5.17.14.jar ch.naviqore.app.Application

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.3.4)

2024-10-15T20:58:00.954+02:00  INFO 3636 --- [           main] ch.naviqore.app.Application              : Starting Application using Java 21.0.2 with PID 3636 (C:\devsbb\code\naviqore\public-transit-service\target\classes started by u228298 in C:\devsbb\code\naviqore\public-transit-service)
2024-10-15T20:58:00.957+02:00  INFO 3636 --- [           main] ch.naviqore.app.Application              : No active profile set, falling back to 1 default profile: "default"
2024-10-15T20:58:01.786+02:00  INFO 3636 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2024-10-15T20:58:01.794+02:00  INFO 3636 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-10-15T20:58:01.794+02:00  INFO 3636 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.30]
2024-10-15T20:58:01.828+02:00  INFO 3636 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-10-15T20:58:01.828+02:00  INFO 3636 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 833 ms
2024-10-15T20:58:01.921+02:00  WARN 3636 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'openApiConfig' defined in file [C:\devsbb\code\naviqore\public-transit-service\target\classes\ch\naviqore\app\config\OpenApiConfig.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'org.springframework.boot.info.BuildProperties' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2024-10-15T20:58:01.923+02:00  INFO 3636 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2024-10-15T20:58:01.934+02:00  INFO 3636 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-10-15T20:58:01.949+02:00 ERROR 3636 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in ch.naviqore.app.config.OpenApiConfig required a bean of type 'org.springframework.boot.info.BuildProperties' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.boot.info.BuildProperties' in your configuration.


Process finished with exit code 1
@munterfi munterfi self-assigned this Oct 15, 2024
@munterfi munterfi linked a pull request Oct 15, 2024 that will close this issue
@clukas1 clukas1 closed this as completed Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants