Files
supabase/apps/studio/components/interfaces/Database/Replication/CreatePipeline/PipelineDestinationReview.test.tsx
Victor FarazdagiandJoshen Lim 00adb5a81b chore(studio): remove the Iceberg pipeline destination (#52229)
## Problem

Retire the deprecated Iceberg (Analytics Bucket) destination from
Pipelines.

## Solution

- Remove the destination UI, configuration mappings, feature-flag usage,
and generated API variants.
- Remove the legacy Pipelines integration from Storage while preserving
standalone Analytics Buckets.
- Remove unused components and sheet-layout support, and add regression
coverage for retained Storage operations.
- Remove the stale Pipelines claim from the Storage docs overview.

## Validation

- Pipelines, Storage, and replication data tests
- After the final cleanup: Studio typecheck and all 3 Analytics Bucket
regression tests passed.
- Formatting, scoped ESLint, Knip, and whitespace checks passed; lint
warnings are pre-existing.
- Storage overview: Prettier, ESLint with zero warnings, content-listing
schema validation, and Markdown rendering passed.

Production API-type verification remains pending the coordinated API
deployment. Legacy Iceberg pipelines, destinations, and slots must be
cleaned up before rollout.

## Review instructions

1. Verify that Pipelines offers BigQuery, DuckLake, Snowflake, and
ClickHouse, with no Analytics Bucket option.
2. Verify that Storage Analytics Bucket creation, namespace/table
operations, and wrapper/key cleanup remain available without Pipelines
controls.

## Checklist

- [x] Read CONTRIBUTING.md.
- [x] Updated the Storage overview copy and checked the docs authoring
guidance.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-11 12:18:04 +03:00

132 lines
5.6 KiB
TypeScript

import { fireEvent, screen } from '@testing-library/react'
import { useForm } from 'react-hook-form'
import { Button } from 'ui'
import { describe, expect, it } from 'vitest'
import type { DestinationPanelSchemaType } from '../DestinationPanel/DestinationForm/DestinationForm.schema'
import type { DestinationType } from '../DestinationPanel/DestinationPanel.types'
import { PipelineDestinationReview } from './PipelineDestinationReview'
import { customRender } from '@/tests/lib/custom-render'
const catalogUrl = 'postgres://user:catalog-password@catalog.example/postgres?token=secret'
const defaults = {
name: 'Analytics',
projectId: 'warehouse-project',
datasetId: 'dataset',
serviceAccountKey: 'private-service-account',
ducklakeMode: 'custom',
ducklakeCatalogUrl: catalogUrl,
ducklakeDataPath: 's3://warehouse/data',
ducklakeS3SecretAccessKey: 'private-s3-key',
ducklakeStorageBucket: 'lake-bucket',
snowflakeAccountId: 'my-account',
snowflakeDatabase: 'warehouse',
snowflakeSchema: 'PUBLIC',
snowflakePrivateKey: 'private-snowflake-key',
clickhouseUrl: 'https://user:password@cluster.example',
clickhouseDatabase: 'events',
clickhouseEngine: 'merge_tree',
clickhousePassword: 'private-password',
} satisfies Partial<DestinationPanelSchemaType>
const TestReview = ({
type,
values = defaults,
}: {
type: DestinationType
values?: Partial<DestinationPanelSchemaType>
}) => {
const form = useForm<DestinationPanelSchemaType>({ defaultValues: values })
return (
<>
<PipelineDestinationReview type={type} control={form.control} />
<Button
onClick={() =>
form.setValue('ducklakeCatalogUrl', 'postgres://new:secret@other.example/db')
}
>
Change URL
</Button>
<Button onClick={() => form.setValue('name', 'Updated name')}>Change name</Button>
</>
)
}
describe('PipelineDestinationReview', () => {
it.each<{ type: DestinationType; details: string[] }>([
{ type: 'BigQuery', details: ['warehouse-project', 'dataset'] },
{ type: 'DuckLake', details: ['s3://warehouse/data'] },
{ type: 'Snowflake', details: ['my-account', 'warehouse', 'PUBLIC'] },
{ type: 'ClickHouse', details: ['events', 'MergeTree'] },
])('shows $type details without credentials', ({ type, details }) => {
const { container } = customRender(<TestReview type={type} />)
expect(screen.getByDisplayValue('Analytics')).toHaveAttribute('readonly')
for (const detail of details) expect(screen.getByDisplayValue(detail)).toBeInTheDocument()
for (const secret of [
'private-service-account',
'private-s3-key',
'private-snowflake-key',
'private-password',
catalogUrl,
defaults.clickhouseUrl,
]) {
expect(container.innerHTML).not.toContain(secret)
}
expect(screen.getByText('Pipeline region')).toBeInTheDocument()
})
it('reveals and hides the entire catalog URL and remasks a changed URL', () => {
const { container } = customRender(<TestReview type="DuckLake" />)
fireEvent.click(screen.getByRole('button', { name: 'Show catalog URL' }))
expect(screen.getByDisplayValue(catalogUrl)).toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'Hide catalog URL' }))
expect(container.innerHTML).not.toContain(catalogUrl)
fireEvent.click(screen.getByRole('button', { name: 'Show catalog URL' }))
fireEvent.click(screen.getByRole('button', { name: 'Change URL' }))
expect(screen.getByRole('button', { name: 'Show catalog URL' })).toBeInTheDocument()
expect(container.innerHTML).not.toContain('new:secret')
})
it('shows Supabase DuckLake bucket details and updates live form values', () => {
customRender(<TestReview type="DuckLake" values={{ ...defaults, ducklakeMode: 'supabase' }} />)
expect(screen.getByDisplayValue('lake-bucket')).toBeInTheDocument()
expect(screen.queryByRole('button', { name: 'Show catalog URL' })).not.toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'Change name' }))
expect(screen.getByDisplayValue('Updated name')).toBeInTheDocument()
})
it('masks a ClickHouse URL containing credentials until explicitly revealed', () => {
const { container } = customRender(<TestReview type="ClickHouse" />)
const button = screen.getByRole('button', { name: 'Show HTTPS endpoint' })
expect(button).toHaveAttribute('type', 'button')
fireEvent.click(button)
expect(screen.getByDisplayValue(defaults.clickhouseUrl)).toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'Hide HTTPS endpoint' }))
expect(container.innerHTML).not.toContain(defaults.clickhouseUrl)
})
it('shows missing values without exposing inactive destination details', () => {
customRender(<TestReview type="BigQuery" values={{ name: 'Analytics' }} />)
expect(screen.getAllByDisplayValue('Not set')).toHaveLength(2)
expect(screen.queryByText('Catalog URL')).not.toBeInTheDocument()
})
})
it('includes custom settings in Connection without a separate heading', () => {
customRender(
<TestReview
type="BigQuery"
values={{ ...defaults, connectionPoolSize: 3, maxStalenessMins: 10 }}
/>
)
expect(screen.getByLabelText('Connection pool size')).toHaveValue('3')
expect(screen.getByLabelText('Maximum staleness')).toHaveValue('10 minutes')
expect(
screen.getByText('Number of BigQuery connections used for destination writes.')
).toBeInTheDocument()
expect(
screen.getByText('Maximum age of BigQuery query results for newly created or recreated tables.')
).toBeInTheDocument()
expect(screen.queryByText('Custom connection settings')).not.toBeInTheDocument()
})