use faucet_source_singer::{SingerSource, SingerSourceConfig};
fn fake_tap() -> String {
format!("{}/tests/fake_taps/fake_tap.sh", env!("CARGO_MANIFEST_DIR"))
}
#[test]
fn conformance_config_schema_valid() {
let source = SingerSource::new(SingerSourceConfig::new(fake_tap(), "s"));
faucet_conformance::assert_config_schema_valid(&source);
}
#[tokio::test]
async fn conformance_bounded_memory() {
let total = 2_000;
let batch = 100;
let source = SingerSource::new(SingerSourceConfig {
args: vec![
"--stream".into(),
"s".into(),
"--total".into(),
total.to_string(),
],
state_key: Some("singer_conf".into()),
..SingerSourceConfig::new(fake_tap(), "s")
});
faucet_conformance::assert_bounded_memory(&source, batch, total).await;
}
#[tokio::test]
async fn conformance_bookmark_roundtrip() {
let total = 6;
let source = SingerSource::new(SingerSourceConfig {
args: vec![
"--stream".into(),
"s".into(),
"--total".into(),
total.to_string(),
],
state_key: Some("singer_conf_bookmark".into()),
..SingerSourceConfig::new(fake_tap(), "s")
});
faucet_conformance::assert_bookmark_roundtrip(&source).await;
}
#[tokio::test]
async fn conformance_errors_not_panics() {
faucet_conformance::assert_errors_not_panics(&missing_tap_source()).await;
}
fn missing_tap_source() -> SingerSource {
SingerSource::new(SingerSourceConfig::new(
"/nonexistent/faucet-conformance-tap-binary",
"s",
))
}
#[test]
fn conformance_connector_name_nonempty() {
let source = SingerSource::new(SingerSourceConfig::new(fake_tap(), "s"));
faucet_conformance::assert_connector_name_nonempty(&source);
}
#[tokio::test]
async fn conformance_preflight_check_wellformed() {
faucet_conformance::assert_preflight_check_wellformed(
&missing_tap_source(),
&faucet_core::check::CheckContext::default(),
)
.await;
}