Skip to content

Commit

Permalink
Merge branch 'main' into interface-endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 26, 2024
2 parents 04b3033 + 55473c8 commit 2a1b3fa
Show file tree
Hide file tree
Showing 18 changed files with 192 additions and 61 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.v2.alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.171.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.170.0-alpha.0...v2.171.0-alpha.0) (2024-11-25)

## [2.170.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.169.0-alpha.0...v2.170.0-alpha.0) (2024-11-22)

## [2.169.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.168.0-alpha.0...v2.169.0-alpha.0) (2024-11-21)
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.171.0](https://github.com/aws/aws-cdk/compare/v2.170.0...v2.171.0) (2024-11-25)


### Features

* **rds:** enhanced monitoring configuration at the cluster level ([#32157](https://github.com/aws/aws-cdk/issues/32157)) ([01f2dcd](https://github.com/aws/aws-cdk/commit/01f2dcd6fb892905afae735c791ddbb3e6adbcb1)), closes [#32151](https://github.com/aws/aws-cdk/issues/32151)
* **rds:** support zero ACU for Aurora Serverless V2 ([#32231](https://github.com/aws/aws-cdk/issues/32231)) ([d1b07d9](https://github.com/aws/aws-cdk/commit/d1b07d9aeadab65db5672272050e64672e7d6beb))


### Bug Fixes

* **cli:** sso with proxy fails ([#32261](https://github.com/aws/aws-cdk/issues/32261)) ([bedcf16](https://github.com/aws/aws-cdk/commit/bedcf164a2b7cbd613ac645d477302c93ddfa4b6))

## [2.170.0](https://github.com/aws/aws-cdk/compare/v2.169.0...v2.170.0) (2024-11-22)


Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cloudformation-diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"license": "Apache-2.0",
"dependencies": {
"@aws-cdk/aws-service-spec": "^0.1.34",
"@aws-cdk/service-spec-types": "^0.0.101",
"@aws-cdk/aws-service-spec": "^0.1.35",
"@aws-cdk/service-spec-types": "^0.0.102",
"chalk": "^4",
"diff": "^5.2.0",
"fast-deep-equal": "^3.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/integ-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@aws-cdk/cloud-assembly-schema": "^38.0.0",
"@aws-cdk/cloudformation-diff": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
"@aws-cdk/aws-service-spec": "^0.1.34",
"@aws-cdk/aws-service-spec": "^0.1.35",
"cdk-assets": "3.0.0-rc.32",
"@aws-cdk/cdk-cli-wrapper": "0.0.0",
"aws-cdk": "0.0.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/aws-cdk-lib/aws-lambda-event-sources/lib/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export interface BaseStreamEventSourceProps{
readonly provisionedPollerConfig?: ProvisionedPollerConfig;
}

/**
* (Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source.
*/
export interface ProvisionedPollerConfig {
/**
* The minimum number of pollers that should be provisioned.
Expand Down
3 changes: 3 additions & 0 deletions packages/aws-cdk-lib/aws-lambda/lib/event-source-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export interface SourceAccessConfiguration {
readonly uri: string;
}

/**
* (Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source.
*/
export interface ProvisionedPollerConfig {
/**
* The minimum number of pollers that should be provisioned.
Expand Down
2 changes: 2 additions & 0 deletions packages/aws-cdk-lib/aws-rds/lib/instance-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,8 @@ export class MysqlEngineVersion {
public static readonly VER_8_0_39 = MysqlEngineVersion.of('8.0.39', '8.0');
/** Version "8.0.40". */
public static readonly VER_8_0_40 = MysqlEngineVersion.of('8.0.40', '8.0');
/** Version "8.4.3". */
public static readonly VER_8_4_3 = MysqlEngineVersion.of('8.4.3', '8.0');

/**
* Create a new MysqlEngineVersion with an arbitrary version.
Expand Down
12 changes: 0 additions & 12 deletions packages/aws-cdk-lib/awslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,18 +405,6 @@
"docs-public-apis:aws-cdk-lib.aws_lambda_event_sources.S3EventSource.bucket",
"docs-public-apis:aws-cdk-lib.aws_lambda_event_sources.SnsEventSource.topic",
"docs-public-apis:aws-cdk-lib.aws_lambda_event_sources.SqsEventSource.queue",
"docs-public-apis:aws-cdk-lib.aws_lambda.EventSourceMappingOptions.provisionedPollerConfig",
"props-default-doc:aws-cdk-lib.aws_lambda.EventSourceMappingOptions.provisionedPollerConfig",
"docs-public-apis:aws-cdk-lib.aws_lambda.ProvisionedPollerConfig",
"docs-public-apis:aws-cdk-lib.aws_lambda.ProvisionedPollerConfig.maximumPollers",
"docs-public-apis:aws-cdk-lib.aws_lambda.ProvisionedPollerConfig.minimumPollers",
"props-default-doc:aws-cdk-lib.aws_lambda.ProvisionedPollerConfig.maximumPollers",
"props-default-doc:aws-cdk-lib.aws_lambda.ProvisionedPollerConfig.minimumPollers",
"docs-public-apis:aws-cdk-lib.aws_lambda_event_sources.KafkaEventSourceProps.provisionedPollerConfig",
"props-default-doc:aws-cdk-lib.aws_lambda_event_sources.KafkaEventSourceProps.provisionedPollerConfig",
"docs-public-apis:aws-cdk-lib.aws_lambda_event_sources.ProvisionedPollerConfig",
"docs-public-apis:aws-cdk-lib.aws_lambda_event_sources.ProvisionedPollerConfig.maximumPollers",
"docs-public-apis:aws-cdk-lib.aws_lambda_event_sources.ProvisionedPollerConfig.minimumPollers",
"docs-public-apis:aws-cdk-lib.aws_logs.CrossAccountDestination.addToPolicy",
"docs-public-apis:aws-cdk-lib.aws_logs.DataIdentifier.*",
"docs-public-apis:aws-cdk-lib.aws_logs.JsonPattern.jsonPatternString",
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"mime-types": "^2.1.35"
},
"devDependencies": {
"@aws-cdk/aws-service-spec": "^0.1.34",
"@aws-cdk/aws-service-spec": "^0.1.35",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/custom-resource-handlers": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/aws-cdk/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ module.exports = {

// We have many tests here that commonly time out
testTimeout: 30_000,
// These tests are too chatty. Shush.
silent: true,
setupFilesAfterEnv: ["<rootDir>/test/jest-setup-after-env.ts"],
};
10 changes: 3 additions & 7 deletions packages/aws-cdk/lib/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,9 @@ async function initializeProject(
if (migrate) {
await template.addMigrateContext(workDir);
}
if (await fs.pathExists('README.md')) {
const readme = await fs.readFile('README.md', { encoding: 'utf-8' });
// Save the logs!
// Without this statement, the readme of the CLI is printed in every init test
if (!readme.startsWith('# AWS CDK Toolkit')) {
print(chalk.green(readme));
}
if (await fs.pathExists(`${workDir}/README.md`)) {
const readme = await fs.readFile(`${workDir}/README.md`, { encoding: 'utf-8' });
print(chalk.green(readme));
}

if (!generateOnly) {
Expand Down
18 changes: 18 additions & 0 deletions packages/aws-cdk/test/diff.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { Writable } from 'stream';
import { StringDecoder } from 'string_decoder';
import * as cxschema from '@aws-cdk/cloud-assembly-schema';
Expand All @@ -12,6 +14,22 @@ import { CdkToolkit } from '../lib/cdk-toolkit';
let cloudExecutable: MockCloudExecutable;
let cloudFormation: jest.Mocked<Deployments>;
let toolkit: CdkToolkit;
let oldDir: string;
let tmpDir: string;

beforeAll(() => {
// The toolkit writes and checks for temporary files in the current directory,
// so run these tests in a tempdir so they don't interfere with each other
// and other tests.
oldDir = process.cwd();
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'aws-cdk-test'));
process.chdir(tmpDir);
});

afterAll(() => {
process.chdir(oldDir);
fs.rmSync(tmpDir, { recursive: true, force: true });
});

describe('fixed template', () => {
const templatePath = 'oldTemplate.json';
Expand Down
27 changes: 26 additions & 1 deletion packages/aws-cdk/test/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as os from 'os';
import * as path from 'path';
import * as cxapi from '@aws-cdk/cx-api';
import * as fs from 'fs-extra';
import { availableInitTemplates, cliInit } from '../lib/init';
import { availableInitLanguages, availableInitTemplates, cliInit, printAvailableTemplates } from '../lib/init';

describe('constructs version', () => {
cliTest('create a TypeScript library project', async (workDir) => {
Expand All @@ -17,6 +17,21 @@ describe('constructs version', () => {
expect(await fs.pathExists(path.join(workDir, 'lib'))).toBeTruthy();
});

cliTest('asking for a nonexistent template fails', async (workDir) => {
await expect(cliInit({
type: 'banana',
language: 'typescript',
workDir,
})).rejects.toThrow(/Unknown init template/);
});

cliTest('asking for a template but no language prints and throws', async (workDir) => {
await expect(cliInit({
type: 'app',
workDir,
})).rejects.toThrow(/No language/);
});

cliTest('create a TypeScript app project', async (workDir) => {
await cliInit({
type: 'app',
Expand Down Expand Up @@ -237,6 +252,16 @@ test('when no version number is present (e.g., local development), the v2 templa
expect((await availableInitTemplates()).length).toBeGreaterThan(0);
});

test('check available init languages', async () => {
const langs = await availableInitLanguages();
expect(langs.length).toBeGreaterThan(0);
expect(langs).toContain('typescript');
});

test('exercise printing available templates', async () => {
await printAvailableTemplates();
});

function cliTest(name: string, handler: (dir: string) => void | Promise<any>): void {
test(name, () => withTempDir(handler));
}
Expand Down
85 changes: 85 additions & 0 deletions packages/aws-cdk/test/jest-setup-after-env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { isPromise } from 'util/types';

/**
* Global test setup for Jest tests
*
* It's easy to accidentally write tests that interfere with each other by
* writing files to disk in the "current directory". To prevent this, the global
* test setup creates a directory in the temporary directory and chmods it to
* being non-writable. That way, whenever a test tries to write to the current
* directory, it will produce an error and we'll be able to find and fix the
* test.
*
* If you see `EACCES: permission denied`, you have a test that creates files
* in the current directory, and you should be sure to do it in a temporary
* directory that you clean up afterwards.
*
* ## Alternate approach
*
* I tried an approach where I would automatically try to create and clean up
* temp directories for every test, but it was introducing too many conflicts
* with existing test behavior (around specific ordering of temp directory
* creation and cleanup tasks that are already present) in many places that I
* didn't want to go and chase down.
*
*/

let tmpDir: string;
let oldDir: string;

beforeAll(() => {
tmpDir = path.join(os.tmpdir(), 'cdk-nonwritable-on-purpose');
fs.mkdirSync(tmpDir, { recursive: true });
fs.chmodSync(tmpDir, 0o500);
oldDir = process.cwd();
process.chdir(tmpDir);
tmpDir = process.cwd(); // This will have resolved symlinks
});

const reverseAfterAll: Array<jest.ProvidesHookCallback> = [];

/**
* We need a cleanup here
*
* 99% of the time, Jest runs the tests in a subprocess and this isn't
* necessary because we would have `chdir`ed in the subprocess.
*
* But sometimes we ask Jest with `-i` to run the tests in the main process,
* or if you only ask for a single test suite Jest runs the tests in the main
* process, and then we `chdir`ed the main process away.
*
* Jest will then try to write the `coverage` directory to the readonly directory,
* and fail. Chdir back to the original dir.
*
* If the test file has an `afterAll()` hook it installed as well, we need to run
* it before our cleanup, otherwise the wrong thing will happen (by default,
* all `afterAll()`s run in call order, but they should be run in reverse).
*/
afterAll(async () => {
for (const aft of reverseAfterAll.reverse()) {
await new Promise<void>((resolve, reject) => {
const response = aft(resolve as any);
if (isPromise(response)) {
response.then(() => { return resolve(); }, reject);
} else {
resolve();
}
});
}

// eslint-disable-next-line no-console
process.stderr.write(`${process.cwd()}, ${tmpDir}\n`);
if (process.cwd() === tmpDir) {
// eslint-disable-next-line no-console
process.stderr.write('chmod\n');
process.chdir(oldDir);
}
});

// Patch afterAll to make later-provided afterAll's run before us (in reverse order even).
afterAll = (after: jest.ProvidesHookCallback) => {
reverseAfterAll.push(after);
};
23 changes: 10 additions & 13 deletions packages/aws-cdk/test/notices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,23 +455,20 @@ describe(CachedDataSource, () => {
});

test('retrieves data from the delegate when the file cannot be read', async () => {
const debugSpy = jest.spyOn(logging, 'debug');
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cdk-test'));
try {
const debugSpy = jest.spyOn(logging, 'debug');

if (fs.existsSync('does-not-exist.json')) {
fs.unlinkSync('does-not-exist.json');
}

const dataSource = dataSourceWithDelegateReturning(freshData, 'does-not-exist.json');
const dataSource = dataSourceWithDelegateReturning(freshData, `${tmpDir}/does-not-exist.json`);

const notices = await dataSource.fetch();

expect(notices).toEqual(freshData);
expect(debugSpy).not.toHaveBeenCalled();
const notices = await dataSource.fetch();

debugSpy.mockRestore();
expect(notices).toEqual(freshData);
expect(debugSpy).not.toHaveBeenCalled();

if (fs.existsSync('does-not-exist.json')) {
fs.unlinkSync('does-not-exist.json');
debugSpy.mockRestore();
} finally {
fs.rmSync(tmpDir, { recursive: true, force: true });
}
});

Expand Down
6 changes: 3 additions & 3 deletions tools/@aws-cdk/spec2cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
},
"license": "Apache-2.0",
"dependencies": {
"@aws-cdk/aws-service-spec": "^0.1.34",
"@aws-cdk/service-spec-importers": "^0.0.56",
"@aws-cdk/service-spec-types": "^0.0.101",
"@aws-cdk/aws-service-spec": "^0.1.35",
"@aws-cdk/service-spec-importers": "^0.0.57",
"@aws-cdk/service-spec-types": "^0.0.102",
"@cdklabs/tskb": "^0.0.3",
"@cdklabs/typewriter": "^0.0.3",
"camelcase": "^6",
Expand Down
4 changes: 2 additions & 2 deletions version.v2.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.170.0",
"alphaVersion": "2.170.0-alpha.0"
"version": "2.171.0",
"alphaVersion": "2.171.0-alpha.0"
}
Loading

0 comments on commit 2a1b3fa

Please sign in to comment.