修复 Runner 身份路径并补充关联日志
This commit is contained in:
@@ -16,8 +16,22 @@ def request() -> RunnerRequest:
|
||||
|
||||
|
||||
def test_identity_path_is_meaningful_and_uri_safe():
|
||||
assert pod_worker.identity_path("panxiao81/example", "publish image") == (
|
||||
"panxiao81/example/publish%20image"
|
||||
path = pod_worker.identity_path("panxiao81/example", "publish image")
|
||||
assert path.startswith("panxiao81/example/publish-image-")
|
||||
assert "%" not in path
|
||||
assert all(pod_worker.SPIFFE_PATH_SEGMENT.fullmatch(part) for part in path.split("/"))
|
||||
assert pod_worker.identity_path("panxiao81/example", "lint") == "panxiao81/example/lint"
|
||||
assert path == pod_worker.identity_path("panxiao81/example", "publish image")
|
||||
assert path != pod_worker.identity_path("panxiao81/example", "publish-image")
|
||||
real_path = pod_worker.identity_path(
|
||||
"panxiao81/postgresql-tenant-operator", "Run on Ubuntu"
|
||||
)
|
||||
assert real_path.startswith(
|
||||
"panxiao81/postgresql-tenant-operator/Run-on-Ubuntu-"
|
||||
)
|
||||
assert all(
|
||||
pod_worker.SPIFFE_PATH_SEGMENT.fullmatch(part)
|
||||
for part in real_path.split("/")
|
||||
)
|
||||
with pytest.raises(ValueError):
|
||||
pod_worker.identity_path("invalid", "test")
|
||||
|
||||
Reference in New Issue
Block a user