mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
fix(lambda): implement GetLayerVersionByArn (#2812)
* fix(lambda): implement GetLayerVersionByArn
GET /2018-10-31/layers?find=LayerVersion&Arn={arn} is GetLayerVersionByArn,
but only ListLayers was bound to that path and it ignored both query
parameters. A GetLayerVersionByArn call was therefore answered with a
ListLayers body and HTTP 200: an SDK deserialises that against the
GetLayerVersionByArn output shape, finds none of its members, and hands the
caller an empty result instead of the layer version or a
ResourceNotFoundException.
AWS gives the two actions the same method and path, discriminated only by
`find`, and JAX-RS cannot route on a query parameter, so the branch lives in
the handler.
The semantics below were measured against the live service rather than
inferred from the reference:
find=LayerVersion&Arn=<present> 200 + LayerVersion object
find=LayerVersion&Arn=<absent> 404 ResourceNotFoundException
find=LayerVersion, no Arn 400 ValidationException, must not be null
find=LayerVersion&Arn=junk 400 ValidationException, pattern in message
find=Nonsense 200 + ListLayers body
find=layerversion 200 + ListLayers body (match is case-sensitive)
The Arn pattern enforced here is the one the live service reports in its own
ValidationException, not the one the API reference publishes: it constrains
the region segment more tightly and additionally accepts the AWS-managed
arn:<partition>:lambda:::awslayer:<name> form, which the reference omits.
The response reuses the builder GetLayerVersion already returns, and resolves
Content.Location against the layer's own region rather than the caller's,
matching the lookup resolveLayerByArn already keys on.
* fix(lambda): scope GetLayerVersionByArn to the caller's account
resolveLayerByArn keys on region, layer name and version. Storage is already
partitioned per account, so that lookup runs inside the caller's own partition
— an ARN naming a different account did not reach that account's layers, but it
did resolve to the caller's own same-named layer and return it.
Measured on main, without this action: account B publishes
arn:...:111111111111:layer:acct-probe:1, then calls CreateFunction with
Layers=[arn:...:000000000000:layer:acct-probe:1]. The call succeeds and the
function records account A's ARN while B's own layer is what resolves. Account
B never sees account A's layer — GetLayerVersion by name and ListLayers both
return nothing for it — so this is a wrong-resource answer, not a cross-account
read.
GetLayerVersionByArn is the one layer action that takes an account explicitly,
so it honours it: an ARN outside the caller's account is a 404, which is what
the caller already gets from GetLayerVersion for a layer it cannot see. No
layer can be shared cross-account here — layer permissions are unimplemented —
so a foreign account is always a miss, and the check is the place sharing would
hook in if that changes.
The same account-blindness reaches CreateFunction and UpdateFunctionConfiguration
through validateLayersResolvable, and the container launcher through the same
resolver. Those are pre-existing on main and change behaviour for existing
actions, so they are left for a separate change rather than folded in here.
* fix(lambda): reject a layer ARN naming another partition
The account guard compared only the account, and resolveLayerByArn drops
the partition as well as the account, so an ARN in another accepted
partition with the same account, region, name and version resolved to
the caller's local layer and was returned under the foreign-partition
ARN. The live service rejects those outright with
InvalidParameterValueException.
This commit is contained in:
1 parent
426fbcb284
commit
5b363ffa2d
4 files changed
+384
-4
No files matched your search
@@ -166,8 +166,8 @@ services:
|
||||
|
||||
Function URLs are also reachable directly on `/{proxy:.*}` under the Lambda URL controller, which routes the request into the normal `Invoke` path.
|
||||
|
||||
**Layers:** `PublishLayerVersion`, `GetLayerVersion`, `ListLayerVersions`, `ListLayers`, and
|
||||
`DeleteLayerVersion` are implemented, with real local storage under
|
||||
**Layers:** `PublishLayerVersion`, `GetLayerVersion`, `GetLayerVersionByArn`, `ListLayerVersions`,
|
||||
`ListLayers`, and `DeleteLayerVersion` are implemented, with real local storage under
|
||||
`{lambda.codePath}/layers/{name}/{version}`. `CreateFunction`/`UpdateFunctionConfiguration`
|
||||
validate each `Layers` ARN eagerly against that storage, matching real AWS - an unresolvable ARN
|
||||
is rejected with `InvalidParameterValueException`, not silently accepted. Only resolves layers
|
||||
@@ -180,7 +180,7 @@ a name you control and reference that ARN instead.
|
||||
|
||||
These AWS Lambda operations have no handler in Floci. Calls will return `404` or an error:
|
||||
|
||||
- Layer permissions and cross-account ARN lookup (`GetLayerVersionByArn`, `AddLayerVersionPermission`, `RemoveLayerVersionPermission`, `GetLayerVersionPolicy`)
|
||||
- Layer permissions (`AddLayerVersionPermission`, `RemoveLayerVersionPermission`, `GetLayerVersionPolicy`)
|
||||
- Provisioned concurrency (`PutProvisionedConcurrencyConfig`, `GetProvisionedConcurrencyConfig`, `ListProvisionedConcurrencyConfigs`, `DeleteProvisionedConcurrencyConfig`)
|
||||
- Dead-letter, async invoke config, and event invoke config operations
|
||||
- `InvokeWithResponseStream`
|
||||
|
||||
+19
-1
@@ -14,6 +14,7 @@ import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
@@ -31,12 +32,15 @@ import java.util.Map;
|
||||
* GetLayerVersion: GET /2018-10-31/layers/{LayerName}/versions/{VersionNumber}
|
||||
* DeleteLayerVersion: DELETE /2018-10-31/layers/{LayerName}/versions/{VersionNumber}
|
||||
* ListLayers: GET /2018-10-31/layers
|
||||
* GetLayerVersionByArn: GET /2018-10-31/layers?find=LayerVersion&Arn={arn}
|
||||
*/
|
||||
@Path("/2018-10-31")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public class LambdaLayerController {
|
||||
|
||||
private static final String FIND_LAYER_VERSION = "LayerVersion";
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
private final LambdaLayerService layerService;
|
||||
private final RegionResolver regionResolver;
|
||||
@@ -96,9 +100,23 @@ public class LambdaLayerController {
|
||||
return Response.noContent().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* ListLayers, and GetLayerVersionByArn when {@code find=LayerVersion}. AWS gives the two
|
||||
* actions the same method and path, and JAX-RS cannot route on a query parameter. The match
|
||||
* is case-sensitive; any other value is a ListLayers call.
|
||||
*/
|
||||
@GET
|
||||
@Path("/layers")
|
||||
public Response listLayers(@Context HttpHeaders headers) {
|
||||
public Response listLayers(@QueryParam("find") String find,
|
||||
@QueryParam("Arn") String arn,
|
||||
@Context HttpHeaders headers,
|
||||
@Context UriInfo uriInfo) {
|
||||
if (FIND_LAYER_VERSION.equals(find)) {
|
||||
LambdaLayerVersion lv = layerService.getLayerVersionByArn(arn);
|
||||
// The layer's own region, not the caller's: tasksLocation resolves the bucket from it.
|
||||
String layerRegion = AwsArnUtils.parse(lv.getLayerVersionArn()).region();
|
||||
return Response.ok(buildLayerVersionResponse(lv, layerRegion, uriInfo)).build();
|
||||
}
|
||||
String region = regionResolver.resolveRegion(headers);
|
||||
List<LambdaLayerVersion> layers = layerService.listLayers(region);
|
||||
ObjectNode root = objectMapper.createObjectNode();
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Base64;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Business logic for Lambda Layer management.
|
||||
@@ -34,6 +35,18 @@ public class LambdaLayerService {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(LambdaLayerService.class);
|
||||
|
||||
/**
|
||||
* Arn constraint GetLayerVersionByArn enforces. Taken from the live service's own
|
||||
* ValidationException rather than the API reference, which publishes a laxer pattern and
|
||||
* omits the AWS-managed {@code awslayer} form entirely.
|
||||
*/
|
||||
private static final String LAYER_VERSION_ARN_PATTERN =
|
||||
"((arn:(aws[a-zA-Z-]*)?:lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\\d{1}"
|
||||
+ ":\\d{12}:layer:[a-zA-Z0-9-_]+:[0-9]+)"
|
||||
+ "|(arn:[a-zA-Z0-9-]+:lambda:::awslayer:[a-zA-Z0-9-_]+))";
|
||||
private static final Pattern LAYER_VERSION_ARN = Pattern.compile(LAYER_VERSION_ARN_PATTERN);
|
||||
private static final int MAX_LAYER_VERSION_ARN_LENGTH = 140;
|
||||
|
||||
private final LambdaLayerStore layerStore;
|
||||
private final ZipExtractor zipExtractor;
|
||||
private final EmulatorConfig config;
|
||||
@@ -197,6 +210,50 @@ public class LambdaLayerService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GetLayerVersionByArn. Arn is validated before lookup, so a malformed value is a 400
|
||||
* ValidationException and a well-formed but absent one a 404 — both as the live service
|
||||
* answers them.
|
||||
*/
|
||||
public LambdaLayerVersion getLayerVersionByArn(String layerVersionArn) {
|
||||
if (layerVersionArn == null || layerVersionArn.isEmpty()) {
|
||||
throw new AwsException("ValidationException",
|
||||
"1 validation error detected: Value null at 'arn' failed to satisfy constraint: "
|
||||
+ "Member must not be null", 400);
|
||||
}
|
||||
if (layerVersionArn.length() > MAX_LAYER_VERSION_ARN_LENGTH
|
||||
|| !LAYER_VERSION_ARN.matcher(layerVersionArn).matches()) {
|
||||
throw new AwsException("ValidationException",
|
||||
"1 validation error detected: Value '" + layerVersionArn + "' at 'arn' failed to satisfy"
|
||||
+ " constraint: Member must satisfy regular expression pattern: "
|
||||
+ LAYER_VERSION_ARN_PATTERN, 400);
|
||||
}
|
||||
// resolveLayerByArn keys on region/name/version within the caller's own partition, so an
|
||||
// ARN naming another account would otherwise resolve to the caller's same-named layer.
|
||||
// No layer here can be shared cross-account (layer permissions are unimplemented), so a
|
||||
// foreign account is always a miss; this is where sharing would hook in if that changes.
|
||||
// resolveLayerByArn also drops the partition, so an ARN naming another one would
|
||||
// otherwise resolve to the local layer under a foreign-partition ARN. Floci emulates
|
||||
// the aws partition; the live service rejects the others outright.
|
||||
AwsArnUtils.Arn parsed = AwsArnUtils.parse(layerVersionArn);
|
||||
if (parsed.partition() != null && !parsed.partition().isEmpty()
|
||||
&& !"aws".equals(parsed.partition())) {
|
||||
throw new AwsException("InvalidParameterValueException",
|
||||
"Invalid layer version " + layerVersionArn, 400);
|
||||
}
|
||||
String requestedAccount = AwsArnUtils.accountOrDefault(layerVersionArn, null);
|
||||
if (requestedAccount != null && !requestedAccount.equals(regionResolver.getAccountId())) {
|
||||
throw new AwsException("ResourceNotFoundException",
|
||||
"The resource you requested does not exist.", 404);
|
||||
}
|
||||
LambdaLayerVersion lv = resolveLayerByArn(layerVersionArn);
|
||||
if (lv == null) {
|
||||
throw new AwsException("ResourceNotFoundException",
|
||||
"The resource you requested does not exist.", 404);
|
||||
}
|
||||
return lv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a layer version ARN to its local code path.
|
||||
* Used by the container launcher to copy layer content into /opt.
|
||||
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
package io.github.hectorvent.floci.services.lambda;
|
||||
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasItem;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
/**
|
||||
* GetLayerVersionByArn: GET /2018-10-31/layers?find=LayerVersion&Arn={arn}. Shares
|
||||
* ListLayers' path, so these also pin that ListLayers itself is unchanged.
|
||||
*/
|
||||
@QuarkusTest
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
class LambdaGetLayerVersionByArnIntegrationTest {
|
||||
|
||||
private static final String LAYER_NAME = "by-arn-layer";
|
||||
|
||||
private static String layerZipBase64() throws Exception {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try (ZipOutputStream zos = new ZipOutputStream(baos)) {
|
||||
zos.putNextEntry(new ZipEntry("python/shared.py"));
|
||||
zos.write("VALUE = 1".getBytes());
|
||||
zos.closeEntry();
|
||||
}
|
||||
return Base64.getEncoder().encodeToString(baos.toByteArray());
|
||||
}
|
||||
|
||||
private static String publishLayer() throws Exception {
|
||||
return given()
|
||||
.contentType("application/json")
|
||||
.body("""
|
||||
{
|
||||
"Content": { "ZipFile": "%s" },
|
||||
"CompatibleRuntimes": ["python3.12"],
|
||||
"CompatibleArchitectures": ["x86_64"],
|
||||
"Description": "resolved by arn",
|
||||
"LicenseInfo": "Apache-2.0"
|
||||
}
|
||||
""".formatted(layerZipBase64()))
|
||||
.when()
|
||||
.post("/2018-10-31/layers/" + LAYER_NAME + "/versions")
|
||||
.then()
|
||||
.statusCode(201)
|
||||
.extract().path("LayerVersionArn");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
void returnsTheLayerVersion_notAListLayersBody() throws Exception {
|
||||
String arn = publishLayer();
|
||||
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.queryParam("Arn", arn)
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
// A LayerVersion object, never the ListLayers envelope.
|
||||
.body("Layers", nullValue())
|
||||
.body("LayerVersionArn", equalTo(arn))
|
||||
.body("LayerArn", containsString(":layer:" + LAYER_NAME))
|
||||
.body("Version", equalTo(1))
|
||||
.body("Description", equalTo("resolved by arn"))
|
||||
.body("LicenseInfo", equalTo("Apache-2.0"))
|
||||
.body("CompatibleRuntimes", hasItem("python3.12"))
|
||||
.body("CompatibleArchitectures", hasItem("x86_64"))
|
||||
.body("Content.CodeSha256", notNullValue())
|
||||
.body("Content.CodeSize", notNullValue())
|
||||
.body("Content.Location", containsString("/layers/"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
void matchesGetLayerVersionForTheSameVersion() throws Exception {
|
||||
String arn = publishLayer();
|
||||
long version = Long.parseLong(arn.substring(arn.lastIndexOf(':') + 1));
|
||||
|
||||
String byName = given()
|
||||
.when()
|
||||
.get("/2018-10-31/layers/" + LAYER_NAME + "/versions/" + version)
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("Content.CodeSha256");
|
||||
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.queryParam("Arn", arn)
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("Content.CodeSha256", equalTo(byName));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
void wellFormedButAbsentArnIsResourceNotFound() {
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.queryParam("Arn", "arn:aws:lambda:us-east-1:000000000000:layer:no-such-layer:9")
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(404)
|
||||
.body("__type", equalTo("ResourceNotFoundException"))
|
||||
.body("message", equalTo("The resource you requested does not exist."));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
void malformedArnIsValidationException() {
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.queryParam("Arn", "not-an-arn")
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", containsString("failed to satisfy constraint"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(5)
|
||||
void arnWithoutAVersionIsValidationException() {
|
||||
// A layer ARN, not a layer *version* ARN: the pattern requires the trailing version.
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.queryParam("Arn", "arn:aws:lambda:us-east-1:000000000000:layer:" + LAYER_NAME)
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(6)
|
||||
void findWithoutArnIsValidationException() {
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", containsString("Member must not be null"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(7)
|
||||
void awsManagedLayerArnFormPassesValidation() {
|
||||
// arn:<partition>:lambda:::awslayer:<name> is the second alternative in the pattern the
|
||||
// live service enforces. No such layer can exist here, so it resolves to 404, not 400.
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.queryParam("Arn", "arn:aws:lambda:::awslayer:AmazonLinux1803")
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(404)
|
||||
.body("__type", equalTo("ResourceNotFoundException"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(7)
|
||||
void arnNamingAnotherAccountDoesNotResolveTheCallersOwnLayer() throws Exception {
|
||||
String arn = publishLayer();
|
||||
// Same region, name and version — only the account differs. The lookup is keyed within
|
||||
// the caller's own partition, so without an account check this would return the layer
|
||||
// above under someone else's ARN.
|
||||
String foreign = arn.replaceFirst(":\\d{12}:", ":111111111111:");
|
||||
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.queryParam("Arn", foreign)
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(404)
|
||||
.body("__type", equalTo("ResourceNotFoundException"));
|
||||
|
||||
// control: the identical ARN under the caller's own account still resolves
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.queryParam("Arn", arn)
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("LayerVersionArn", equalTo(arn));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(7)
|
||||
void arnInAnotherPartitionIsRejected() throws Exception {
|
||||
String arn = publishLayer();
|
||||
// Same account, region, name and version - only the partition differs. Measured against
|
||||
// the live service, which answers InvalidParameterValueException rather than resolving.
|
||||
for (String partition : new String[] {"aws-cn", "aws-us-gov", "aws-iso"}) {
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.queryParam("Arn", arn.replaceFirst("^arn:aws:", "arn:" + partition + ":"))
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("InvalidParameterValueException"))
|
||||
.body("message", containsString("Invalid layer version arn:" + partition + ":"));
|
||||
}
|
||||
|
||||
// control: the same ARN in the aws partition still resolves
|
||||
given()
|
||||
.queryParam("find", "LayerVersion")
|
||||
.queryParam("Arn", arn)
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("LayerVersionArn", equalTo(arn));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(8)
|
||||
void listLayersStillWorksWithoutFind() throws Exception {
|
||||
publishLayer();
|
||||
|
||||
given()
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("Layers", notNullValue())
|
||||
.body("Layers.LayerName", hasItem(LAYER_NAME));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(9)
|
||||
void unknownFindValueFallsThroughToListLayers() throws Exception {
|
||||
publishLayer();
|
||||
|
||||
// Measured against the live service: an unrecognised `find` is ignored and the request
|
||||
// is answered as ListLayers, rather than rejected.
|
||||
given()
|
||||
.queryParam("find", "SomethingElse")
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("Layers", notNullValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(10)
|
||||
void findMatchIsCaseSensitive() {
|
||||
// Also measured: only the exact string dispatches; other casings are ListLayers calls,
|
||||
// which is why an Arn alongside them is simply ignored rather than resolved.
|
||||
for (String find : new String[] {"layerversion", "LAYERVERSION", "LayerversioN"}) {
|
||||
given()
|
||||
.queryParam("find", find)
|
||||
.queryParam("Arn", "arn:aws:lambda:us-east-1:000000000000:layer:" + LAYER_NAME + ":1")
|
||||
.when()
|
||||
.get("/2018-10-31/layers")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("Layers", notNullValue());
|
||||
}
|
||||
}
|
||||
|
||||
// ── cleanup ───────────────────────────────────────────────────────────────
|
||||
|
||||
@Test
|
||||
@Order(11)
|
||||
void cleanup_deletePublishedVersions() {
|
||||
List<Integer> versions = given()
|
||||
.when()
|
||||
.get("/2018-10-31/layers/" + LAYER_NAME + "/versions")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().path("LayerVersions.Version");
|
||||
|
||||
for (Integer version : versions) {
|
||||
given()
|
||||
.when()
|
||||
.delete("/2018-10-31/layers/" + LAYER_NAME + "/versions/" + version)
|
||||
.then()
|
||||
.statusCode(204);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user