Skip to content

Commit

Permalink
feat: add commands for dynamic update feature, add skipUnwrap for cre…
Browse files Browse the repository at this point in the history
…ateJobDefinitionRequest

cr https://code.amazon.com/reviews/CR-32612894
  • Loading branch information
Rajkushal Ananthkumar authored and RonWang committed Sep 18, 2020
1 parent 6e838e8 commit 7d53461
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/commands/smapi/customizations/parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,9 @@
},
"sslCertificatePayload": {
"skipUnwrap": true
},
"createJobDefinitionRequest": {
"skipUnwrap": true,
"name": "jobDefinition"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dependencies": {
"adm-zip": "^0.4.13",
"archiver": "^1.1.0",
"ask-smapi-model": "1.10.1",
"ask-smapi-model": "1.12.0",
"ask-smapi-sdk": "^1.2.0",
"async": "^2.1.5",
"aws-profile-handler": "2.0.3",
Expand Down
55 changes: 55 additions & 0 deletions test/integration/commands/smapi-commands-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const inSkillProductRequestBody = require('@test/integration/fixtures/create-in-
const accountLinkingRequest = require('@test/integration/fixtures/account-linking-request.json');
const interactionModel = require('@test/integration/fixtures/interaction-model.json');
const annotationSet = require('@test/integration/fixtures/annotation-set.json');
const jobDefinition = require('@test/integration/fixtures/job-definition.json');

parallel.limit(8);

Expand Down Expand Up @@ -52,6 +53,9 @@ parallel('smapi command test', () => {
const subscriberId = 'someSubscriberId';
const subscriptionId = 'someSubscriptionId';
const updateRequestId = 'someUpdateRequestId';
const imJobId = 'someIMJobId';
const imJobStatus = 'imJobStatus';
const imExecutionId = 'imExecutionId';
const version = '2.0.0';
const targetVersion = '7';
const rollbackRequestId = 'someRollbackRequestId';
Expand All @@ -64,6 +68,7 @@ parallel('smapi command test', () => {
const contentType = 'application/json';
const annotationSetId = 'someAnnotationSetId';
const updateNluAnnotationSetAnnotationsRequest = JSON.stringify(annotationSet);
const interactionModelJobDefinition = JSON.stringify(jobDefinition);
const annotations = JSON.stringify(
[
{
Expand Down Expand Up @@ -1152,6 +1157,56 @@ parallel('smapi command test', () => {
expect(result).be.an('object');
});

it('| should list all the job defintions for IM', async () => {
const args = [subCmd, 'list-job-definitions-for-interaction-model'];
addCoveredCommand(args);
const result = await run(cmd, args, options);
expect(result).be.an('object');
});

it('| should create job definition for IM', async () => {
const args = [subCmd, 'create-job-definition-for-interaction-model',
'--job-definition', interactionModelJobDefinition];
addCoveredCommand(args);
const result = await run(cmd, args, options);
expect(result).be.an('object');
});

it('| should get job definition for IM', async () => {
const args = [subCmd, 'get-job-definition-for-interaction-model', '--job-id', imJobId];
addCoveredCommand(args);
const result = await run(cmd, args, options);
expect(result).be.an('object');
});

it('| should delete job definition for IM', async () => {
const args = [subCmd, 'delete-job-definition-for-interaction-model', '--job-id', imJobId];
addCoveredCommand(args);
const result = await run(cmd, args, { ...options, parse: false });
expect(result).include('Command executed successfully!');
});

it('| should set job status for IM', async () => {
const args = [subCmd, 'set-job-status-for-interaction-model', '--job-id', imJobId, '--status', imJobStatus];
addCoveredCommand(args);
const result = await run(cmd, args, { ...options, parse: false });
expect(result).include('Command executed successfully!');
});

it('| should list all the job executions for IM', async () => {
const args = [subCmd, 'list-job-executions-for-interaction-model', '--job-id', imJobId];
addCoveredCommand(args);
const result = await run(cmd, args, options);
expect(result).be.an('object');
});

it('| should cancel next job execution for IMJob', async () => {
const args = [subCmd, 'cancel-next-job-execution-for-interaction-model', '--job-id', imJobId, '--execution-id', imExecutionId];
addCoveredCommand(args);
const result = await run(cmd, args, { ...options, parse: false });
expect(result).include('Command executed successfully!');
});

after(() => {
mockSmapiServer.kill();
mockLwaServer.kill();
Expand Down
14 changes: 14 additions & 0 deletions test/integration/fixtures/job-definition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"jobDefinition": {
"type": "CatalogAutoRefresh",
"resource": {
"type": "Catalog",
"id": "amzn1.ask.interactionModel.catalog.661c3570-99d8-4b3f-95b7-db8c403a6125"
},
"trigger": {
"type": "Scheduled",
"hour": 4
},
"status": "ENABLED"
}
}

0 comments on commit 7d53461

Please sign in to comment.