Home / Function/ shouldWorkWithProfiles() — spring-boot Function Reference

shouldWorkWithProfiles() — spring-boot Function Reference

Architecture documentation for the shouldWorkWithProfiles() function in DefaultDockerComposeIntegrationTests.java from the spring-boot codebase.

Entity Profile

Dependency Diagram

graph TD
  cc6eb136_4e58_bcae_7af6_407ca78e3d25["shouldWorkWithProfiles()"]
  39c09c85_2984_2ae3_7c7a_1319ec542950["createComposeFile()"]
  cc6eb136_4e58_bcae_7af6_407ca78e3d25 -->|calls| 39c09c85_2984_2ae3_7c7a_1319ec542950
  3b0cd53c_53b7_2635_4cac_b43ef379a69e["assertThatContainsService()"]
  cc6eb136_4e58_bcae_7af6_407ca78e3d25 -->|calls| 3b0cd53c_53b7_2635_4cac_b43ef379a69e
  f0f40a09_7260_eff9_412c_624abd962233["assertThatDoesNotContainService()"]
  cc6eb136_4e58_bcae_7af6_407ca78e3d25 -->|calls| f0f40a09_7260_eff9_412c_624abd962233
  1dcecdf7_cc3d_5924_707c_5731b05f83a7["findService()"]
  cc6eb136_4e58_bcae_7af6_407ca78e3d25 -->|calls| 1dcecdf7_cc3d_5924_707c_5731b05f83a7
  style cc6eb136_4e58_bcae_7af6_407ca78e3d25 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

core/spring-boot-docker-compose/src/dockerTest/java/org/springframework/boot/docker/compose/core/DefaultDockerComposeIntegrationTests.java lines 52–90

	@Test
	void shouldWorkWithProfiles(@TempDir Path tempDir) throws IOException {
		// Profile 1 contains redis1 and redis3
		// Profile 2 contains redis2 and redis3
		File composeFile = createComposeFile(tempDir, "profiles.yaml").toFile();
		DefaultDockerCompose dockerComposeWithProfile1 = new DefaultDockerCompose(new DockerCli(tempDir.toFile(),
				new DockerComposeOptions(DockerComposeFile.of(composeFile), Set.of("1"), Collections.emptyList())),
				null);
		DefaultDockerCompose dockerComposeWithProfile2 = new DefaultDockerCompose(new DockerCli(tempDir.toFile(),
				new DockerComposeOptions(DockerComposeFile.of(composeFile), Set.of("2"), Collections.emptyList())),
				null);
		DefaultDockerCompose dockerComposeWithAllProfiles = new DefaultDockerCompose(new DockerCli(tempDir.toFile(),
				new DockerComposeOptions(DockerComposeFile.of(composeFile), Set.of("1", "2"), Collections.emptyList())),
				null);
		dockerComposeWithAllProfiles.up(LogLevel.DEBUG);
		try {
			List<RunningService> runningServicesProfile1 = dockerComposeWithProfile1.getRunningServices();
			assertThatContainsService(runningServicesProfile1, "redis1");
			assertThatDoesNotContainService(runningServicesProfile1, "redis2");
			assertThatContainsService(runningServicesProfile1, "redis3");

			List<RunningService> runningServicesProfile2 = dockerComposeWithProfile2.getRunningServices();
			assertThatDoesNotContainService(runningServicesProfile2, "redis1");
			assertThatContainsService(runningServicesProfile2, "redis2");
			assertThatContainsService(runningServicesProfile2, "redis3");

			// Assert that redis3 is started only once and is shared between profile 1 and
			// profile 2
			assertThat(dockerComposeWithAllProfiles.getRunningServices()).hasSize(3);
			RunningService redis3Profile1 = findService(runningServicesProfile1, "redis3");
			RunningService redis3Profile2 = findService(runningServicesProfile2, "redis3");
			assertThat(redis3Profile1).isNotNull();
			assertThat(redis3Profile2).isNotNull();
			assertThat(redis3Profile1.name()).isEqualTo(redis3Profile2.name());
		}
		finally {
			dockerComposeWithAllProfiles.down(Duration.ofSeconds(10));
		}
	}

Domain

Subdomains

Calls

  • assertThatContainsService()
  • assertThatDoesNotContainService()
  • createComposeFile()
  • findService()

Frequently Asked Questions

What does shouldWorkWithProfiles() do?
shouldWorkWithProfiles() is a function in the spring-boot codebase.
What does shouldWorkWithProfiles() call?
shouldWorkWithProfiles() calls 4 function(s): assertThatContainsService, assertThatDoesNotContainService, createComposeFile, findService.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free