GithubHelp home page GithubHelp logo

Comments (12)

dsyer avatar dsyer commented on June 10, 2024

Hard to say without seeing the actual docker command failure. My guess is you have some docker turds - most likely a volume with incompatible Postgres data on it. You could skip the tests if all you want to do is run the app (-D skipTests) or you could clean up your docker environment (e.g. docker system prune).

from spring-petclinic.

zhaojing1987 avatar zhaojing1987 commented on June 10, 2024

I seem to have encountered the same mistake

Starting docker-compose for docker-compose.yml

06:39:39 Will run docker-compose pull first

06:39:39 Starting: /bin/sh -c docker-compose  -f "docker-compose.yml" pull && docker-compose  -f "docker-compose.yml" up -d

06:39:39  in directory: /opt/buildagent/work/1e4b02daf5c6d9be

06:39:40 Creating network "1e4b02daf5c6d9be_default" with the default driver

06:39:40 Process exited with code 0

06:39:41 docker-compose has started successfully

06:39:42 
  "docker inspect" requires at least 1 argument.See 'docker inspect --help'.
  
  Usage:  docker inspect [OPTIONS] NAME|ID [NAME|ID...]
  
  Return low-level information on Docker objects

06:39:42 
  Registering environment variable TEAMCITY_DOCKER_NETWORK=
2023-12-13T07:04:18.903Z  INFO 24870 --- [           main] o.s.s.p.PostgresIntegrationTests         : Starting PostgresIntegrationTests using Java 17.0.7 with PID 24870 (started by buildagent in /opt/buildagent/work/1e4b02daf5c6d9be)

07:04:18 
  2023-12-13T07:04:18.904Z  INFO 24870 --- [           main] o.s.s.p.PostgresIntegrationTests         : The following 1 profile is active: "postgres"

07:04:18 
  2023-12-13T07:04:18.909Z  INFO 24870 --- [           main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file '/opt/buildagent/work/1e4b02daf5c6d9be/docker-compose.yml'

07:04:19 
  2023-12-13T07:04:19.781Z ERROR 24870 --- [           main] o.s.boot.SpringApplication               : Application run failed

07:04:19 
  

07:04:19 
  org.springframework.boot.docker.compose.core.DockerOutputParseException: Failed to parse docker JSON:
org.springframework.samples.petclinic.PostgresIntegrationTests

07:04:20 
    testFindAll

07:04:20 
    testOwnerDetails

07:04:20 
  [INFO]

07:04:20 
  [INFO] Results:

07:04:20 
  [INFO]

07:04:20 
  [ERROR] Errors:

07:04:20 
  [ERROR]   PostgresIntegrationTests.testFindAll » IllegalState Failed to load ApplicationContext for [WebMergedContextConfiguration@61bf9c9b testClass = org.springframework.samples.petclinic.PostgresIntegrationTests, locations = [], classes = [org.springframework.samples.petclinic.PetClinicApplication], contextInitializerClasses = [], activeProfiles = ["postgres"], propertySourceDescriptors = [], propertySourceProperties = ["spring.docker.compose.skip.in-tests=false", "spring.docker.compose.profiles.active=postgres", "org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true", "server.port=0"], contextCustomizers = [org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@4c98a6d5, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@4d8126f, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@7df0a05b, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@4c03a37, org.springframework.boot.testcontainers.service.connection.ServiceConnectionContextCustomizer@0, org.springframework.boot.test.context.SpringBootTestAnnotation@4981f901], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]

07:04:20 
  [ERROR]   PostgresIntegrationTests.testOwnerDetails » IllegalState ApplicationContext failure threshold (1) exceeded: skipping repeated attempt to load context for [WebMergedContextConfiguration@61bf9c9b testClass = org.springframework.samples.petclinic.PostgresIntegrationTests, locations = [], classes = [org.springframework.samples.petclinic.PetClinicApplication], contextInitializerClasses = [], activeProfiles = ["postgres"], propertySourceDescriptors = [], propertySourceProperties = ["spring.docker.compose.skip.in-tests=false", "spring.docker.compose.profiles.active=postgres", "org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true", "server.port=0"], contextCustomizers = [org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@4c98a6d5, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@4d8126f, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@7df0a05b, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@4c03a37, org.springframework.boot.testcontainers.service.connection.ServiceConnectionContextCustomizer@0, org.springframework.boot.test.context.SpringBootTestAnnotation@4981f901], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]

07:04:20 
  [INFO]

07:04:20 
  [ERROR] Tests run: 47, Failures: 0, Errors: 2, Skipped: 0

07:04:20 
  [INFO]

07:04:20 
  [ERROR]

from spring-petclinic.

dsyer avatar dsyer commented on June 10, 2024

That one looks like it failed on “docker inspect”. Do you have the right version of docker? Does it work locally?

from spring-petclinic.

zhaojing1987 avatar zhaojing1987 commented on June 10, 2024

That one looks like it failed on “docker inspect”. Do you have the right version of docker? Does it work locally?

docker version
Client: Docker Engine - Community
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:45:33 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:42 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

from spring-petclinic.

dsyer avatar dsyer commented on June 10, 2024

That's really old (even though it is still supported by Docker I think). I would try with at least something that was current when Spring Boot 3.0 was released (v23 probably). I'm using v24. EDIT: I also tried with v20 and it worked, so that's not the problem.

You didn't answer the question about whether it works locally, i.e. on the command line.

from spring-petclinic.

dsyer avatar dsyer commented on June 10, 2024

It would be useful also to see the result of just running docker-compose --profile postgres up (per the readme).

from spring-petclinic.

zhaojing1987 avatar zhaojing1987 commented on June 10, 2024

Actually, I tried to execute: docker-compose --profile postgres up, which is normal。But I made an error while building in Teamcity

from spring-petclinic.

dsyer avatar dsyer commented on June 10, 2024

Your logs appear to show docker compose running without the --profile postgres. That's not the way the tests in this project are set up. Are you even running the tests in this project? (This might be unrelated to the OP issue.)

from spring-petclinic.

dsyer avatar dsyer commented on June 10, 2024

See also spring-projects/spring-boot#38763

from spring-petclinic.

zhaojing1987 avatar zhaojing1987 commented on June 10, 2024

See also spring-projects/spring-boot#38763

Sorry, but specifically what should I do? The container seems to be automatically built, do I need to intervene?

2023-12-14T03:10:01.817Z  INFO 17196 --- [           main] o.s.s.p.PostgresIntegrationTests         : Starting PostgresIntegrationTests using Java 17.0.7 with PID 17196 (started by buildagent in /opt/buildagent/work/1e4b02daf5c6d9be)
03:10:01   2023-12-14T03:10:01.817Z  INFO 17196 --- [           main] o.s.s.p.PostgresIntegrationTests         : The following 1 profile is active: "postgres"
03:10:01   2023-12-14T03:10:01.823Z  INFO 17196 --- [           main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file '/opt/buildagent/work/1e4b02daf5c6d9be/docker-compose.yml'
03:10:02   2023-12-14T03:10:02.753Z ERROR 17196 --- [           main] o.s.boot.SpringApplication               : Application run failed
03:10:02   
03:10:02   org.springframework.boot.docker.compose.core.DockerOutputParseException: Failed to parse docker JSON:

from spring-petclinic.

dsyer avatar dsyer commented on June 10, 2024

JSON parsing problems suggest you have the wrong version of docker-compose (needs to be 2.x at least: spring-projects/spring-boot#38760). There isn’t really enough information yet to know.

from spring-petclinic.

dsyer avatar dsyer commented on June 10, 2024

Closing since it works for me.

from spring-petclinic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.