Replace custom JWT refresh logic with standardized HxClient#6398
Merged
pditommaso merged 2 commits intomasterfrom Sep 13, 2025
Merged
Replace custom JWT refresh logic with standardized HxClient#6398pditommaso merged 2 commits intomasterfrom
pditommaso merged 2 commits intomasterfrom
Conversation
This commit fixes a failing test in TowerFusionEnvTest.groovy that was testing the token refresh functionality of the TowerFusionToken class. The main issue was in the test setup and verification expectations: 1. **Updated TowerFusionToken to use HxClient**: Replaced the custom HTTP client implementation with the standardized HxClient which provides built-in token refresh capabilities following OAuth 2.0 patterns. 2. **Fixed WireMock test configuration**: Updated the test stubs to match the actual behavior of HxClient token refresh: - Use cookie-based token refresh with Set-Cookie headers - Simplified scenario state management - Corrected request/response patterns 3. **Updated test verification**: Changed verification logic to match the actual flow: 1 refresh call + 2 total requests to the license endpoint (initial 401 + retry with new token). The token refresh now works correctly following the OAuth 2.0 standard: - Initial request with expired token returns 401 - HxClient automatically calls refresh endpoint - HxClient retries original request with new token - Request succeeds with valid license token All 73 tests in the nf-tower plugin now pass (100% success rate). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
bentsherman
approved these changes
Sep 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces custom JWT refresh and retry logic in TowerFusionToken with the standardized HxClient from libseqera, fixing a failing test and improving code maintainability.
Background
The TowerFusionToken class previously implemented its own custom JWT token refresh logic using:
This approach was error-prone and duplicated functionality already available in the standardized HxClient.
Changes Made
Replaced Custom Implementation with HxClient
Before:
After:
Benefits of HxClient Integration
Fixed Test Configuration
Updated TowerFusionEnvTest to match HxClient actual behavior:
Technical Details
The HxClient automatically handles the complete OAuth 2.0 refresh flow:
This eliminates the need for custom retry logic and ensures consistency with other Nextflow components using HxClient.
Test Results
🤖 Generated with Claude Code