{"record":{"id":"54e4a63a29858cb5","repo":"risingwavelabs/risingwave","slug":"test-source-only-available-at-test","errorCode":null,"errorMessage":"test source only available at test","messagePattern":"test source only available at test","errorType":"exception","errorClass":"ConnectorError","httpStatus":null,"severity":"error","filePath":"src/connector/src/source/test_source.rs","lineNumber":137,"sourceCode":"\npub const TEST_CONNECTOR: &str = \"test\";\n\n#[derive(Clone, Debug, Default, WithOptions)]\npub struct TestSourceProperties {\n    properties: BTreeMap<String, String>,\n}\n\nimpl EnforceSecret for TestSourceProperties {}\n\nimpl TryFromBTreeMap for TestSourceProperties {\n    fn try_from_btreemap(\n        props: BTreeMap<String, String>,\n        _deny_unknown_fields: bool,\n    ) -> ConnectorResult<Self> {\n        if cfg!(any(madsim, test)) {\n            Ok(TestSourceProperties { properties: props })\n        } else {\n            bail!(\"test source only available at test\")\n        }\n    }\n}\n\n#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]\npub struct TestSourceSplit {\n    pub id: SplitId,\n    pub properties: HashMap<String, String>,\n    pub offset: String,\n}\n\nimpl SplitMetaData for TestSourceSplit {\n    fn id(&self) -> SplitId {\n        self.id.clone()\n    }\n\n    fn encode_to_json(&self) -> JsonbVal {\n        serde_json::to_value(self.clone()).unwrap().into()","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/source/test_source.rs#L119-L155","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nWITH (connector = 'test')\n// after\nWITH (connector = 'kafka', properties.bootstrap.server = '...', topic = '...')","handlingStrategy":"validation","validationCode":"if (!process.env.RW_TEST_MODE && connector === 'test') {\n  throw new Error(\"connector 'test' is only available in test builds\");\n}","typeGuard":"const isTestConnectorAllowed = () => typeof __TEST_BUILD__ !== 'undefined' && __TEST_BUILD__;","tryCatchPattern":"try { createSource({connector:'test'}); } catch (e) { if (String(e).includes('test source only available at test')) { useRealConnectorInstead(); } else { throw e; } }","preventionTips":["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"],"tags":["test-only","compile-time","connector"],"backgroundTag":"feature-not-enabled","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}