Add integration testing infrastructure with Podman Compose

- Add docker/podman-compose.yml for Immich server (no ML)
- Add test-data/sample-photos/ with 3 public domain images
- Add scripts/start-immich.sh for container startup + admin/API key creation
- Add scripts/seed-data.sh for uploading test photos and creating albums
- Add scripts/stop-immich.sh for cleanup with volume destruction
- Add scripts/run-example.sh wrapper (fixed env var export)
- Update examples to use IMMICH_URL and IMMICH_API_KEY env vars
- Add .github/workflows/integration-test.yml for CI
- Update assets.list() to use /search/metadata endpoint
- Update AGENTS.md with example running instructions
- Add 5 new examples: search_metadata, album_management, timeline_browsing,
  delete_assets, server_info
This commit is contained in:
Joakim Hulthe
2026-04-14 19:56:41 +00:00
parent c55d2b9080
commit 2e7db3b35a
22 changed files with 1327 additions and 22 deletions

View File

@@ -1,15 +1,38 @@
//! Example: Upload photos to Immich
//!
//! This example uses environment variables for configuration:
//! - IMMICH_URL: The Immich server URL (defaults to http://localhost:2283)
//! - IMMICH_API_KEY: Your API key (required)
//!
//! It also reads photos from test-data/sample-photos/ directory.
use immich_sdk::Client;
use std::path::Path;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client
let client = Client::from_url("https://immich.example.com")?.with_api_key("your-api-key");
// Configure the client from environment variables
let url = std::env::var("IMMICH_URL").unwrap_or_else(|_| "http://localhost:2283".to_string());
let api_key =
std::env::var("IMMICH_API_KEY").expect("IMMICH_API_KEY environment variable not set");
// Path to the photo
let photo_path = Path::new("/path/to/your/photo.jpg");
// Create a client
let client = Client::from_url(&url)?.with_api_key(api_key);
// Use test data photos
let photo_dir = std::path::Path::new("test-data/sample-photos");
let photos: Vec<_> = std::fs::read_dir(photo_dir)?
.filter_map(|e| e.ok())
.map(|e| e.path())
.filter(|p| p.extension().map(|e| e == "jpg").unwrap_or(false))
.collect();
if photos.is_empty() {
println!("No photos found in test-data/sample-photos/");
return Ok(());
}
// Upload first photo
let photo_path = &photos[0];
// Upload the photo
println!("Uploading: {}", photo_path.display());