Skip to content

Commit

Permalink
feat(deadline): DocumentDB engine version support upgraded upto versi…
Browse files Browse the repository at this point in the history
…on 5.0 (#1155)

Authored-by: Sakshi <[email protected]>
  • Loading branch information
sakshie95 authored Dec 14, 2023
1 parent 493f561 commit 7905f91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 39 deletions.
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;
}

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 @@ -435,38 +435,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

0 comments on commit 7905f91

Please sign in to comment.