mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-12 10:19:09 +00:00
FIX: update connectionTestListSchemas to derive references from engine allowlist
This commit is contained in:
@@ -65,7 +65,7 @@ describe('ConnectionTestService catalog cache', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('maps cached columns to the existing table metadata contract', async () => {
|
||||
it('maps cached columns and derives references from the engine allowlist', async () => {
|
||||
connectionsApiService.proxy.mockResolvedValue({
|
||||
columns: [
|
||||
{
|
||||
@@ -73,6 +73,16 @@ describe('ConnectionTestService catalog cache', () => {
|
||||
data_type: 'bigint',
|
||||
is_primary_key: true,
|
||||
},
|
||||
{
|
||||
column_name: 'name',
|
||||
data_type: 'varchar',
|
||||
is_primary_key: false,
|
||||
},
|
||||
],
|
||||
});
|
||||
platformApiService.proxy.mockResolvedValue({
|
||||
allowed_datatypes: [
|
||||
{ engine: 'postgresql', allowed_datatypes: ['bigint', 'timestamp'] },
|
||||
],
|
||||
});
|
||||
|
||||
@@ -92,13 +102,10 @@ describe('ConnectionTestService catalog cache', () => {
|
||||
{
|
||||
table_name: 'customers',
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
type: 'bigint',
|
||||
is_primary_key: true,
|
||||
},
|
||||
{ name: 'id', type: 'bigint', is_primary_key: true },
|
||||
{ name: 'name', type: 'varchar', is_primary_key: false },
|
||||
],
|
||||
references: [],
|
||||
references: [{ name: 'id', type: 'bigint', is_primary_key: true }],
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -107,6 +114,39 @@ describe('ConnectionTestService catalog cache', () => {
|
||||
'/connection_catalog/config-id/schemas/public/tables/customers/columns',
|
||||
user,
|
||||
);
|
||||
expect(platformApiService.proxy).toHaveBeenCalledWith(
|
||||
'GET',
|
||||
'/jobs/jdbc/configs/allowed_datatypes',
|
||||
user,
|
||||
);
|
||||
});
|
||||
|
||||
it('returns empty references when the allowlist call fails', async () => {
|
||||
connectionsApiService.proxy.mockResolvedValue({
|
||||
columns: [{ column_name: 'id', data_type: 'bigint', is_primary_key: true }],
|
||||
});
|
||||
platformApiService.proxy.mockRejectedValue(new Error('platform down'));
|
||||
|
||||
await expect(
|
||||
service.getTableMetadata(
|
||||
{
|
||||
connection_id: 'config-id',
|
||||
plugin: 'postgresql',
|
||||
schema: 'public',
|
||||
table_list: ['customers'],
|
||||
},
|
||||
user,
|
||||
),
|
||||
).resolves.toEqual({
|
||||
operation_result: true,
|
||||
tables_metadata: [
|
||||
{
|
||||
table_name: 'customers',
|
||||
columns: [{ name: 'id', type: 'bigint', is_primary_key: true }],
|
||||
references: [],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('submits a catalog refresh without holding the request open', async () => {
|
||||
|
||||
Reference in New Issue
Block a user