Skip to content

Commit 2581969

Browse files
committed
chore: copy v2 integ tests to v3 (#479)
1 parent 935ab10 commit 2581969

File tree

141 files changed

+4447
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+4447
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pids
55
*.seed
66
*.pid.lock
77
lib-cov
8+
configuration
89
coverage
910
.nyc_output
1011
.grunt

configuration.sample

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"region": "us-east-1",
3+
"stsRegionalEndpoints": "regional",
4+
"s3": {
5+
"params": { "Bucket": "test-s3-bucket" }
6+
},
7+
"dynamodb": {
8+
"params": { "TableName": "aws-sdk-js-integration-test", "BillingMode": "PAY_PER_REQUEST" }
9+
},
10+
"devicefarm": {
11+
"region": "us-west-2"
12+
}
13+
}

features/acm/acm.feature

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# language: en
2+
@acm
3+
Feature:
4+
5+
I want to use AWS Certificate Manager
6+
7+
Scenario: Making a request
8+
Given I run the "listCertificates" operation
9+
Then the request should be successful
10+
And the value at "CertificateSummaryList" should be a list
11+
12+
Scenario: Error handling
13+
Given I run the "describeCertificate" operation with params:
14+
"""
15+
{ "CertificateArn": "fake_arn" }
16+
"""
17+
Then the error code should be "ValidationException"

