56 lines
1.8 KiB
Rust
56 lines
1.8 KiB
Rust
//! Live provider conformance tests.
|
|
//!
|
|
//! These tests are `#[ignore]` by default and require environment variables
|
|
//! to be set. Run them explicitly with:
|
|
//!
|
|
//! ```sh
|
|
//! # CoreDNS
|
|
//! COREDNS_URL=http://127.0.0.1:9153 cargo test -p ontoref-dns coredns -- --ignored
|
|
//!
|
|
//! # Cloudflare
|
|
//! CF_API_TOKEN=... CF_TEST_ZONE_ID=... cargo test -p ontoref-dns cloudflare -- --ignored
|
|
//! ```
|
|
|
|
#[cfg(all(feature = "coredns", feature = "test-support"))]
|
|
mod coredns_live {
|
|
use ontoref_dns::{
|
|
conformance::run_conformance_suite, CoreDnsConfig, CoreDnsProvider,
|
|
};
|
|
|
|
#[tokio::test]
|
|
#[ignore = "requires a live CoreDNS HTTP API at COREDNS_URL"]
|
|
async fn coredns_passes_conformance() {
|
|
let base_url = std::env::var("COREDNS_URL")
|
|
.unwrap_or_else(|_| "http://127.0.0.1:9153".into());
|
|
let provider = CoreDnsProvider::new(CoreDnsConfig {
|
|
base_url,
|
|
..CoreDnsConfig::default()
|
|
})
|
|
.expect("CoreDnsProvider construction must succeed");
|
|
|
|
run_conformance_suite(provider).await.assert_all_pass();
|
|
}
|
|
}
|
|
|
|
#[cfg(all(feature = "cloudflare", feature = "test-support"))]
|
|
mod cloudflare_live {
|
|
use ontoref_dns::{
|
|
conformance::run_conformance_suite, CloudflareConfig, CloudflareProvider,
|
|
};
|
|
|
|
#[tokio::test]
|
|
#[ignore = "requires CF_API_TOKEN and CF_TEST_ZONE_ID"]
|
|
async fn cloudflare_passes_conformance() {
|
|
let token = std::env::var("CF_API_TOKEN")
|
|
.expect("CF_API_TOKEN must be set");
|
|
let zone_id = std::env::var("CF_TEST_ZONE_ID")
|
|
.expect("CF_TEST_ZONE_ID must be set");
|
|
|
|
let provider = CloudflareProvider::new(
|
|
CloudflareConfig::new(token).with_default_zone(zone_id),
|
|
)
|
|
.expect("CloudflareProvider construction must succeed");
|
|
|
|
run_conformance_suite(provider).await.assert_all_pass();
|
|
}
|
|
}
|