risingwavelabs/risingwave · error · ConnectorError
test source only available at test
Error message
test source only available at test
What it means
The test source is a fake connector meant only for unit/e2e tests. Its properties parser intentionally fails with this error when compiled outside test/madsim configurations (cfg!(any(madsim,test)) is false), preventing production binaries from constructing TestSourceProperties.
Source
Thrown at src/connector/src/source/test_source.rs:137
pub const TEST_CONNECTOR: &str = "test";
#[derive(Clone, Debug, Default, WithOptions)]
pub struct TestSourceProperties {
properties: BTreeMap<String, String>,
}
impl EnforceSecret for TestSourceProperties {}
impl TryFromBTreeMap for TestSourceProperties {
fn try_from_btreemap(
props: BTreeMap<String, String>,
_deny_unknown_fields: bool,
) -> ConnectorResult<Self> {
if cfg!(any(madsim, test)) {
Ok(TestSourceProperties { properties: props })
} else {
bail!("test source only available at test")
}
}
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct TestSourceSplit {
pub id: SplitId,
pub properties: HashMap<String, String>,
pub offset: String,
}
impl SplitMetaData for TestSourceSplit {
fn id(&self) -> SplitId {
self.id.clone()
}
fn encode_to_json(&self) -> JsonbVal {
serde_json::to_value(self.clone()).unwrap().into()View on GitHub (pinned to 6469eb736d)
Solutions
- Remove connector='test' from the source definition and use a real connector (kafka, pulsar, etc.)
- Rebuild/run under madsim or test cfg if you genuinely need the test source (i.e. within the test harness)
- Switch to a development profile binary that enables the test source feature
Example fix
// before WITH (connector = 'test') // after WITH (connector = 'kafka', properties.bootstrap.server = '...', topic = '...')
Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.RW_TEST_MODE && connector === 'test') {
throw new Error("connector 'test' is only available in test builds");
} Type guard
const isTestConnectorAllowed = () => typeof __TEST_BUILD__ !== 'undefined' && __TEST_BUILD__;
Try / catch
try { createSource({connector:'test'}); } catch (e) { if (String(e).includes('test source only available at test')) { useRealConnectorInstead(); } else { throw e; } } Prevention
- Never use connector='test' outside the test harness
- Copy test SQL into production only after replacing the test connector
- Keep test fixtures and production DDL in separate files
When it happens
Trigger: Calling TestSourceProperties::try_from_btreemap in a release (non-madsim, non-test) build, e.g. a user attempting `CREATE SOURCE ... WITH connector='test'` against a production risingwave binary.
Common situations: Copy-pasting test SQL from the e2e test suite into a production cluster, or running a debug tool linked against the connector crate in release mode while trying to use the test connector.
Related errors
- Feature `source-{}` is not enabled at compile time. Please e
- You can't use the macro on this type
- Expected #[serde_prefix_all(skip)]
- Unknown source connector: {connector_name}
- No allow_alter_on_fly fields registered for connector: {conn
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/54e4a63a29858cb5.
Report an issue: GitHub.