Add test coverage for cache scitoken overrides using Xrootd.ScitokensConfig#3028
Add test coverage for cache scitoken overrides using Xrootd.ScitokensConfig#3028
Conversation
bbockelm
left a comment
There was a problem hiding this comment.
It looks like Xrootd.ScitokensConfig works for both caches and origins, meaning this functionality already exists. Let's focus on providing test coverage for this fact in cache mode. I like having both a unit test and an e2e test as is done in this PR.
I'd additionally like a new E2E test that:
- Sets up a full federation and pulls a file through the cache.
- Places the origin in downtime and removes corresponding namespace ads.
- Triggers a cache authz refresh. This can be done by overwriting the
Xrootd.ScitokensConfigfile with some new issuer covering an unrelated path. You can verify the refresh by seeing new data show up in the corresponding generated file. - Verify you can no longer access the data through the cache.
- Trigger another cache authz refresh, this time adding the authorization information explicitly for the test prefix.
- Verify you can now access the cached object, even with the origin offline.
This new test will demonstrate that the Xrootd.ScitokensConfig override is the only thing needed to access offline data in a cache.
|
|
||
| /*************************************************************** | ||
| * | ||
| * Copyright (C) 2025, Pelican Project, Morgridge Institute for Research |
Added comprehensive E2E test as requested in commit 0bdf17e. The test:
The test demonstrates that Xrootd.ScitokensConfig override is sufficient for accessing offline data in a cache. |
8b9d74c to
996bf60
Compare
996bf60 to
a259732
Compare
There was a problem hiding this comment.
The linked task specifies that "ONLY if the cache is unregistered, we should allow the administrator to specify a scitoken overrides file that gets merged into the calculated scitoken file" which makes sense as it could potentially override security in certain places. I don't see any check for if the cache is unregistered to allow this.
Edit: Nevermind, had a discussion with Brian about this. Ignore this comment
|
@copilot Please address the review comments that are tagging you. |
|
@copilot Please fix the linter errors |
This helps refresh information quickly in unit tests. Includes a "floor" to prevent this from happening too quickly in production.
If the director failed - but the user specified a cache to use - continue trying the request against that cache. Use the default token; in this case, it will not select the right token automatically. This allows a cache to be leveraged and Pelican to work while everything else in the federation is 100% offline.
Shows that data can be accessed at a cache even when the origin is offline!
- Change assert.Equal/Error to require.Equal/Error for critical assertions - Increase test timeouts from 5s/10s to 20s to handle CI load - Use URL construction instead of string concatenation for cache URL - Create resource file for origin config (single-private-full.yml) - Fix tj.token.DirResp not being set when director fails with explicit caches Co-authored-by: turetske <498529+turetske@users.noreply.github.com>
9122618 to
1e02d4d
Compare
Changes
Reverted the addition of
Cache.ScitokensUserOverrideparameter because the functionality already exists viaXrootd.ScitokensConfig, which is marked as usable by both cache and origin components.New comprehensive E2E test:
TestCacheScitokensConfigOverridedemonstrates:Xrootd.ScitokensConfigwith unrelated issuerThis test validates that
Xrootd.ScitokensConfigprovides the override mechanism needed for caches to serve objects during origin downtime.All review feedback addressed including linter fixes.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.