features/acm/step_definitions/acm.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = function() {
2+
this.Before("@acm", function (callback) {
3+
this.service = new this.AWS.ACM();
4+
callback();
5+
});
6+
7+
// Add step definitions
8+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# language: en
2+
@apigateway
3+
Feature:
4+
5+
I want to use Amazon API Gateway
6+
7+
Scenario: Making a request
8+
Given I run the "getRestApis" operation
9+
Then the request should be successful
10+
And the value at "items" should be a list
11+
12+
Scenario: Error handling
13+
Given I run the "getRestApi" operation with params:
14+
"""
15+
{ "restApiId": "fake_id" }
16+
"""
17+
Then the error code should be "NotFoundException"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = function() {
2+
this.Before("@apigateway", function (callback) {
3+
this.service = new this.AWS.APIGateway();
4+
callback();
5+
});
6+
7+
// Add step definitions
8+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# language: en
2+
@autoscaling
3+
Feature: Auto Scaling
4+
5+
I want to use Auto Scaling
6+
7+
Scenario: Managing auto scaling groups
8+
Given I create a launch configuration with name "launch-config-integ"
9+
And I describe launch configurations
10+
Then the list should contain the launch configuration "launch-config-integ"
11+
And I delete the launch configuration "launch-config-integ"
12+
13+
@pagination
14+
Scenario: Paginating responses
15+
Given I create a launch configuration with name "launch-config-integ-1"
16+
And I create a launch configuration with name "launch-config-integ-2"
17+
And I paginate the "describeLaunchConfigurations" operation with limit 1
18+
Then I should get more than one page
19+
And I should get numPages - 1 markers
20+
And the last page should not contain a marker
21+
And I delete the launch configuration "launch-config-integ-1"
22+
And I delete the launch configuration "launch-config-integ-2"
23+
24+
Scenario: Error handling
25+
Given I create a launch configuration with name ""
26+
Then the error code should be "ValidationError"
27+
And the error message should contain:
28+
"""
29+
Member must have length greater than or equal to 1
30+
"""
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = function() {
2+
this.Before('@autoscaling', function (callback) {
3+
this.service = new this.AWS.AutoScaling();
4+
callback();
5+
});
6+
7+
this.Given(/^I create a launch configuration with name "([^"]*)"$/, function(name, callback) {
8+
var params = {
9+
ImageId: 'ami-1624987f',
10+
InstanceType: 'm1.small',
11+
LaunchConfigurationName: name
12+
};
13+
this.request(null, 'createLaunchConfiguration', params, callback, false);
14+
});
15+
16+
this.Given(/^I describe launch configurations$/, function(callback) {
17+
this.request(null, 'describeLaunchConfigurations', {}, callback);
18+
});
19+
20+
this.Then(/^the list should contain the launch configuration "([^"]*)"$/, function(name, callback) {
21+
this.assert.contains(this.data.LaunchConfigurations, function(configuration) {
22+
return configuration.LaunchConfigurationName === name;
23+
});
24+
callback();
25+
});
26+
27+
this.Then(/^I delete the launch configuration "([^"]*)"$/, function(name, callback) {
28+
var params = {LaunchConfigurationName: name};
29+
this.request(null, 'deleteLaunchConfiguration', params, callback);
30+
});
31+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# language: en
2+
@cloudformation
3+
Feature: AWS CloudFormation
4+
5+
I want to use AWS CloudFormation
6+
7+
Scenario: Describing stacks
8+
Given I run the "describeStacks" operation
9+
Then the request should be successful
10+
And the value at "Stacks" should be a list
11+
12+
Scenario: Error handling
13+
Given I create a CloudFormation stack with name prefix ""
14+
Then the error code should be "ValidationError"
15+
16+
@pagination
17+
Scenario: Paginating responses
18+
Given I paginate the "listStacks" operation
19+
Then I should get at least one page
20+
And the last page should not contain a marker
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = function() {
2+
this.Before("@cloudformation", function (callback) {
3+
this.service = new this.AWS.CloudFormation();
4+
callback();
5+
});
6+
7+
this.Given(/^I create a CloudFormation stack with name prefix "([^"]*)"$/, function(prefix, callback) {
8+
this.stackName = this.uniqueName(prefix);
9+
this.templateBody = '{"Resources":{"member":{"Type":"AWS::SQS::Queue"}}}';
10+
var params = { TemplateBody: this.templateBody, StackName: this.stackName };
11+
this.request(null, 'createStack', params, callback, false);
12+
});
13+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# language: en
2+
@cloudfront
3+
Feature: Amazon CloudFront
4+
5+
I want to use Amazon CloudFront
6+
7+
Scenario: Listing distributions
8+
Given I list CloudFront distributions
9+
Then the result at DistributionList should contain a property Quantity with a number
10+
And the result at DistributionList should contain a property Items with an Array
11+
12+
# Let this fail with NoSuchOrigin to confirm we serialized inputs
13+
# but without creating a distribution.
14+
Scenario: Creating a distribution
15+
Given I create a CloudFront distribution with name prefix "aws-js-sdk"
16+
Then the error code should be "NoSuchOrigin"
17+
And the error message should be:
18+
"""
19+
One or more of your origins or origin groups do not exist.
20+
"""
21+
22+
Scenario: Error handling
23+
Given I create a CloudFront distribution with name prefix ""
24+
Then the error code should be "InvalidArgument"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
module.exports = function() {
2+
var createParams = {
3+
CallerReference: '',
4+
Aliases: {
5+
Quantity: 0
6+
},
7+
DefaultRootObject: '',
8+
Origins: {
9+
Items: [{
10+
Id: 'origin',
11+
DomainName: 'example.com',
12+
CustomOriginConfig: {
13+
HTTPPort: 80,
14+
HTTPSPort: 443,
15+
OriginProtocolPolicy: 'match-viewer'
16+
}
17+
}],
18+
Quantity: 1
19+
},
20+
DefaultCacheBehavior: {
21+
TargetOriginId: 'origin',
22+
ForwardedValues: {
23+
QueryString: false,
24+
Cookies: { Forward: 'all' }
25+
},
26+
TrustedSigners: {
27+
Items: [],
28+
Enabled: false,
29+
Quantity: 0
30+
},
31+
ViewerProtocolPolicy: 'allow-all',
32+
MinTTL: 0
33+
},
34+
CacheBehaviors: {
35+
Items: [],
36+
Quantity: 0
37+
},
38+
Comment: '',
39+
Logging: {
40+
Enabled: false,
41+
Bucket: 'invalidbucket.s3.amazonaws.com',
42+
Prefix: 'prefix',
43+
IncludeCookies: false
44+
},
45+
PriceClass: 'PriceClass_All',
46+
Enabled: false
47+
};
48+
49+
this.Before("@cloudfront", function (callback) {
50+
this.service = new this.AWS.CloudFront();
51+
this.cfCreateParams = createParams;
52+
callback();
53+
});
54+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = function() {
2+
this.Given(/^I create a CloudFront distribution with name prefix "([^"]*)"$/, function(prefix, callback) {
3+
this.cfName = this.uniqueName(prefix);
4+
this.cfCreateParams.CallerReference = this.cfName;
5+
this.cfCreateParams.Origins.Items[0].Id = (this.cfName === '' ? 'origin' : 'InvalidOrigin');
6+
this.request(null, 'createDistribution', { DistributionConfig: this.cfCreateParams }, callback, false);
7+
});
8+
9+
this.Given(/^I list CloudFront distributions$/, function(callback) {
10+
this.request(null, 'listDistributions', {}, callback);
11+
});
12+
13+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# language: en
2+
@cloudsearch
3+
Feature: Amazon CloudSearch (2013-01-01)
4+
5+
I want to use Amazon CloudSearch
6+
7+
Scenario: Describing domain
8+
Given I run the "describeDomains" operation
9+
Then the request should be successful
10+
And the value at "DomainStatusList" should be a list
11+
12+
Scenario: Error handling
13+
Given I create a domain with name prefix ""
14+
Then the error code should be "ValidationError"
15+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = function() {
2+
this.Before("@cloudsearch", function (callback) {
3+
this.service = new this.AWS.CloudSearch();
4+
callback();
5+
});
6+
7+
this.Given(/^I create a domain with name prefix "([^"]*)"$/, function(prefix, callback) {
8+
this.domainName = this.uniqueName(prefix);
9+
this.request(null, 'createDomain', {DomainName: this.domainName}, callback, false);
10+
});
11+
};

