From 19dc053a51889b8129d75d2cd6bc341b036dd248 Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Wed, 17 Nov 2021 02:31:39 +0000 Subject: [PATCH] test(e2e-legacy): import clients only when testing --- features/acm/step_definitions/acm.js | 2 +- .../apigateway/step_definitions/apigateway.js | 2 +- .../step_definitions/autoscaling.js | 2 +- .../step_definitions/cloudformation.js | 2 +- .../cloudfront/step_definitions/cloudfront.js | 3 +- .../step_definitions/cloudsearch.js | 2 +- .../cloudtrail/step_definitions/cloudtrail.js | 2 +- .../cloudwatch/step_definitions/cloudwatch.js | 2 +- .../step_definitions/cloudwatchevents.js | 2 +- .../step_definitions/cloudwatchlogs.js | 2 +- .../codecommit/step_definitions/codecommit.js | 2 +- .../codedeploy/step_definitions/codedeploy.js | 2 +- .../step_definitions/codepipeline.js | 2 +- .../step_definitions/cognitoidentity.js | 2 +- .../step_definitions/cognitosync.js | 2 +- .../step_definitions/configservice.js | 2 +- .../step_definitions/datapipeline.js | 2 +- .../devicefarm/step_definitions/devicefarm.js | 2 +- .../step_definitions/directconnect.js | 2 +- .../step_definitions/directoryservice.js | 2 +- features/dms/step_definitions/dms.js | 2 +- .../dynamodb/step_definitions/dynamodb.js | 4 +- .../step_definitions/dynamodbstreams.js | 2 +- features/ec2/step_definitions/ec2.js | 4 +- features/ecr/step_definitions/ecr.js | 2 +- features/ecs/step_definitions/ecs.js | 2 +- features/efs/step_definitions/efs.js | 2 +- .../step_definitions/elasticache.js | 2 +- .../step_definitions/elasticbeanstalk.js | 2 +- .../step_definitions/elastictranscoder.js | 6 +-- features/elb/step_definitions/elb.js | 2 +- features/elbv2/step_definitions/elbv2.js | 2 +- features/emr/step_definitions/emr.js | 5 ++- features/es/step_definitions/es.js | 2 +- .../gamelift/step_definitions/gamelift.js | 2 +- features/glacier/step_definitions/glacier.js | 2 +- features/iam/step_definitions/iam.js | 2 +- .../inspector/step_definitions/inspector.js | 2 +- features/iot/step_definitions/iot.js | 2 +- features/kinesis/step_definitions/kinesis.js | 2 +- features/kms/step_definitions/kms.js | 2 +- features/lambda/step_definitions/lambda.js | 2 +- .../opsworks/step_definitions/opsworks.js | 4 +- .../pinpoint/step_definitions/pinpoint.js | 2 +- features/rds/step_definitions/rds.js | 2 +- .../redshift/step_definitions/redshift.js | 2 +- features/route53/step_definitions/route53.js | 2 +- .../step_definitions/route53domains.js | 2 +- features/s3/step_definitions/buckets.js | 19 +++++--- features/s3/step_definitions/hooks.js | 2 +- features/s3/step_definitions/objects.js | 43 +++++++++++-------- features/s3/step_definitions/proxy.js | 6 +-- .../sagemaker/step_definitions/sagemaker.js | 2 +- features/ses/step_definitions/ses.js | 2 +- features/sns/step_definitions/sns.js | 2 +- features/sqs/step_definitions/sqs.js | 2 +- features/ssm/step_definitions/ssm.js | 2 +- .../step_definitions/storagegateway.js | 2 +- features/sts/step_definitions/sts.js | 2 +- features/swf/step_definitions/swf.js | 2 +- features/waf/step_definitions/waf.js | 2 +- .../workspaces/step_definitions/workspaces.js | 2 +- 62 files changed, 110 insertions(+), 90 deletions(-) diff --git a/features/acm/step_definitions/acm.js b/features/acm/step_definitions/acm.js index 9e4cbd7ba5c3..2d74f406b645 100644 --- a/features/acm/step_definitions/acm.js +++ b/features/acm/step_definitions/acm.js @@ -1,7 +1,7 @@ -const { ACM } = require("../../../clients/client-acm"); const { Before } = require("cucumber"); Before({ tags: "@acm" }, function (scenario, callback) { + const { ACM } = require("../../../clients/client-acm"); this.service = new ACM({}); callback(); }); diff --git a/features/apigateway/step_definitions/apigateway.js b/features/apigateway/step_definitions/apigateway.js index 8979caa78604..20b13f9e84a4 100644 --- a/features/apigateway/step_definitions/apigateway.js +++ b/features/apigateway/step_definitions/apigateway.js @@ -1,7 +1,7 @@ -const { APIGateway } = require("../../../clients/client-api-gateway"); const { Before } = require("cucumber"); Before({ tags: "@apigateway" }, function (scenario, callback) { + const { APIGateway } = require("../../../clients/client-api-gateway"); this.service = new APIGateway({}); callback(); }); diff --git a/features/autoscaling/step_definitions/autoscaling.js b/features/autoscaling/step_definitions/autoscaling.js index badff08fc0ce..23771069d4a5 100644 --- a/features/autoscaling/step_definitions/autoscaling.js +++ b/features/autoscaling/step_definitions/autoscaling.js @@ -1,7 +1,7 @@ -const { AutoScaling } = require("../../../clients/client-auto-scaling"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@autoscaling" }, function (scenario, callback) { + const { AutoScaling } = require("../../../clients/client-auto-scaling"); this.service = new AutoScaling({ region: "us-east-1" }); callback(); }); diff --git a/features/cloudformation/step_definitions/cloudformation.js b/features/cloudformation/step_definitions/cloudformation.js index 18c9eb342453..848f73906e63 100644 --- a/features/cloudformation/step_definitions/cloudformation.js +++ b/features/cloudformation/step_definitions/cloudformation.js @@ -1,7 +1,7 @@ -const { CloudFormation } = require("../../../clients/client-cloudformation"); const { Before, Given } = require("cucumber"); Before({ tags: "@cloudformation" }, function (scenario, callback) { + const { CloudFormation } = require("../../../clients/client-cloudformation"); this.service = new CloudFormation({}); callback(); }); diff --git a/features/cloudfront/step_definitions/cloudfront.js b/features/cloudfront/step_definitions/cloudfront.js index 7fcd6308ae69..25f389005eda 100644 --- a/features/cloudfront/step_definitions/cloudfront.js +++ b/features/cloudfront/step_definitions/cloudfront.js @@ -1,4 +1,3 @@ -const { CloudFront } = require("../../../clients/client-cloudfront"); const { Before, Given } = require("cucumber"); const createParams = { @@ -53,7 +52,9 @@ const createParams = { }; Before({ tags: "@cloudfront" }, function (scenario, callback) { + const { CloudFront } = require("../../../clients/client-cloudfront"); this.service = new CloudFront({}); + this.cfCreateParams = createParams; callback(); }); diff --git a/features/cloudsearch/step_definitions/cloudsearch.js b/features/cloudsearch/step_definitions/cloudsearch.js index f6180cb9dab7..4d00acc0f3f4 100644 --- a/features/cloudsearch/step_definitions/cloudsearch.js +++ b/features/cloudsearch/step_definitions/cloudsearch.js @@ -1,7 +1,7 @@ -const { CloudSearch } = require("../../../clients/client-cloudsearch"); const { Before, Given } = require("cucumber"); Before({ tags: "@cloudsearch" }, function (scenario, callback) { + const { CloudSearch } = require("../../../clients/client-cloudsearch"); this.service = new CloudSearch({}); callback(); }); diff --git a/features/cloudtrail/step_definitions/cloudtrail.js b/features/cloudtrail/step_definitions/cloudtrail.js index 46ca3a0ca646..1ccddeed094d 100644 --- a/features/cloudtrail/step_definitions/cloudtrail.js +++ b/features/cloudtrail/step_definitions/cloudtrail.js @@ -1,7 +1,7 @@ -const { CloudTrail } = require("../../../clients/client-cloudtrail"); const { Before, Given } = require("cucumber"); Before({ tags: "@cloudtrail" }, function (scenario, callback) { + const { CloudTrail } = require("../../../clients/client-cloudtrail"); this.service = new CloudTrail({}); callback(); }); diff --git a/features/cloudwatch/step_definitions/cloudwatch.js b/features/cloudwatch/step_definitions/cloudwatch.js index f415f1349141..8af290c7d2e0 100644 --- a/features/cloudwatch/step_definitions/cloudwatch.js +++ b/features/cloudwatch/step_definitions/cloudwatch.js @@ -1,7 +1,7 @@ -const { CloudWatch } = require("../../../clients/client-cloudwatch"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@cloudwatch" }, function (scenario, callback) { + const { CloudWatch } = require("../../../clients/client-cloudwatch"); this.service = new CloudWatch({}); callback(); }); diff --git a/features/cloudwatchevents/step_definitions/cloudwatchevents.js b/features/cloudwatchevents/step_definitions/cloudwatchevents.js index 5458d8519eae..499fbb84ed6a 100644 --- a/features/cloudwatchevents/step_definitions/cloudwatchevents.js +++ b/features/cloudwatchevents/step_definitions/cloudwatchevents.js @@ -1,7 +1,7 @@ -const { CloudWatchEvents } = require("../../../clients/client-cloudwatch-events"); const { Before } = require("cucumber"); Before({ tags: "@cloudwatchevents" }, function (scenario, callback) { + const { CloudWatchEvents } = require("../../../clients/client-cloudwatchevents"); this.service = new CloudWatchEvents({}); callback(); }); diff --git a/features/cloudwatchlogs/step_definitions/cloudwatchlogs.js b/features/cloudwatchlogs/step_definitions/cloudwatchlogs.js index d731844c0799..66ab7e4e1e76 100644 --- a/features/cloudwatchlogs/step_definitions/cloudwatchlogs.js +++ b/features/cloudwatchlogs/step_definitions/cloudwatchlogs.js @@ -1,7 +1,7 @@ -const { CloudWatchLogs } = require("../../../clients/client-cloudwatch-logs"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@cloudwatchlogs" }, function (scenario, callback) { + const { CloudWatchLogs } = require("../../../clients/client-cloudwatchlogs"); this.service = new CloudWatchLogs({}); callback(); }); diff --git a/features/codecommit/step_definitions/codecommit.js b/features/codecommit/step_definitions/codecommit.js index f522a88da111..1188f7e4c8a6 100644 --- a/features/codecommit/step_definitions/codecommit.js +++ b/features/codecommit/step_definitions/codecommit.js @@ -1,7 +1,7 @@ -const { CodeCommit } = require("../../../clients/client-codecommit"); const { Before } = require("cucumber"); Before({ tags: "@codecommit" }, function (scenario, callback) { + const { CodeCommit } = require("../../../clients/client-codecommit"); this.service = new CodeCommit({ region: "us-east-1" }); callback(); }); diff --git a/features/codedeploy/step_definitions/codedeploy.js b/features/codedeploy/step_definitions/codedeploy.js index 1bd0c560e74a..2e91c7ab3ec7 100644 --- a/features/codedeploy/step_definitions/codedeploy.js +++ b/features/codedeploy/step_definitions/codedeploy.js @@ -1,7 +1,7 @@ -const { CodeDeploy } = require("../../../clients/client-codedeploy"); const { Before } = require("cucumber"); Before({ tags: "@codedeploy" }, function (scenario, callback) { + const { CodeDeploy } = require("../../../clients/client-codedeploy"); this.service = new CodeDeploy({}); callback(); }); diff --git a/features/codepipeline/step_definitions/codepipeline.js b/features/codepipeline/step_definitions/codepipeline.js index 64abd2a0056e..6c10c1bc5b89 100644 --- a/features/codepipeline/step_definitions/codepipeline.js +++ b/features/codepipeline/step_definitions/codepipeline.js @@ -1,7 +1,7 @@ -const { CodePipeline } = require("../../../clients/client-codepipeline"); const { Before } = require("cucumber"); Before({ tags: "@codepipeline" }, function (scenario, callback) { + const { CodePipeline } = require("../../../clients/client-codepipeline"); this.service = new CodePipeline({ region: "us-east-1" }); callback(); }); diff --git a/features/cognitoidentity/step_definitions/cognitoidentity.js b/features/cognitoidentity/step_definitions/cognitoidentity.js index d04e761e663d..3511e6980020 100644 --- a/features/cognitoidentity/step_definitions/cognitoidentity.js +++ b/features/cognitoidentity/step_definitions/cognitoidentity.js @@ -1,7 +1,7 @@ -const { CognitoIdentity } = require("../../../clients/client-cognito-identity"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@cognitoidentity" }, function (scenario, callback) { + const { CognitoIdentity } = require("../../../clients/client-cognitoidentity"); this.service = new CognitoIdentity({}); callback(); }); diff --git a/features/cognitosync/step_definitions/cognitosync.js b/features/cognitosync/step_definitions/cognitosync.js index 7fe31a02260d..661b35d38ad0 100644 --- a/features/cognitosync/step_definitions/cognitosync.js +++ b/features/cognitosync/step_definitions/cognitosync.js @@ -1,7 +1,7 @@ -const { CognitoSync } = require("../../../clients/client-cognito-sync"); const { Before, Given } = require("cucumber"); Before({ tags: "@cognitosync" }, function (scenario, callback) { + const { CognitoSync } = require("../../../clients/client-cognitosync"); this.service = new CognitoSync({}); callback(); }); diff --git a/features/configservice/step_definitions/configservice.js b/features/configservice/step_definitions/configservice.js index 22ec9c2b9eb5..7b86c60aea16 100644 --- a/features/configservice/step_definitions/configservice.js +++ b/features/configservice/step_definitions/configservice.js @@ -1,7 +1,7 @@ -const { ConfigService } = require("../../../clients/client-config-service"); const { Before } = require("cucumber"); Before({ tags: "@configservice" }, function (scenario, callback) { + const { ConfigService } = require("../../../clients/client-configservice"); this.service = new ConfigService({}); callback(); }); diff --git a/features/datapipeline/step_definitions/datapipeline.js b/features/datapipeline/step_definitions/datapipeline.js index 48d16ec2fe0d..8e47b9add318 100644 --- a/features/datapipeline/step_definitions/datapipeline.js +++ b/features/datapipeline/step_definitions/datapipeline.js @@ -1,7 +1,7 @@ -const { DataPipeline } = require("../../../clients/client-data-pipeline"); const { Before, Given } = require("cucumber"); Before({ tags: "@datapipeline" }, function (scenario, callback) { + const { DataPipeline } = require("../../../clients/client-datapipeline"); this.service = new DataPipeline({}); callback(); }); diff --git a/features/devicefarm/step_definitions/devicefarm.js b/features/devicefarm/step_definitions/devicefarm.js index 38bd8e5b5090..dceedfe14a20 100644 --- a/features/devicefarm/step_definitions/devicefarm.js +++ b/features/devicefarm/step_definitions/devicefarm.js @@ -1,7 +1,7 @@ -const { DeviceFarm } = require("../../../clients/client-device-farm"); const { Before } = require("cucumber"); Before({ tags: "@devicefarm" }, function (scenario, callback) { + const { DeviceFarm } = require("../../../clients/client-devicefarm"); this.service = new DeviceFarm({ region: "us-west-2" }); callback(); }); diff --git a/features/directconnect/step_definitions/directconnect.js b/features/directconnect/step_definitions/directconnect.js index 83fa5ffdbe94..39ca9457e5f2 100644 --- a/features/directconnect/step_definitions/directconnect.js +++ b/features/directconnect/step_definitions/directconnect.js @@ -1,7 +1,7 @@ -const { DirectConnect } = require("../../../clients/client-direct-connect"); const { Before, Given } = require("cucumber"); Before({ tags: "@directconnect" }, function (scenario, callback) { + const { DirectConnect } = require("../../../clients/client-directconnect"); this.service = new DirectConnect({}); callback(); }); diff --git a/features/directoryservice/step_definitions/directoryservice.js b/features/directoryservice/step_definitions/directoryservice.js index 2002d808bdc4..772a1b398be5 100644 --- a/features/directoryservice/step_definitions/directoryservice.js +++ b/features/directoryservice/step_definitions/directoryservice.js @@ -1,7 +1,7 @@ -const { DirectoryService } = require("../../../clients/client-directory-service"); const { Before } = require("cucumber"); Before({ tags: "@directoryservice" }, function (scenario, callback) { + const { DirectoryService } = require("../../../clients/client-directoryservice"); this.service = new DirectoryService({}); callback(); }); diff --git a/features/dms/step_definitions/dms.js b/features/dms/step_definitions/dms.js index 2902dd7787a7..85d8450aabb2 100644 --- a/features/dms/step_definitions/dms.js +++ b/features/dms/step_definitions/dms.js @@ -1,7 +1,7 @@ -const { DatabaseMigrationService } = require("../../../clients/client-database-migration-service"); const { Before } = require("cucumber"); Before({ tags: "@databasemigrationservice" }, function (scenario, callback) { + const { DatabaseMigrationService } = require("../../../clients/client-databasemigrationservice"); this.service = new DatabaseMigrationService({}); callback(); }); diff --git a/features/dynamodb/step_definitions/dynamodb.js b/features/dynamodb/step_definitions/dynamodb.js index ee6318b09245..bb17134128b6 100644 --- a/features/dynamodb/step_definitions/dynamodb.js +++ b/features/dynamodb/step_definitions/dynamodb.js @@ -1,7 +1,7 @@ const jmespath = require("jmespath"); -const { DynamoDB, waitForTableExists, waitForTableNotExists } = require("../../../clients/client-dynamodb"); function waitForTableExistsCallback(world, callback) { + const { waitForTableExists } = require("../../../clients/client-dynamodb"); waitForTableExists({ client: world.service }, { TableName: world.tableName }).then( function (data) { callback(); @@ -13,6 +13,7 @@ function waitForTableExistsCallback(world, callback) { } function waitForTableNotExistsWithCallback(world, callback) { + const { waitForTableNotExists } = require("../../../clients/client-dynamodb"); waitForTableNotExists({ client: world.service }, { TableName: world.tableName }).then( function (data) { callback(); @@ -26,6 +27,7 @@ function waitForTableNotExistsWithCallback(world, callback) { const { Before, Given, Then, When } = require("cucumber"); Before({ tags: "@dynamodb" }, function (scenario, next) { + const { DynamoDB } = require("../../../clients/client-dynamodb"); this.service = new DynamoDB({ maxRetries: 2, }); diff --git a/features/dynamodbstreams/step_definitions/dynamodbstreams.js b/features/dynamodbstreams/step_definitions/dynamodbstreams.js index 4e1faef99557..9716b33c3643 100644 --- a/features/dynamodbstreams/step_definitions/dynamodbstreams.js +++ b/features/dynamodbstreams/step_definitions/dynamodbstreams.js @@ -1,7 +1,7 @@ -const { DynamoDBStreams } = require("../../../clients/client-dynamodb-streams"); const { Before } = require("cucumber"); Before({ tags: "@dynamodbstreams" }, function (scenario, callback) { + const { DynamoDBStreams } = require("../../../clients/client-dynamodbstreams"); this.service = new DynamoDBStreams({}); callback(); }); diff --git a/features/ec2/step_definitions/ec2.js b/features/ec2/step_definitions/ec2.js index e4b7dfe1ae83..68839b3ddca9 100644 --- a/features/ec2/step_definitions/ec2.js +++ b/features/ec2/step_definitions/ec2.js @@ -1,7 +1,7 @@ -const { EC2, waitForVolumeAvailable } = require("../../../clients/client-ec2"); const { Before, Given, Then } = require("cucumber"); const waitForVolumeAvailableCallback = (ec2, volumeId, callback) => { + const { waitForVolumeAvailable } = require("../../../clients/client-ec2"); waitForVolumeAvailable({ client: ec2 }, { VolumeIds: [volumeId] }).then( function (data) { callback(); @@ -13,6 +13,7 @@ const waitForVolumeAvailableCallback = (ec2, volumeId, callback) => { }; Before({ tags: "@ec2" }, function (scenario, callback) { + const { EC2 } = require("../../../clients/client-ec2"); this.service = new EC2({}); callback(); }); @@ -34,6 +35,7 @@ Given("I describe the EC2 instance {string}", function (instanceId, callback) { }); Given("I attempt to copy an encrypted snapshot across regions", function (callback) { + const { EC2 } = require("../../../clients/client-ec2"); const self = this; let volId, srcSnapId, dstSnapId, params; const sourceRegion = "us-west-2"; diff --git a/features/ecr/step_definitions/ecr.js b/features/ecr/step_definitions/ecr.js index 780ad1ec4702..713f62ac9ce8 100644 --- a/features/ecr/step_definitions/ecr.js +++ b/features/ecr/step_definitions/ecr.js @@ -1,7 +1,7 @@ -const { ECR } = require("../../../clients/client-ecr"); const { Before } = require("cucumber"); Before({ tags: "@ecr" }, function (scenario, callback) { + const { ECR } = require("../../../clients/client-ecr"); this.service = new ECR({}); callback(); }); diff --git a/features/ecs/step_definitions/ecs.js b/features/ecs/step_definitions/ecs.js index 9eafcb5d8cf6..3400db03e149 100644 --- a/features/ecs/step_definitions/ecs.js +++ b/features/ecs/step_definitions/ecs.js @@ -1,7 +1,7 @@ -const { ECS } = require("../../../clients/client-ecs"); const { Before } = require("cucumber"); Before({ tags: "@ecs" }, function (scenario, callback) { + const { ECS } = require("../../../clients/client-ecs"); this.service = new ECS({}); callback(); }); diff --git a/features/efs/step_definitions/efs.js b/features/efs/step_definitions/efs.js index b307b7ed1cc9..7e4425036ffc 100644 --- a/features/efs/step_definitions/efs.js +++ b/features/efs/step_definitions/efs.js @@ -1,7 +1,7 @@ -const { EFS } = require("../../../clients/client-efs"); const { Before } = require("cucumber"); Before({ tags: "@efs" }, function (scenario, callback) { + const { EFS } = require("../../../clients/client-efs"); this.service = new EFS({ region: "us-west-2" }); callback(); }); diff --git a/features/elasticache/step_definitions/elasticache.js b/features/elasticache/step_definitions/elasticache.js index f516178d5740..3d1e34a428f2 100644 --- a/features/elasticache/step_definitions/elasticache.js +++ b/features/elasticache/step_definitions/elasticache.js @@ -1,7 +1,7 @@ -const { ElastiCache } = require("../../../clients/client-elasticache"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@elasticache" }, function (scenario, callback) { + const { ElastiCache } = require("../../../clients/client-elasticache"); this.service = new ElastiCache({}); callback(); }); diff --git a/features/elasticbeanstalk/step_definitions/elasticbeanstalk.js b/features/elasticbeanstalk/step_definitions/elasticbeanstalk.js index 99f750f96eff..730c5348effb 100644 --- a/features/elasticbeanstalk/step_definitions/elasticbeanstalk.js +++ b/features/elasticbeanstalk/step_definitions/elasticbeanstalk.js @@ -1,7 +1,7 @@ -const { ElasticBeanstalk } = require("../../../clients/client-elastic-beanstalk"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@elasticbeanstalk" }, function (scenario, callback) { + const { ElasticBeanstalk } = require("../../../clients/client-elasticbeanstalk"); this.service = new ElasticBeanstalk({}); callback(); }); diff --git a/features/elastictranscoder/step_definitions/elastictranscoder.js b/features/elastictranscoder/step_definitions/elastictranscoder.js index 888f03c680fc..9d9d8956472e 100644 --- a/features/elastictranscoder/step_definitions/elastictranscoder.js +++ b/features/elastictranscoder/step_definitions/elastictranscoder.js @@ -1,9 +1,9 @@ -const { ElasticTranscoder } = require("../../../clients/client-elastic-transcoder"); -const { S3 } = require("../../../clients/client-s3"); -const { IAM } = require("../../../clients/client-iam"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@elastictranscoder" }, function (scenario, callback) { + const { S3 } = require("../../../clients/client-s3"); + const { IAM } = require("../../../clients/client-iam"); + const { ElasticTranscoder } = require("../../../clients/client-elastictranscoder"); this.iam = new IAM({}); this.s3 = new S3({}); this.service = new ElasticTranscoder({}); diff --git a/features/elb/step_definitions/elb.js b/features/elb/step_definitions/elb.js index b4aff0638ad4..19af1e687069 100644 --- a/features/elb/step_definitions/elb.js +++ b/features/elb/step_definitions/elb.js @@ -1,7 +1,7 @@ -const { ElasticLoadBalancing } = require("../../../clients/client-elastic-load-balancing"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@elasticloadbalancing" }, function (scenario, callback) { + const { ElasticLoadBalancing } = require("../../../clients/client-elasticloadbalancing"); this.service = new ElasticLoadBalancing({}); callback(); }); diff --git a/features/elbv2/step_definitions/elbv2.js b/features/elbv2/step_definitions/elbv2.js index 34ca255472b5..dc123d224914 100644 --- a/features/elbv2/step_definitions/elbv2.js +++ b/features/elbv2/step_definitions/elbv2.js @@ -1,7 +1,7 @@ -const { ElasticLoadBalancingV2 } = require("../../../clients/client-elastic-load-balancing-v2"); const { Before } = require("cucumber"); Before({ tags: "@elasticloadbalancingv2" }, function (scenario, callback) { + const { ElasticLoadBalancingV2 } = require("../../../clients/client-elasticloadbalancingv2"); this.service = new ElasticLoadBalancingV2({}); callback(); }); diff --git a/features/emr/step_definitions/emr.js b/features/emr/step_definitions/emr.js index c8d48d0a73c9..f7d63397241e 100644 --- a/features/emr/step_definitions/emr.js +++ b/features/emr/step_definitions/emr.js @@ -1,13 +1,14 @@ -const { EMR } = require("../../../clients/client-emr"); const { Before, Given } = require("cucumber"); Before({ tags: "@emr" }, function (scenario, callback) { + const { EMR } = require("../../../clients/client-emr"); + this.EMR = EMR; this.service = new EMR({}); callback(); }); Given("I run an EMR job flow with invalid parameters", function (callback) { - this.service = new EMR({}); + this.service = new this.EMR({}); const params = { Name: "", Instances: { MasterInstanceType: "invalid" } }; this.request(null, "runJobFlow", params, callback, false); }); diff --git a/features/es/step_definitions/es.js b/features/es/step_definitions/es.js index ce3307df3de4..a904927af6f0 100644 --- a/features/es/step_definitions/es.js +++ b/features/es/step_definitions/es.js @@ -1,7 +1,7 @@ -const { ElasticsearchService } = require("../../../clients/client-elasticsearch-service"); const { Before } = require("cucumber"); Before({ tags: "@elasticsearchservice" }, function (scenario, callback) { + const { ElasticsearchService } = require("../../../clients/client-elasticsearchservice"); this.service = new ElasticsearchService({}); callback(); }); diff --git a/features/gamelift/step_definitions/gamelift.js b/features/gamelift/step_definitions/gamelift.js index 77a54d6809da..f279bc5eccb3 100644 --- a/features/gamelift/step_definitions/gamelift.js +++ b/features/gamelift/step_definitions/gamelift.js @@ -1,7 +1,7 @@ -const { GameLift } = require("../../../clients/client-gamelift"); const { Before } = require("cucumber"); Before({ tags: "@gamelift" }, function (scenario, callback) { + const { GameLift } = require("../../../clients/client-gamelift"); this.service = new GameLift({}); callback(); }); diff --git a/features/glacier/step_definitions/glacier.js b/features/glacier/step_definitions/glacier.js index 14283edae4a3..045db50dffa1 100644 --- a/features/glacier/step_definitions/glacier.js +++ b/features/glacier/step_definitions/glacier.js @@ -1,7 +1,7 @@ -const { Glacier } = require("../../../clients/client-glacier"); const { Before, Given, Then, When } = require("cucumber"); Before({ tags: "@glacier" }, function (scenario, callback) { + const { Glacier } = require("../../../clients/client-glacier"); this.service = new Glacier({}); callback(); }); diff --git a/features/iam/step_definitions/iam.js b/features/iam/step_definitions/iam.js index 49ee27bcbb7d..70e83a087e48 100644 --- a/features/iam/step_definitions/iam.js +++ b/features/iam/step_definitions/iam.js @@ -1,7 +1,7 @@ -const { IAM } = require("../../../clients/client-iam"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@iam" }, function (scenario, callback) { + const { IAM } = require("../../../clients/client-iam"); this.iam = new IAM({}); callback(); }); diff --git a/features/inspector/step_definitions/inspector.js b/features/inspector/step_definitions/inspector.js index 7e7735b00029..213b808c0e63 100644 --- a/features/inspector/step_definitions/inspector.js +++ b/features/inspector/step_definitions/inspector.js @@ -1,7 +1,7 @@ -const { Inspector } = require("../../../clients/client-inspector"); const { Before } = require("cucumber"); Before({ tags: "@inspector" }, function (scenario, callback) { + const { Inspector } = require("../../../clients/client-inspector"); this.service = new Inspector({ region: "us-west-2" }); callback(); }); diff --git a/features/iot/step_definitions/iot.js b/features/iot/step_definitions/iot.js index 7f2a985c5002..4e2385cc9176 100644 --- a/features/iot/step_definitions/iot.js +++ b/features/iot/step_definitions/iot.js @@ -1,7 +1,7 @@ -const { IoT } = require("../../../clients/client-iot"); const { Before } = require("cucumber"); Before({ tags: "@iot" }, function (scenario, callback) { + const { IoT } = require("../../../clients/client-iot"); this.service = new IoT({}); callback(); }); diff --git a/features/kinesis/step_definitions/kinesis.js b/features/kinesis/step_definitions/kinesis.js index d35c97c50a6b..52b1dd9a4fb3 100644 --- a/features/kinesis/step_definitions/kinesis.js +++ b/features/kinesis/step_definitions/kinesis.js @@ -1,7 +1,7 @@ -const { Kinesis } = require("../../../clients/client-kinesis"); const { Before, Given } = require("cucumber"); Before({ tags: "@kinesis" }, function (scenario, callback) { + const { Kinesis } = require("../../../clients/client-kinesis"); this.service = new Kinesis({}); callback(); }); diff --git a/features/kms/step_definitions/kms.js b/features/kms/step_definitions/kms.js index 392e99dd0112..b2054941d94a 100644 --- a/features/kms/step_definitions/kms.js +++ b/features/kms/step_definitions/kms.js @@ -1,7 +1,7 @@ -const { KMS } = require("../../../clients/client-kms"); const { Before } = require("cucumber"); Before({ tags: "@kms" }, function (scenario, callback) { + const { KMS } = require("../../../clients/client-kms"); this.service = new KMS({}); callback(); }); diff --git a/features/lambda/step_definitions/lambda.js b/features/lambda/step_definitions/lambda.js index 54c03b7f1fc1..195181cab484 100644 --- a/features/lambda/step_definitions/lambda.js +++ b/features/lambda/step_definitions/lambda.js @@ -1,7 +1,7 @@ -const { Lambda } = require("../../../clients/client-lambda"); const { Before } = require("cucumber"); Before({ tags: "@lambda" }, function (scenario, callback) { + const { Lambda } = require("../../../clients/client-lambda"); this.service = new Lambda({}); callback(); }); diff --git a/features/opsworks/step_definitions/opsworks.js b/features/opsworks/step_definitions/opsworks.js index 482cdd359709..110ef2878e24 100644 --- a/features/opsworks/step_definitions/opsworks.js +++ b/features/opsworks/step_definitions/opsworks.js @@ -1,9 +1,9 @@ -const { IAM } = require("../../../clients/client-iam"); -const { OpsWorks } = require("../../../clients/client-opsworks"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@opsworks" }, function (scenario, callback) { + const { IAM } = require("../../../clients/client-iam"); this.iam = new IAM({ region: "us-west-2" }); + const { OpsWorks } = require("../../../clients/client-opsworks"); this.service = new OpsWorks({ region: "us-west-2" }); callback(); }); diff --git a/features/pinpoint/step_definitions/pinpoint.js b/features/pinpoint/step_definitions/pinpoint.js index d12065176d55..c236f1ec048e 100644 --- a/features/pinpoint/step_definitions/pinpoint.js +++ b/features/pinpoint/step_definitions/pinpoint.js @@ -1,7 +1,7 @@ -const { Pinpoint } = require("../../../clients/client-pinpoint"); const { Before, Given } = require("cucumber"); Before({ tags: "@pinpoint" }, function (scenario, callback) { + const { Pinpoint } = require("../../../clients/client-pinpoint"); this.service = new Pinpoint({}); callback(); }); diff --git a/features/rds/step_definitions/rds.js b/features/rds/step_definitions/rds.js index d2ef1cab0786..e240d3394799 100644 --- a/features/rds/step_definitions/rds.js +++ b/features/rds/step_definitions/rds.js @@ -1,8 +1,8 @@ const jmespath = require("jmespath"); -const { RDS } = require("../../../clients/client-rds"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@rds" }, function (scenario, callback) { + const { RDS } = require("../../../clients/client-rds"); this.service = new RDS({}); callback(); }); diff --git a/features/redshift/step_definitions/redshift.js b/features/redshift/step_definitions/redshift.js index b6ea2485e697..244a18093186 100644 --- a/features/redshift/step_definitions/redshift.js +++ b/features/redshift/step_definitions/redshift.js @@ -1,7 +1,7 @@ -const { Redshift } = require("../../../clients/client-redshift"); const { Before, Given } = require("cucumber"); Before({ tags: "@redshift" }, function (scenario, callback) { + const { Redshift } = require("../../../clients/client-redshift"); this.service = new Redshift({}); callback(); }); diff --git a/features/route53/step_definitions/route53.js b/features/route53/step_definitions/route53.js index e681f697ea2e..6fe8c038e099 100644 --- a/features/route53/step_definitions/route53.js +++ b/features/route53/step_definitions/route53.js @@ -1,7 +1,7 @@ -const { Route53 } = require("../../../clients/client-route-53"); const { Before, Then, When } = require("cucumber"); Before({ tags: "@route53" }, function (scenario, callback) { + const { Route53 } = require("../../../clients/client-route53"); this.service = new Route53({}); callback(); }); diff --git a/features/route53domains/step_definitions/route53domains.js b/features/route53domains/step_definitions/route53domains.js index 2a77edf593f0..4ab1fbf95bd3 100644 --- a/features/route53domains/step_definitions/route53domains.js +++ b/features/route53domains/step_definitions/route53domains.js @@ -1,7 +1,7 @@ -const { Route53Domains } = require("../../../clients/client-route-53-domains"); const { Before, Given } = require("cucumber"); Before({ tags: "@route53domains" }, function (scenario, callback) { + const { Route53Domains } = require("../../../clients/client-route53domains"); this.service = new Route53Domains({ region: "us-east-1" }); callback(); }); diff --git a/features/s3/step_definitions/buckets.js b/features/s3/step_definitions/buckets.js index 4c1977c67fdb..20686f7914a7 100644 --- a/features/s3/step_definitions/buckets.js +++ b/features/s3/step_definitions/buckets.js @@ -1,8 +1,13 @@ -const { S3 } = require("../../../clients/client-s3"); -const { Given, Then, When } = require("cucumber"); +const { Before, Given, Then, When } = require("cucumber"); + +Before({ tags: "@buckets" }, function (scenario, callback) { + const { S3 } = require("../../../clients/client-s3"); + this.S3 = S3; + callback(); +}); Given("I am using the S3 {string} region", function (region, callback) { - this.s3 = new S3({ + this.s3 = new this.S3({ region: region, }); callback(); @@ -11,7 +16,7 @@ Given("I am using the S3 {string} region", function (region, callback) { Given( "I am using the S3 {string} region with signatureVersion {string}", function (region, signatureVersion, callback) { - this.s3 = new S3({ + this.s3 = new this.S3({ region: region, signatureVersion: signatureVersion, }); @@ -37,7 +42,7 @@ When("I create a bucket with the location constraint {string}", function (locati Then("the bucket should exist in region {string}", function (location, next) { // Bug: https://github.com/aws/aws-sdk-js-v3/issues/1799 - this.waitForBucketExists(new S3({ region: location }), { Bucket: this.bucket }, next); + this.waitForBucketExists(new this.S3({ region: location }), { Bucket: this.bucket }, next); }); Then("the bucket should have a location constraint of {string}", function (loc, callback) { @@ -56,7 +61,7 @@ Then("the bucket should have a location constraint of {string}", function (loc, When("I delete the bucket in region {string}", function (location, callback) { // Bug: https://github.com/aws/aws-sdk-js-v3/issues/1799 - this.request(new S3({ region: location }), "deleteBucket", { Bucket: this.bucket }, callback); + this.request(new this.S3({ region: location }), "deleteBucket", { Bucket: this.bucket }, callback); }); When("I put a transition lifecycle configuration on the bucket with prefix {string}", function (prefix, callback) { @@ -216,7 +221,7 @@ When("I create a bucket with a DNS compatible name that contains a dot", functio }); Given("I force path style requests", function (callback) { - this.s3 = new S3({ + this.s3 = new this.S3({ forcePathStyle: true, }); callback(); diff --git a/features/s3/step_definitions/hooks.js b/features/s3/step_definitions/hooks.js index f761f877b239..de407db05dbc 100644 --- a/features/s3/step_definitions/hooks.js +++ b/features/s3/step_definitions/hooks.js @@ -1,7 +1,7 @@ -const { S3 } = require("../../../clients/client-s3"); const { Before } = require("cucumber"); Before({ tags: "@s3" }, function (scenario, callback) { + const { S3 } = require("../../../clients/client-s3"); this.service = this.s3 = new S3({ maxRetries: 100, }); diff --git a/features/s3/step_definitions/objects.js b/features/s3/step_definitions/objects.js index 7f4909fa6dda..62388fb15ddd 100644 --- a/features/s3/step_definitions/objects.js +++ b/features/s3/step_definitions/objects.js @@ -1,14 +1,9 @@ -const { S3, GetObjectCommand, PutObjectCommand } = require("../../../clients/client-s3"); -const { streamCollector } = require("../../../packages/node-http-handler"); -const { toUtf8 } = require("../../../packages/util-utf8-node"); -const { Md5 } = require("../../../packages/md5-js"); - -const { S3RequestPresigner } = require("../../../packages/s3-request-presigner"); -const { createRequest } = require("../../../packages/util-create-request"); -const { formatUrl } = require("../../../packages/util-format-url"); -const { Given, Then, When } = require("cucumber"); +const { Before, Given, Then, When } = require("cucumber"); function getSignedUrl(client, command, params, callback) { + const { S3RequestPresigner } = require("../../../packages/s3-request-presigner"); + const { createRequest } = require("../../../packages/util-create-request"); + const { formatUrl } = require("../../../packages/util-format-url"); const signer = new S3RequestPresigner({ ...client.config }); createRequest(client, new command(params)) .then((request) => { @@ -27,6 +22,20 @@ function getSignedUrl(client, command, params, callback) { }); } +Before({ tags: "@objects" }, function (scenario, callback) { + const { S3, GetObjectCommand, PutObjectCommand } = require("../../../clients/client-s3"); + const { streamCollector } = require("../../../packages/node-http-handler"); + const { toUtf8 } = require("../../../packages/util-utf8-node"); + const { Md5 } = require("../../../packages/md5-js"); + this.S3 = S3; + this.GetObjectCommand = GetObjectCommand; + this.PutObjectCommand = PutObjectCommand; + this.streamCollector = streamCollector; + this.toUtf8 = toUtf8; + this.Md5 = Md5; + callback(); +}); + When("I put {string} to the key {string}", function (data, key, next) { const params = { Bucket: this.sharedBucket, @@ -72,15 +81,15 @@ When("I put {string} to the key {string} with ContentLength {int}", function (co Body: contents, ContentLength: parseInt(contentLength), }; - this.s3nochecksums = new S3({ + this.s3nochecksums = new this.S3({ computeChecksums: false, }); this.request("s3nochecksums", "putObject", params, next); }); Then("the object {string} should contain {string}", function (key, contents, next) { - streamCollector(this.data.Body).then((body) => { - this.assert.equal(toUtf8(body), contents); + this.streamCollector(this.data.Body).then((body) => { + this.assert.equal(this.toUtf8(body), contents); next(); }); }); @@ -177,7 +186,7 @@ When("I get a pre-signed URL to GET the key {string}", function (key, callback) const world = this; getSignedUrl( this.s3, - GetObjectCommand, + this.GetObjectCommand, { Bucket: this.sharedBucket, Key: key, @@ -210,7 +219,7 @@ Given("I get a pre-signed URL to PUT the key {string} with data {string}", funct Key: key, }; if (body) params.Body = body; - getSignedUrl(this.s3, PutObjectCommand, params, function (err, url) { + getSignedUrl(this.s3, this.PutObjectCommand, params, function (err, url) { world.signedUrl = url; callback(); }); @@ -410,15 +419,15 @@ Then("I make an unauthenticated request to read object {string}", function (key, }); Given("I generate the MD5 checksum of {string}", function (data, next) { - const hash = new Md5(); + const hash = new this.Md5(); hash.update(data); this.sentContentMD5 = hash.digest().toString(); next(); }); Then("the MD5 checksum of the response data should equal the generated checksum", function (next) { - const hash = new Md5(); - streamCollector(this.data.Body).then((body) => { + const hash = new this.Md5(); + this.streamCollector(this.data.Body).then((body) => { hash.update(body); this.assert.equal(hash.digest(), this.sentContentMD5); next(); diff --git a/features/s3/step_definitions/proxy.js b/features/s3/step_definitions/proxy.js index 605c6c5b81d2..09b4932beee9 100644 --- a/features/s3/step_definitions/proxy.js +++ b/features/s3/step_definitions/proxy.js @@ -1,9 +1,9 @@ const url = require("url"); const http = require("http"); -const { S3 } = require("../../../clients/client-s3"); const { Before, Then } = require("cucumber"); Before({ tags: "@s3 or @proxy" }, function (scenario, callback) { + const { S3 } = require("../../../clients/client-s3"); setupProxyServer.call(this); this.service = this.s3 = new S3({ @@ -11,12 +11,12 @@ Before({ tags: "@s3 or @proxy" }, function (scenario, callback) { proxy: "http://localhost:" + this.proxyPort, }, }); - + this.S3 = S3; callback(); }); Then("I teardown the local proxy server", function (callback) { - this.service = this.s3 = new S3(); + this.service = this.s3 = new this.S3(); this.proxyServer.close(callback); }); diff --git a/features/sagemaker/step_definitions/sagemaker.js b/features/sagemaker/step_definitions/sagemaker.js index 7c4cb0bb099e..e568afcab58f 100644 --- a/features/sagemaker/step_definitions/sagemaker.js +++ b/features/sagemaker/step_definitions/sagemaker.js @@ -1,7 +1,7 @@ -const { SageMaker } = require("../../../clients/client-sagemaker"); const { Before } = require("cucumber"); Before({ tags: "@sagemaker" }, function (scenario, callback) { + const { SageMaker } = require("../../../clients/client-sagemaker"); this.service = new SageMaker({}); callback(); }); diff --git a/features/ses/step_definitions/ses.js b/features/ses/step_definitions/ses.js index f501204347fb..a978f6f8d60e 100644 --- a/features/ses/step_definitions/ses.js +++ b/features/ses/step_definitions/ses.js @@ -1,7 +1,7 @@ -const { SES } = require("../../../clients/client-ses"); const { Before, Then, When } = require("cucumber"); Before({ tags: "@ses" }, function (scenario, callback) { + const { SES } = require("../../../clients/client-ses"); this.service = new SES({}); callback(); }); diff --git a/features/sns/step_definitions/sns.js b/features/sns/step_definitions/sns.js index b106c3d2c18d..db177de08330 100644 --- a/features/sns/step_definitions/sns.js +++ b/features/sns/step_definitions/sns.js @@ -1,7 +1,7 @@ -const { SNS } = require("../../../clients/client-sns"); const { Before, Given, Then } = require("cucumber"); Before({ tags: "@sns" }, function (scenario, callback) { + const { SNS } = require("../../../clients/client-sns"); this.service = new SNS({}); callback(); }); diff --git a/features/sqs/step_definitions/sqs.js b/features/sqs/step_definitions/sqs.js index b55f3170f306..d056d95758bc 100644 --- a/features/sqs/step_definitions/sqs.js +++ b/features/sqs/step_definitions/sqs.js @@ -1,7 +1,7 @@ -const { SQS } = require("../../../clients/client-sqs"); const { Before } = require("cucumber"); Before({ tags: "@sqs" }, function (scenario, callback) { + const { SQS } = require("../../../clients/client-sqs"); this.service = new SQS({ region: "us-east-1", }); diff --git a/features/ssm/step_definitions/ssm.js b/features/ssm/step_definitions/ssm.js index 3c10270e6b33..25796d96d0a1 100644 --- a/features/ssm/step_definitions/ssm.js +++ b/features/ssm/step_definitions/ssm.js @@ -1,7 +1,7 @@ -const { SSM } = require("../../../clients/client-ssm"); const { Before } = require("cucumber"); Before({ tags: "@ssm" }, function (scenario, callback) { + const { SSM } = require("../../../clients/client-ssm"); this.service = new SSM({}); callback(); }); diff --git a/features/storagegateway/step_definitions/storagegateway.js b/features/storagegateway/step_definitions/storagegateway.js index 60e54ce51069..d63a58c96a3d 100644 --- a/features/storagegateway/step_definitions/storagegateway.js +++ b/features/storagegateway/step_definitions/storagegateway.js @@ -1,7 +1,7 @@ -const { StorageGateway } = require("../../../clients/client-storage-gateway"); const { Before, When } = require("cucumber"); Before({ tags: "@storagegateway" }, function (scenario, callback) { + const { StorageGateway } = require("../../../clients/client-storagegateway"); this.service = new StorageGateway({ region: "us-east-1" }); callback(); }); diff --git a/features/sts/step_definitions/sts.js b/features/sts/step_definitions/sts.js index 64f3d1005768..354f7d6c4c24 100644 --- a/features/sts/step_definitions/sts.js +++ b/features/sts/step_definitions/sts.js @@ -1,7 +1,7 @@ -const { STS } = require("../../../clients/client-sts"); const { Before, Given } = require("cucumber"); Before({ tags: "@sts" }, function (scenario, callback) { + const { STS } = require("../../../clients/client-sts"); this.service = new STS({}); callback(); }); diff --git a/features/swf/step_definitions/swf.js b/features/swf/step_definitions/swf.js index 654d7b8495da..b4e665ed68a4 100644 --- a/features/swf/step_definitions/swf.js +++ b/features/swf/step_definitions/swf.js @@ -1,7 +1,7 @@ -const { SWF } = require("../../../clients/client-swf"); const { Before, Given, Then, When } = require("cucumber"); Before({ tags: "@swf" }, function (scenario, callback) { + const { SWF } = require("../../../clients/client-swf"); this.service = new SWF({}); callback(); }); diff --git a/features/waf/step_definitions/waf.js b/features/waf/step_definitions/waf.js index d4070c6dd374..4baea8d55a64 100644 --- a/features/waf/step_definitions/waf.js +++ b/features/waf/step_definitions/waf.js @@ -1,7 +1,7 @@ -const { WAF } = require("../../../clients/client-waf"); const { Before } = require("cucumber"); Before({ tags: "@waf" }, function (scenario, callback) { + const { WAF } = require("../../../clients/client-waf"); this.service = new WAF({}); callback(); }); diff --git a/features/workspaces/step_definitions/workspaces.js b/features/workspaces/step_definitions/workspaces.js index 0d35b5df2521..8c00e206b426 100644 --- a/features/workspaces/step_definitions/workspaces.js +++ b/features/workspaces/step_definitions/workspaces.js @@ -1,7 +1,7 @@ -const { WorkSpaces } = require("../../../clients/client-workspaces"); const { Before } = require("cucumber"); Before({ tags: "@workspaces" }, function (scenario, callback) { + const { WorkSpaces } = require("../../../clients/client-workspaces"); this.service = new WorkSpaces({}); callback(); });