storage_controller: fix non-timeline passthrough GETs (#7602)

## Problem

We were matching on `/tenant/:tenant_id` and
`/tenant/:tenant_id/timeline*`, but not non-timeline tenant sub-paths.
There aren't many: this was only noticeable when using the
synthetic_size endpoint by hand.

## Summary of changes

- Change the wildcard from `/tenant/:tenant_id/timeline*` to
`/tenant/:tenant_id/*`
- Add test lines that exercise this
This commit is contained in:
John Spray
2024-05-03 12:52:43 +01:00
committed by GitHub
parent 37b1930b2f
commit b7385bb016
2 changed files with 10 additions and 5 deletions

View File

@@ -912,7 +912,7 @@ pub fn make_router(
RequestName("v1_tenant_timeline"),
)
})
// Tenant detail GET passthrough to shard zero
// Tenant detail GET passthrough to shard zero:
.get("/v1/tenant/:tenant_id", |r| {
tenant_service_handler(
r,
@@ -920,13 +920,14 @@ pub fn make_router(
RequestName("v1_tenant_passthrough"),
)
})
// Timeline GET passthrough to shard zero. Note that the `*` in the URL is a wildcard: any future
// timeline GET APIs will be implicitly included.
.get("/v1/tenant/:tenant_id/timeline*", |r| {
// The `*` in the URL is a wildcard: any tenant/timeline GET APIs on the pageserver
// are implicitly exposed here. This must be last in the list to avoid
// taking precedence over other GET methods we might implement by hand.
.get("/v1/tenant/:tenant_id/*", |r| {
tenant_service_handler(
r,
handle_tenant_timeline_passthrough,
RequestName("v1_tenant_timeline_passthrough"),
RequestName("v1_tenant_passthrough"),
)
})
}

View File

@@ -230,6 +230,10 @@ def test_storage_controller_passthrough(
}
assert status["state"]["slug"] == "Active"
(synthetic_size, size_inputs) = client.tenant_size_and_modelinputs(env.initial_tenant)
assert synthetic_size > 0
assert "segments" in size_inputs
env.storage_controller.consistency_check()