Spaces:
Paused
Paused
Download scripts/testStorage.js from imkrish/campverse-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/spaces/imkrish/campverse-backend/resolve/main/scripts/testStorage.js
- Command line
-
hf download hf://spaces/imkrish/campverse-backend/scripts/testStorage.js
-
curl -L -o testStorage.js https://huggingface.co/spaces/imkrish/campverse-backend/resolve/main/scripts/testStorage.js
1.38 kB
| /** | |
| * Storage Service Test Script | |
| * | |
| * This script tests the unified storage service functionality | |
| * Run with: node scripts/testStorage.js | |
| */ | |
| require('dotenv').config(); | |
| const { unifiedStorageService, getProviderInfo, healthCheck } = require('../Services/driveService'); | |
| async function testStorageService() { | |
| console.log('Starting storage service tests...'); | |
| try { | |
| // Test 1: Get provider info | |
| const info = getProviderInfo(); | |
| // Test 2: Health check | |
| await healthCheck(); | |
| // Test 3: Test provider switching (if applicable) | |
| const availableProviders = info.available; | |
| for (const provider of availableProviders) { | |
| try { | |
| unifiedStorageService.switchProvider(provider); | |
| await healthCheck(); | |
| } catch (error) { | |
| // Ignore errors during provider switching | |
| } | |
| } | |
| // Switch back to default | |
| const defaultProvider = process.env.STORAGE_PROVIDER || 'local'; | |
| unifiedStorageService.switchProvider(defaultProvider); | |
| } catch (error) { | |
| console.error('Storage service test failed:', error); | |
| throw error; | |
| } | |
| } | |
| // Run the test | |
| if (require.main === module) { | |
| testStorageService().then(() => { | |
| process.exit(0); | |
| }).catch((error) => { | |
| console.error('Test script error:', error); | |
| process.exit(1); | |
| }); | |
| } | |
| module.exports = { testStorageService }; | |