Files
Jordan McQueen fa1e4c4bbf feat(studio): add ClickHouse replication destination (#46870)
Adds ClickHouse as a replication destination type in Studio.

- New ClickHouse option in the destination type selector, gated behind
the
`etlEnableClickHousePrivateAlpha` organization feature flag (off by
default).
- ClickHouse settings form: URL, user, password (optional), database,
and
  - Client-side URL validation requires HTTPS and rejects URLs targeting
    internal addresses (loopback, RFC 1918, link-local, CGNAT, IPv6
    loopback/link-local/ULA, and IPv4-mapped/NAT64 forms). Server-side
    validation remains authoritative.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## New Features
- Added **ClickHouse** as a replication destination option (private
alpha), including support in destination selection/panel, replication
diagram rendering, and destination icons.
- Introduced a ClickHouse destination form with fields for URL, user,
optional password (masked toggle), database, and engine selection.
- Added ClickHouse destination config handling for create/update flows,
with normalization and engine support.

## Tests
- Expanded unit tests to cover ClickHouse validation and destination
config building/normalization, including HTTPS-only and blocking
localhost/internal targets.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-07-20 12:09:13 +08:00

31 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { getReplicationDestinationType } from './Nodes.utils'
describe('getReplicationDestinationType', () => {
it('returns BigQuery for big_query configs', () => {
expect(getReplicationDestinationType({ big_query: {} })).toBe('BigQuery')
})
it('returns Analytics Bucket for iceberg configs', () => {
expect(getReplicationDestinationType({ iceberg: {} })).toBe('Analytics Bucket')
})
it('returns DuckLake for ducklake configs', () => {
expect(getReplicationDestinationType({ ducklake: {} })).toBe('DuckLake')
})
it('returns Snowflake for snowflake configs', () => {
expect(getReplicationDestinationType({ snowflake: {} })).toBe('Snowflake')
})
it('returns ClickHouse for clickhouse configs', () => {
expect(getReplicationDestinationType({ clickhouse: {} })).toBe('ClickHouse')
})
it('returns undefined for unknown or missing configs', () => {
expect(getReplicationDestinationType({})).toBeUndefined()
expect(getReplicationDestinationType(undefined)).toBeUndefined()
})
})