CI/CD - CodeBuild + CodeDeploy + CodePipeline
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import {describe, expect, test} from 'vitest'
|
||||
import {dataExplorerKind, dataExplorerPath} from './dataExplorer'
|
||||
import type {CloudResource} from '@/types/resource'
|
||||
|
||||
function rdsInstance(engine: string): CloudResource {
|
||||
return {
|
||||
id: 'orders-db',
|
||||
name: 'orders-db',
|
||||
cloud: 'aws',
|
||||
service: 'database',
|
||||
type: 'db-instance',
|
||||
region: 'us-east-1',
|
||||
createdAt: null,
|
||||
engine,
|
||||
metadata: {},
|
||||
}
|
||||
}
|
||||
|
||||
describe('dataExplorerPath', () => {
|
||||
test('enables the SQL explorer for PostgreSQL and MySQL RDS instances', () => {
|
||||
expect(dataExplorerKind(rdsInstance('postgres'))).toBe('sql')
|
||||
expect(dataExplorerPath(rdsInstance('mysql'))).toBe('/cloud-explorer/aws/database/orders-db/data')
|
||||
})
|
||||
|
||||
test('does not expose unsupported RDS engines as SQL explorers', () => {
|
||||
expect(dataExplorerKind(rdsInstance('mariadb'))).toBeUndefined()
|
||||
})
|
||||
})
|
||||
@@ -5,6 +5,8 @@ export function dataExplorerKind(resource: CloudResource): 'dynamodb' | 'cosmos'
|
||||
if (resource.cloud === 'azure' && resource.service === 'nosql' && resource.type === 'cosmos-database') return 'cosmos'
|
||||
if (resource.cloud === 'azure' && resource.service === 'database' &&
|
||||
(resource.type === 'sql-server' || resource.type === 'postgres-flexible-server')) return 'sql'
|
||||
if (resource.cloud === 'aws' && resource.service === 'database' && resource.type === 'db-instance' &&
|
||||
(resource.engine === 'postgres' || resource.engine === 'mysql')) return 'sql'
|
||||
}
|
||||
|
||||
export function dataExplorerPath(resource: CloudResource): string | undefined {
|
||||
|
||||
Reference in New Issue
Block a user