risingwavelabs/risingwave · error · SinkError::Config

test sink only support in test

Error message

test sink only support in test

What it means

TestSink is only constructible when the binary is compiled for madsim or test (cfg! gate). Outside those builds, TryFrom<SinkParam> returns a Config error because the test sink must never run in production.

Solutions

  1. Remove connector='test' from the sink definition and use a real sink connector
  2. Rebuild/run with madsim only when intentionally testing in simulation
  3. If testing, run under a test or madsim-compiled binary

Example fix

// before
CREATE SINK s INTO test_sink WITH (connector = 'test');
// after
CREATE SINK s INTO kafka_sink WITH (connector = 'kafka', ...);
Defensive patterns

Strategy: validation

Validate before calling

if (connector === 'test' && !isTestBuild) throw new Error('test sink only allowed in test builds')

Try / catch

catch (SinkError::Config(e)) { reject DDL and surface message to user }

Prevention

When it happens

Trigger: Creating a sink with connector='test' (blackhole test sink) in a release/non-madsim build via CREATE SINK or SinkParam::try_from.

Common situations: Developer accidentally leaves connector='test' in a production DDL; e2e tooling referencing test sink against a release binary.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/ee4b02139fac70c6. Report an issue: GitHub.

Appendix: source

Thrown at src/connector/src/sink/test_sink.rs:52

type BuildBoxLogSinker = Box<dyn BuildBoxLogSinkerTrait>;
type BuildSinkCoordinator = Box<dyn BuildSinkCoordinatorTrait>;
pub const TEST_SINK_NAME: &str = "test";

#[derive(Debug)]
pub struct TestSink {
    param: SinkParam,
}

impl EnforceSecret for TestSink {}

impl TryFrom<SinkParam> for TestSink {
    type Error = SinkError;

    fn try_from(param: SinkParam) -> Result<Self, Self::Error> {
        if cfg!(any(madsim, test)) {
            Ok(TestSink { param })
        } else {
            Err(SinkError::Config(anyhow!("test sink only support in test")))
        }
    }
}

impl Sink for TestSink {
    type LogSinker = BoxLogSinker;

    const SINK_NAME: &'static str = "test";

    fn support_schema_change() -> bool {
        true
    }

    async fn validate(&self) -> crate::sink::Result<()> {
        Ok(())
    }

    async fn new_log_sinker(

View on GitHub (pinned to 6469eb736d)