This document explains how to test each storage backend in Simple Drive.
Three independent PowerShell test scripts are provided:
test_localstorage.ps1- Tests local filesystem storagetest_s3.ps1- Tests AWS S3 storagetest_database.ps1- Tests SQLite database storage
Each script:
- Cleans up any existing processes on port 8080
- Starts the server in a new visible terminal window
- Runs tests against the API
- Stops the server automatically
None. Works out of the box.
.\test_localstorage.ps1- Cleans up old processes and port 8080
- Starts server with local storage backend in new terminal
- Uploads a test blob to
./storage_data/ - Retrieves the blob and verifies data integrity
- Stops the server
./storage_data/- Directory containing blob files./metadata.db- SQLite database with metadata
You need an AWS account with:
- An S3 bucket (must already exist)
- IAM credentials with these permissions:
AdministratorAccessAmazonS3FullAccess
Edit test_s3.ps1 and update lines 5-7:
$S3Endpoint = "https://YOUR-BUCKET-NAME.s3.YOUR-REGION.amazonaws.com" $S3BucketName = "YOUR-BUCKET-NAME" $S3Region = "YOUR-REGION"
Then update lines 29-30 with your AWS credentials:
$env:S3_ACCESS_KEY = "YOUR_AWS_ACCESS_KEY_ID" $env:S3_SECRET_KEY = "YOUR_AWS_SECRET_ACCESS_KEY"
- Cleans up old processes and port 8080
- Starts server with S3 storage backend in new terminal
- Uploads a test blob to AWS S3
- Retrieves the blob and verifies data integrity
- Stops the server
None. SQLite is built into Go.
.\test_database.ps1- Cleans up old processes and port 8080
- Starts server with database storage backend in new terminal
- Uploads a test blob to SQLite database
- Retrieves the blob and verifies data integrity
- Stops the server
./storage.db- SQLite database with blob data./metadata.db- SQLite database with metadata
-
Port Cleanup:
- Kills any Go processes
- Kills any process using port 8080
- Waits 2 seconds
-
Server Launch:
- Opens a new visible PowerShell window
- Sets environment variables in that window
- Runs
go run main.go - Window stays open for debugging
-
Testing:
- Waits 5-6 seconds for server to start
- Makes HTTP requests to test endpoints
- Verifies data integrity
-
Cleanup:
- Stops the server process
- Closes the terminal window
Each test script sets these internally (no need to set them manually):
STORAGE_BACKEND=localLOCAL_STORAGE_PATH=./storage_dataBEARER_TOKEN=(^&%sdfuyigsdfiuhgy(^&*SERVER_PORT=8080
STORAGE_BACKEND=s3S3_ENDPOINT=https://bucket.s3.region.amazonaws.comS3_ACCESS_KEY=your-keyS3_SECRET_KEY=your-secretS3_BUCKET_NAME=your-bucketS3_REGION=your-regionBEARER_TOKEN=(^&%sdfuyigsdfiuhgy(^&*SERVER_PORT=8080
STORAGE_BACKEND=databaseDATABASE_URL=./storage.dbBEARER_TOKEN=(^&%sdfuyigsdfiuhgy(^&*SERVER_PORT=8080