Skip to content

No Docker Compose file found exception in Spring Unit tests generation #2291

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

Closed
alisevych opened this issue Jun 16, 2023 · 3 comments · Fixed by #2293
Closed

No Docker Compose file found exception in Spring Unit tests generation #2291

alisevych opened this issue Jun 16, 2023 · 3 comments · Fixed by #2293
Assignees
Labels
comp-instrumented-process Issue is related to Instrumented process comp-spring Issue is related to Spring projects support ctg-bug Issue is a bug

Comments

@alisevych
Copy link
Member

alisevych commented Jun 16, 2023

Description

IllegalStateException: No Docker Compose file found in instrumented process logs from SpringAnalyzerProcess.
Spring Unit tests were being generated.

To Reproduce

  1. Install UnitTestBot plugin built from main in IntelliJ IDEA
  2. Open spring-petclinic project
  3. Set JDK 17
  4. Generate tests for Owner entity-class: select PetClinicApplication, Unit tests and leave defaults for all other settings.

Expected behavior

No instrumented process failures are expected.

Actual behavior

IllegalStateException: No Docker Compose file found in instrumented process logs from SpringAnalyzerProcess.

Screenshots, logs

///region Test suites for executable org.springframework.samples.petclinic.owner.Owner.toString

	///region Errors report for toString

	public void testToString_errors() {
		// Couldn't generate some tests. List of errors:
		//
		// 1 occurrences of:
		// <Throwable with empty message>

	}
	///endregion

	///endregion
14:34:53.154 | INFO  | EngineProcessMain         | -----------------------------------------------------------------------
14:34:53.157 | INFO  | EngineProcessMain         | -------------------NEW ENGINE PROCESS STARTED--------------------------
14:34:53.157 | INFO  | EngineProcessMain         | -----------------------------------------------------------------------
14:34:55.260 | INFO  | SpringAnalyzerProcess     | Spring Analyzer process started with PID = 87409
14:34:56.247 | INFO  | SpringAnalyzerProcess     | RdCategory: SpringAnalyzerProcessMain | -----------------------------------------------------------------------
14:34:56.248 | INFO  | SpringAnalyzerProcess     | RdCategory: SpringAnalyzerProcessMain | ------------------NEW SPRING ANALYZER PROCESS STARTED------------------
14:34:56.248 | INFO  | SpringAnalyzerProcess     | RdCategory: SpringAnalyzerProcessMain | -----------------------------------------------------------------------
14:34:56.255 | INFO  | SpringAnalyzerProcess     | RdCategory: SourceFinder              | Using java Spring configuration
14:34:56.258 | INFO  | SpringAnalyzerProcess     | RdCategory: SpringApplicationInstantiatorFacade | Current Java version is: 17.0.6
14:34:56.260 | INFO  | SpringAnalyzerProcess     | RdCategory: SpringApplicationInstantiatorFacade | Current Spring version is: 6.0.9
14:34:56.261 | INFO  | SpringAnalyzerProcess     | RdCategory: SpringApplicationInstantiatorFacade | Current Spring Boot version is: 3.1.0
14:34:56.301 | INFO  | SpringAnalyzerProcess     | RdCategory: SpringApplicationInstantiatorFacade | Instantiating with org.utbot.spring.instantiator.SpringBootApplicationInstantiator@1d8a8c80
14:34:58.175 | INFO  | SpringAnalyzerProcess     | RdCategory: SpringApplication         | Starting application using Java 17.0.6 with PID 87409 (started by alenalisevych in /private/var/folders/3b/hdmt5d356wb48ryz0tg9b13c0000gn/T/UTBot/spring-analyzer2454592816807074907)
14:34:58.176 | INFO  | SpringAnalyzerProcess     | RdCategory: SpringApplication         | The following 1 profile is active: "default"
14:34:58.930 | ERROR | SpringAnalyzerProcess     | RdCategory: SpringApplication         | Application run failed | java.lang.IllegalStateException: No Docker Compose file found in directory '/private/var/folders/3b/hdmt5d356wb48ryz0tg9b13c0000gn/T/UTBot/spring-analyzer2454592816807074907/.'
        at org.springframework.util.Assert.state(Assert.java:97)
        at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.getComposeFile(DockerComposeLifecycleManager.java:135)
        at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.start(DockerComposeLifecycleManager.java:103)
        at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53)
        at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35)

Environment

OS - macOS Ventura 13.2.1 (22D68)
IntelliJ IDEA version - 2023.1.2 Community edition
Project - spring-petclinic
JDK - 17

@alisevych alisevych added ctg-bug Issue is a bug comp-instrumented-process Issue is related to Instrumented process comp-spring Issue is related to Spring projects support labels Jun 16, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in UTBot Java Jun 19, 2023
@alisevych
Copy link
Member Author

@IlyaMuravjov So this issue is related to Docker and Maven, OS is not specific, correct?

@IlyaMuravjov
Copy link
Collaborator

@alisevych I was able to reproduce it on Windows 10.

Using Maven was important when it came to reproducing this issue, because in spring-petclinic Docker is only configured in Maven build script, but not in Gradle build script. Also, for the sake of reproducibility it's also worth to mention that spring-petclinic Maven build script has been updated quite recently.

Finally, it seems that if Docker isn't installed at all, then Spring is able to detect it and doesn't attempt to search for Docker Compose file, leading to issue not getting reproduced.

@alisevych
Copy link
Member Author

@IlyaMuravjov Thanks! Then I will rename the issue.

@alisevych alisevych changed the title No Docker Compose file found exception in Spring Unit tests generation on macOs No Docker Compose file found exception in Spring Unit tests generation Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-instrumented-process Issue is related to Instrumented process comp-spring Issue is related to Spring projects support ctg-bug Issue is a bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants