No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-28 13:57:09 +02:00
src feat: re-export testcontainers 2026-09-28 13:56:36 +02:00
tests test: add new integration test 2026-09-28 12:02:50 +02:00
.gitignore feat: basic Forgejo test container 2026-09-28 11:48:49 +02:00
Cargo.lock chore: release 0.1.1 2026-09-28 13:57:09 +02:00
Cargo.toml chore: release 0.1.1 2026-09-28 13:57:09 +02:00
LICENSE chore: update cargo metadata and add license 2026-09-28 12:10:47 +02:00
mise.toml feat: basic Forgejo test container 2026-09-28 11:48:49 +02:00
README.md chore: add readme 2026-09-28 12:33:34 +02:00

forgejo-testcontainer

A small testcontainers image for Forgejo.

Add dependency:

forgejo-testcontainer = "0.1"
use forgejo_testcontainer::{Forgejo, HTTP_PORT};
use reqwest::Client;
use testcontainers::runners::AsyncRunner;

#[tokio::test]
async fn use_forgejo() -> Result<(), Box<dyn std::error::Error>> {
    let forgejo = Forgejo::default()
        .with_admin_user("test-admin", "test-password", "admin@example.test")
        .start()
        .await?;

    let url = format!(
        "http://{}:{}",
        forgejo.get_host().await?,
        forgejo.get_host_port_ipv4(HTTP_PORT).await?
    );
    let response = Client::new()
        .get(format!("{url}/api/v1/user"))
        .basic_auth(
            forgejo.image().admin_username(),
            Some(forgejo.image().admin_password()),
        )
        .send()
        .await?;

    assert!(response.status().is_success());
    Ok(())
}

Use with_config(section, key, value) to set additional Forgejo configuration.

Compatibility

  • 0.1.x supports Forgejo 16.x