mirror of
https://github.com/Grace-Solutions/PSMinIO.git
synced 2026-07-27 15:18:56 +00:00
2974ead76e
Key Achievements: - Downgraded to MinIO 4.0.7 for PowerShell compatibility (eliminated async/await issues) - Fixed file handle leaks in upload operations (using explicit FileStream management) - Implemented clean logging (timestamps without redundant prefixes) - Fixed automatic session variable management (Connect-MinIO stores, cmdlets retrieve) - Removed duplicate certificate parameters (kept only SkipCertificateValidation) - Fixed all 'Folder' alias conflicts across cmdlets - Added correct System.Runtime.CompilerServices.Unsafe.dll version (4.5.3) Working Features: - Connection management (automatic + explicit override) - Bucket operations (list, create, remove) - File upload/download (with proper handle release) - Progress tracking and speed reporting - Clean verbose logging with timestamps Known Issue: - Chunked operations have threading violations (PowerShell cmdlet methods called from background threads) - Regular operations work perfectly, chunked operations need threading architecture fix Test Results: - 3.71GB Windows install.wim file tested - Regular upload/download: Working - File handles: No leaks, immediate deletion possible - Session management: Automatic connection storage/retrieval - Chunked operations: Threading violations need fix
49 lines
2.0 KiB
PowerShell
49 lines
2.0 KiB
PowerShell
# Session variable test for PSMinIO module
|
|
Import-Module ./Module/PSMinIO/PSMinIO.psd1 -Force
|
|
|
|
Write-Host "=== Session Variable Test ===" -ForegroundColor Cyan
|
|
|
|
# Test credentials
|
|
$endpoint = "https://api.s3.gracesolution.info"
|
|
$accessKey = "T34Wg85SAwezUa3sk3m4"
|
|
$secretKey = "PxEmnbQoQJTJsDocSEV6mSSscDpJMiJCayPv93xe"
|
|
|
|
Write-Host "1. Before connection - checking existing variables..." -ForegroundColor Yellow
|
|
Get-Variable -Name "*MinIO*" -ErrorAction SilentlyContinue | ForEach-Object {
|
|
Write-Host "Found variable: $($_.Name) = $($_.Value)" -ForegroundColor Gray
|
|
}
|
|
|
|
Write-Host "2. Connecting with verbose output..." -ForegroundColor Yellow
|
|
try {
|
|
$connection = Connect-MinIO -Endpoint $endpoint -AccessKey $accessKey -SecretKey $secretKey -Verbose
|
|
Write-Host "SUCCESS: Connected" -ForegroundColor Green
|
|
|
|
Write-Host "3. After connection - checking variables..." -ForegroundColor Yellow
|
|
Get-Variable -Name "*MinIO*" -ErrorAction SilentlyContinue | ForEach-Object {
|
|
Write-Host "Found variable: $($_.Name) = $($_.Value)" -ForegroundColor Gray
|
|
}
|
|
|
|
# Try to manually set the session variable
|
|
Write-Host "4. Manually setting session variable..." -ForegroundColor Yellow
|
|
Set-Variable -Name "MinIOConnection" -Value $connection -Scope Global
|
|
|
|
Write-Host "5. After manual set - checking variables..." -ForegroundColor Yellow
|
|
Get-Variable -Name "*MinIO*" -ErrorAction SilentlyContinue | ForEach-Object {
|
|
Write-Host "Found variable: $($_.Name) = $($_.Value)" -ForegroundColor Gray
|
|
}
|
|
|
|
# Now try Get-MinIOBucket without explicit connection
|
|
Write-Host "6. Testing Get-MinIOBucket without explicit connection..." -ForegroundColor Yellow
|
|
try {
|
|
$buckets = Get-MinIOBucket -Verbose
|
|
Write-Host "SUCCESS: Found $($buckets.Count) buckets" -ForegroundColor Green
|
|
} catch {
|
|
Write-Host "FAILED: $($_.Exception.Message)" -ForegroundColor Red
|
|
}
|
|
|
|
} catch {
|
|
Write-Host "FAILED: $($_.Exception.Message)" -ForegroundColor Red
|
|
}
|
|
|
|
Write-Host "Session test completed!" -ForegroundColor Cyan
|