mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
* test: move compatibility tests into this repo * fix: add StatisticValues parsing to CloudWatchMetricsJsonHandler * fix: add missing required abstract methods to EmulatorConfig in EventBridgeSchedulerIntegrationTest * test: add sdk tests for multipart S3 copy coverage * fix: cover and fix smithy cbor and multipart s3 copy regressions * test: migrate more test coverage to new folder * test: add missing ec2 expectation in healthcheck test * docs: update READMEs in `./compatibility-tests`
68 lines
2.6 KiB
TypeScript
68 lines
2.6 KiB
TypeScript
import * as cdk from 'aws-cdk-lib';
|
|
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
|
|
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
|
|
import { Construct } from 'constructs';
|
|
|
|
export class FlociTestStack extends cdk.Stack {
|
|
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
super(scope, id, props);
|
|
|
|
const bucket = new s3.Bucket(this, 'TestBucket', {
|
|
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
});
|
|
|
|
const queue = new sqs.Queue(this, 'TestQueue', {
|
|
queueName: 'floci-cdk-test-queue',
|
|
visibilityTimeout: cdk.Duration.seconds(30),
|
|
});
|
|
|
|
const table = new dynamodb.TableV2(this, 'TestTable', {
|
|
tableName: 'floci-cdk-test-table',
|
|
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
});
|
|
|
|
// DynamoDB table with GSI and LSI — validates CloudFormation index provisioning
|
|
const indexTable = new dynamodb.TableV2(this, 'IndexTestTable', {
|
|
tableName: 'floci-cdk-index-table',
|
|
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
sortKey: { name: 'sk', type: dynamodb.AttributeType.STRING },
|
|
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
globalSecondaryIndexes: [
|
|
{
|
|
indexName: 'gsi-1',
|
|
partitionKey: { name: 'gsiPk', type: dynamodb.AttributeType.STRING },
|
|
sortKey: { name: 'sk', type: dynamodb.AttributeType.STRING },
|
|
projectionType: dynamodb.ProjectionType.ALL,
|
|
},
|
|
],
|
|
localSecondaryIndexes: [
|
|
{
|
|
indexName: 'lsi-1',
|
|
sortKey: { name: 'lsiSk', type: dynamodb.AttributeType.STRING },
|
|
projectionType: dynamodb.ProjectionType.KEYS_ONLY,
|
|
},
|
|
],
|
|
});
|
|
|
|
const generatedSecret = new secretsmanager.CfnSecret(this, 'GeneratedSecret', {
|
|
name: 'floci-cdk-generated-secret',
|
|
generateSecretString: {
|
|
secretStringTemplate: '{"username":"admin"}',
|
|
generateStringKey: 'password',
|
|
passwordLength: 24,
|
|
excludeCharacters: 'abc',
|
|
},
|
|
});
|
|
generatedSecret.applyRemovalPolicy(cdk.RemovalPolicy.DESTROY);
|
|
|
|
new cdk.CfnOutput(this, 'BucketName', { value: bucket.bucketName });
|
|
new cdk.CfnOutput(this, 'QueueUrl', { value: queue.queueUrl });
|
|
new cdk.CfnOutput(this, 'TableName', { value: table.tableName });
|
|
new cdk.CfnOutput(this, 'IndexTableName', { value: indexTable.tableName });
|
|
new cdk.CfnOutput(this, 'GeneratedSecretName', { value: generatedSecret.name || 'floci-cdk-generated-secret' });
|
|
}
|
|
}
|