Add support for CNB platform API 0.9

Fixes gh-30566
This commit is contained in:
Scott Frederick
2022-04-13 16:09:32 -05:00
parent ff40c8b6f5
commit f032690d0a
3 changed files with 21 additions and 10 deletions

View File

@@ -16,6 +16,8 @@
package org.springframework.boot.buildpack.platform.build;
import java.util.stream.IntStream;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
@@ -65,6 +67,12 @@ class ApiVersionsTests {
"Detected platform API versions '1.3,1.4' are not included in supported versions '1.1,1.2'");
}
@Test
void createFromRange() {
ApiVersions versions = ApiVersions.of(1, IntStream.rangeClosed(2, 7));
assertThat(versions.toString()).isEqualTo("1.2,1.3,1.4,1.5,1.6,1.7");
}
@Test
void toStringReturnsString() {
assertThat(ApiVersions.parse("1.1", "2.2", "3.3").toString()).isEqualTo("1.1,2.2,3.3");

View File

@@ -161,8 +161,8 @@ class LifecycleTests {
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
assertThatIllegalStateException()
.isThrownBy(() -> createLifecycle("builder-metadata-unsupported-api.json").execute()).withMessage(
"Detected platform API versions '0.2' are not included in supported versions '0.3,0.4,0.5,0.6,0.7,0.8'");
.isThrownBy(() -> createLifecycle("builder-metadata-unsupported-api.json").execute())
.withMessageContaining("Detected platform API versions '0.2' are not included in supported versions");
}
@Test
@@ -171,8 +171,9 @@ class LifecycleTests {
given(this.docker.container().create(any(), any())).willAnswer(answerWithGeneratedContainerId());
given(this.docker.container().wait(any())).willReturn(ContainerStatus.of(0, null));
assertThatIllegalStateException()
.isThrownBy(() -> createLifecycle("builder-metadata-unsupported-apis.json").execute()).withMessage(
"Detected platform API versions '0.1,0.2' are not included in supported versions '0.3,0.4,0.5,0.6,0.7,0.8'");
.isThrownBy(() -> createLifecycle("builder-metadata-unsupported-apis.json").execute())
.withMessageContaining(
"Detected platform API versions '0.1,0.2' are not included in supported versions");
}
@Test