integ/components/deadline/deadline_03_workerFleetHttp/lib/workerFleetHttp-testing-tier.ts (31 lines of code) (raw):
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import * as path from 'path';
import { Port } from 'aws-cdk-lib/aws-ec2';
import { IWorkerFleet } from 'aws-rfdk/deadline';
import { Construct } from 'constructs';
import { TestingTier, TestingTierProps } from '../../../../lib/testing-tier';
import { WorkerStruct } from '../../../../lib/worker-struct';
/**
* Interface for WorkerFleetTestingTier properties
*/
export interface WorkerFleetTestingTierProps extends TestingTierProps {
/**
* Array of WorkerStructs representing different test cases
*/
readonly structs: Array<WorkerStruct>;
}
/**
* Testing Tier for the Deadline WorkerFleet HTTP integration test
*
* Creates a test bastion and configures it to connect to one or more Deadline WorkerInstanceFleet constructs for testing.
*
* Resources Deployed
* ------------------------
* - A BastionLinuxHost instance
*
* Security Considerations
* ------------------------
* - The bastion instance created by this test is configured to access farm resources on their default ports
* Test scripts stored on the bastion are used to submit Deadline jobs to farm workers and request information about the workers.
*/
export class WorkerFleetTestingTier extends TestingTier {
constructor(scope: Construct, id: string, props: WorkerFleetTestingTierProps) {
super(scope, id, props);
const structs = props.structs;
structs.forEach( workerStruct => {
const testSuiteId = 'WF' + (structs.indexOf(workerStruct) + 1).toString();
const renderQueue = workerStruct.renderQueue;
this.configureRenderQueue(testSuiteId, renderQueue);
const workerFleet = workerStruct.workerFleet;
this.configureWorkerFleet(workerFleet);
});
this.configureBastionUserData({
testingScriptPath: path.join(__dirname, '../scripts/bastion/testing'),
});
this.installDeadlineClient();
}
/**
* Configures each worker to allow access from the bastion
*
* @param workerFleet Array of worker instances to connect to the test Bastion
*/
public configureWorkerFleet(workerFleet: Array<IWorkerFleet>) {
workerFleet.forEach( worker => {
this.testInstance.connections.allowTo(worker, Port.tcp(22));
});
}
}