features/cloudsearchdomain/.gitkeep

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# language: en
2+
@cloudtrail
3+
Feature: AWS CloudTrail
4+
5+
I want to use AWS CloudTrail
6+
7+
Scenario: Describing trails
8+
Given I describe trails
9+
Then the status code should be 200
10+
11+
Scenario: Error handling
12+
Given I create a trail with an invalid name
13+
Then the error code should be "InvalidTrailNameException"
14+
And the error message should contain:
15+
"""
16+
cannot be blank
17+
"""
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = function() {
2+
this.Before("@cloudtrail", function (callback) {
3+
this.service = new this.AWS.CloudTrail();
4+
callback();
5+
});
6+
7+
this.Given(/^I describe trails$/, function(callback) {
8+
this.request(null, 'describeTrails', {}, callback);
9+
});
10+
11+
this.Given(/^I create a trail with an invalid name$/, function(callback) {
12+
this.request(null, 'createTrail', {Name: '', S3BucketName: ''}, callback, false);
13+
});
14+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# language: en
2+
@cloudwatch
3+
Feature: Amazon CloudWatch
4+
5+
I want to use Amazon CloudWatch
6+
7+
Scenario: Alarms
8+
Given I create a CloudWatch alarm with prefix "aws-js-sdk-alarm"
9+
And I list the CloudWatch alarms
10+
Then the list should contain the CloudWatch alarm
11+
And I delete the CloudWatch alarm
12+
13+
Scenario: Error handling
14+
Given I create a CloudWatch alarm with name ""
15+
Then the error code should be "ValidationError"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module.exports = function() {
2+
this.Before("@cloudwatch", function (callback) {
3+
this.service = new this.AWS.CloudWatch();
4+
callback();
5+
});
6+
7+
this.Given(/^I create a CloudWatch alarm with (prefix|name) "([^"]*)"$/, function(prefix, name, callback) {
8+
var timestamp = new Date().getTime();
9+
this.cloudWatchAlarm = {
10+
AlarmName: name,
11+
MetricName: 'aws-sdk-js-metric-' + timestamp,
12+
Namespace: 'aws-sdk-js-namespace' + timestamp,
13+
ComparisonOperator: 'GreaterThanThreshold',
14+
EvaluationPeriods: 5,
15+
Period: 60,
16+
Statistic: 'Average',
17+
Threshold: 50.0
18+
};
19+
20+
if (prefix === 'prefix') {
21+
this.cloudWatchAlarm.AlarmName += '-' + timestamp;
22+
}
23+
24+
this.request(null, 'putMetricAlarm', this.cloudWatchAlarm,
25+
callback, prefix === 'name' ? false : undefined);
26+
});
27+
28+
this.Given(/^I list the CloudWatch alarms$/, function(callback) {
29+
var params = {
30+
MetricName: this.cloudWatchAlarm.MetricName,
31+
Namespace: this.cloudWatchAlarm.Namespace
32+
};
33+
this.request(null, 'describeAlarmsForMetric', params, callback);
34+
});
35+
36+
this.Then(/^the list should contain the CloudWatch alarm$/, function(callback) {
37+
var name = this.cloudWatchAlarm.AlarmName;
38+
this.assert.contains(this.data.MetricAlarms, function(alarm) {
39+
return alarm.AlarmName === name;
40+
});
41+
callback();
42+
});
43+
44+
this.Then(/^I delete the CloudWatch alarm$/, function(callback) {
45+
this.request(null, 'deleteAlarms',
46+
{AlarmNames: [this.cloudWatchAlarm.AlarmName]}, callback);
47+
});
48+
};

0 commit comments

Comments
 (0)