Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deadline): DocumentDB engine version support upgraded upto v5.0 #1155

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/aws-rfdk/lib/deadline/lib/database-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface DocDBConnectionOptions {

/**
* The Document DB Cluster this connection is for.
* Note: Deadline officially supports only databases that are compatible with MongoDB 3.6.
* Note: Deadline officially supports only databases that are compatible with MongoDB 3.6, 4.0, 5.0.
*/
readonly database: IDatabaseCluster;

Expand All @@ -63,7 +63,7 @@ export interface DocDBConnectionOptions {
export interface MongoDbInstanceConnectionOptions {
/**
* The MongoDB database to connect to.
* Note: Deadline officially supports only databases that are compatible with MongoDB 3.6.
* Note: Deadline officially supports only databases that are compatible with MongoDB 3.6, 4.0, 5.0.
*/
readonly database: IMongoDb;

Expand All @@ -85,7 +85,7 @@ export interface MongoDbInstanceConnectionOptions {
export abstract class DatabaseConnection {
/**
* Creates a DatabaseConnection which allows Deadline to connect to Amazon DocumentDB.
* Note: Deadline officially supports only databases that are compatible with MongoDB 3.6.
* Note: Deadline officially supports only databases that are compatible with MongoDB 3.6, 4.0, 5.0.
*
* Resources Deployed
* ------------------------
Expand All @@ -97,7 +97,7 @@ export abstract class DatabaseConnection {

/**
* Creates a DatabaseConnection which allows Deadline to connect to MongoDB.
* Note: Deadline officially supports only databases that are compatible with MongoDB 3.6.
* Note: Deadline officially supports only databases that are compatible with MongoDB 3.6, 4.0, 5.0.
*
* Resources Deployed
* ------------------------
Expand Down Expand Up @@ -188,7 +188,7 @@ class DocDBDatabaseConnection extends DatabaseConnection {
super();

if (!this.isCompatibleDocDBVersion()) {
Annotations.of(props.database).addError('engineVersion must be 3.6.0 to be compatible with Deadline');
Annotations.of(props.database).addError('engineVersion must be one of 3.6.0, 4.0.0 or 5.0.0 to be compatible with Deadline');
}

this.containerEnvironment = {
Expand Down Expand Up @@ -326,7 +326,7 @@ class DocDBDatabaseConnection extends DatabaseConnection {
}

/**
* Deadline is only compatible with MongoDB 3.6. This function attempts to determine whether
* Deadline is compatible with MongoDB 3.6, 4.0 and 5.0. This function attempts to determine whether
* the given DocDB version is compatible.
*/
protected isCompatibleDocDBVersion(): boolean {
Expand All @@ -335,7 +335,7 @@ class DocDBDatabaseConnection extends DatabaseConnection {
// checking the value of the engineVersion property of that object.
if (this.props.database.node.defaultChild) {
const cluster = this.props.database.node.defaultChild! as CfnDBCluster;
return cluster.engineVersion?.startsWith('3.6') ?? false;
return ( cluster.engineVersion?.startsWith('3.6') || cluster.engineVersion?.startsWith('4.0') || cluster.engineVersion?.startsWith('5.0') )?? false;
sakshie95 marked this conversation as resolved.
Show resolved Hide resolved
}

return true; // No information, assume it's compatible.
Expand Down
33 changes: 1 addition & 32 deletions packages/aws-rfdk/lib/deadline/test/database-connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,38 +436,7 @@ describe('DocumentDB Version Checks', () => {
// THEN
Annotations.fromStack(stack).hasError(
`/${database.node.path}`,
'engineVersion must be 3.6.0 to be compatible with Deadline',
);
});

test('engineVersion not 3.6.0', () => {
// GIVEN
const database = new DatabaseCluster(stack, 'DbCluster', {
masterUser: {
username: 'master',
},
instanceType: InstanceType.of(
InstanceClass.R5,
InstanceSize.XLARGE,
),
vpc,
vpcSubnets: {
onePerAz: true,
subnetType: SubnetType.PRIVATE_WITH_EGRESS,
},
backup: {
retention: Duration.days(15),
},
engineVersion: '4.0.0',
});

// WHEN
DatabaseConnection.forDocDB({database, login: database.secret!});

// THEN
Annotations.fromStack(stack).hasError(
`/${database.node.path}`,
'engineVersion must be 3.6.0 to be compatible with Deadline',
'engineVersion must be one of 3.6.0, 4.0.0 or 5.0.0 to be compatible with Deadline',
);
});
});
Expand Down