Home / Class/ SystemDockerApiTests Class — spring-boot Architecture

SystemDockerApiTests Class — spring-boot Architecture

Architecture documentation for the SystemDockerApiTests class in DockerApiTests.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

buildpack/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/DockerApiTests.java lines 865–902

	@Nested
	class SystemDockerApiTests {

		private SystemApi api;

		@BeforeEach
		void setup() {
			this.api = DockerApiTests.this.dockerApi.system();
		}

		@Test
		void getApiVersionWithVersionHeaderReturnsVersion() throws Exception {
			given(http().head(eq(new URI(PING_URL))))
				.willReturn(responseWithHeaders(new BasicHeader(DockerApi.API_VERSION_HEADER_NAME, "1.44")));
			assertThat(this.api.getApiVersion()).isEqualTo(ApiVersion.of(1, 44));
		}

		@Test
		void getApiVersionWithEmptyVersionHeaderReturnsUnknownVersion() throws Exception {
			given(http().head(eq(new URI(PING_URL))))
				.willReturn(responseWithHeaders(new BasicHeader(DockerApi.API_VERSION_HEADER_NAME, "")));
			assertThat(this.api.getApiVersion()).isEqualTo(DockerApi.UNKNOWN_API_VERSION);
		}

		@Test
		void getApiVersionWithNoVersionHeaderReturnsUnknownVersion() throws Exception {
			given(http().head(eq(new URI(PING_URL)))).willReturn(emptyResponse());
			assertThat(this.api.getApiVersion()).isEqualTo(DockerApi.UNKNOWN_API_VERSION);
		}

		@Test
		void getApiVersionWithExceptionReturnsUnknownVersion(CapturedOutput output) throws Exception {
			given(http().head(eq(new URI(PING_URL)))).willThrow(new IOException("simulated error"));
			assertThat(this.api.getApiVersion()).isEqualTo(DockerApi.UNKNOWN_API_VERSION);
			assertThat(output).contains("Warning: Failed to determine Docker API version: simulated error");
		}

	}

Analyze Your Own Codebase

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

Try Supermodel Free