- Rename tli/ directory to fxt/, update package + binary name to "fxt" - Replace all `use tli::` → `use fxt::` across 52 Rust files - Update build.rs proto paths (tli/proto → fxt/proto) in 6 services - Update Dockerfiles, CI workflows, deploy.sh for new paths - Delete ~170 legacy shell scripts (kept 15 essential ones) - Delete RunPod Python client (runpod/), tests (tests/runpod/) - Delete foxhunt-deploy crate (RunPod-only deployment tool) - Delete terraform/runpod/ (moved to Scaleway) - Delete ML Python hyperopt scripts (replaced by Rust Argmin PSO) - Delete .gitlab-ci.yml (using GitHub + Gitea) - Remove foxhunt-deploy from workspace members 504 files changed, -74,355 lines of legacy code removed. Workspace compiles clean (0 errors, 0 warnings). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
89 lines
3.0 KiB
Rust
89 lines
3.0 KiB
Rust
//! Debug test for FileTokenStorage
|
|
|
|
// Suppress false-positive unused_crate_dependencies warnings
|
|
// dev-dependencies are shared across ALL test targets in the crate
|
|
// This test may not use all deps, but they are required by other integration tests
|
|
#![allow(unused_crate_dependencies)]
|
|
|
|
use anyhow::Result;
|
|
use fxt::auth::token_manager::{FileTokenStorage, TokenStorage};
|
|
|
|
#[tokio::test]
|
|
async fn debug_file_storage() -> Result<()> {
|
|
let storage = FileTokenStorage::new()?;
|
|
|
|
println!("\n=== FileTokenStorage Debug Test ===");
|
|
|
|
// Store token
|
|
let test_token = "debug_test_token_12345";
|
|
println!("1. Storing token: {}", test_token);
|
|
|
|
match storage.store_access_token(test_token).await {
|
|
Ok(()) => println!(" ✓ Store succeeded"),
|
|
Err(e) => {
|
|
println!(" ✗ Store failed: {}", e);
|
|
return Err(e);
|
|
},
|
|
}
|
|
|
|
// Immediately retrieve
|
|
println!("2. Retrieving token immediately...");
|
|
match storage.get_access_token().await {
|
|
Ok(Some(token)) => {
|
|
println!(" ✓ Retrieved: {}", token);
|
|
assert_eq!(token, test_token, "Tokens don't match!");
|
|
},
|
|
Ok(None) => {
|
|
println!(" ✗ Retrieved None (token not found)");
|
|
|
|
// Debug: Check file paths
|
|
let token_dir = std::env::var("HOME")
|
|
.or_else(|_| std::env::var("USERPROFILE"))
|
|
.expect("Cannot find home directory")
|
|
+ "/.config/foxhunt-tli/tokens";
|
|
|
|
println!("\n3. Debug file system:");
|
|
println!(" Token dir: {}", token_dir);
|
|
|
|
// Check if directory exists
|
|
if std::path::Path::new(&token_dir).exists() {
|
|
println!(" ✓ Directory exists");
|
|
|
|
// List files
|
|
if let Ok(entries) = std::fs::read_dir(&token_dir) {
|
|
println!(" Files in directory:");
|
|
for entry in entries {
|
|
if let Ok(entry) = entry {
|
|
println!(" - {}", entry.path().display());
|
|
|
|
// Try to read the file
|
|
if let Ok(contents) = std::fs::read_to_string(entry.path()) {
|
|
println!(
|
|
" Contents (first 50 chars): {}",
|
|
&contents.chars().take(50).collect::<String>()
|
|
);
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
println!(" ✗ Cannot list directory");
|
|
}
|
|
} else {
|
|
println!(" ✗ Directory does not exist");
|
|
}
|
|
|
|
panic!("Token retrieval returned None");
|
|
},
|
|
Err(e) => {
|
|
println!(" ✗ Retrieval failed: {}", e);
|
|
return Err(e);
|
|
},
|
|
}
|
|
|
|
// Clean up
|
|
storage.clear_access_token().await?;
|
|
println!("4. Cleanup complete");
|
|
|
|
Ok(())
|
|
}
|