Skip to content

Commit

Permalink
docs: add README for E2E test scripts (#1423)
Browse files Browse the repository at this point in the history
Co-authored-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
  • Loading branch information
AllanZhengYP and trivikr committed Aug 7, 2020
1 parent 7783c69 commit f6f700d
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 3 deletions.
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -10,17 +10,17 @@
"clean": "yarn clear-build-cache && yarn clear-build-info && lerna clean",
"clear-build-cache": "rimraf ./packages/*/build ./packages/*/build-es ./clients/*/dist",
"clear-build-info": "rimraf ./packages/*/*.tsbuildinfo ./clients/*/*/*.tsbuildinfo",
"build:crypto-dependencies": "lerna run --scope '@aws-sdk/types' --scope '@aws-sdk/util-utf8-browser' --scope '@aws-sdk/util-locate-window' --scope '@aws-sdk/hash-node' --include-dependencies pretest",
"build:crypto-dependencies": "lerna run --scope '@aws-sdk/{types,util-utf8-browser,util-locate-window,hash-node}' --include-dependencies pretest",
"build:protocols": "yarn build:crypto-dependencies && lerna run --scope '@aws-sdk/aws-*' --include-dependencies pretest",
"build:smithy-client": "yarn build:crypto-dependencies && lerna run --scope '@aws-sdk/client-rds-data' --include-dependencies pretest",
"build:all": "yarn build:crypto-dependencies && lerna run build",
"pretest:all": "yarn build:all",
"test:all": "jest --coverage --passWithNoTests && lerna run test --scope @aws-sdk/fetch-http-handler --scope @aws-sdk/hash-blob-browser",
"test:all": "jest --coverage --passWithNoTests && lerna run test --scope '@aws-sdk/{fetch-http-handler,hash-blob-browser}'",
"test:functional": "jest --config tests/functional/jest.config.js --passWithNoTests",
"test:integration-legacy": "cucumber-js --fail-fast",
"test:integration": "jest --config jest.config.integ.js --passWithNoTests",
"test:protocols": "yarn build:protocols && lerna run test --scope '@aws-sdk/aws-*'",
"pretest:e2e": "yarn build:crypto-dependencies && lerna run --scope '{@aws-sdk/client-cloudformation, @aws-sdk/karma-credential-loader}' --include-dependencies pretest",
"pretest:e2e": "yarn build:crypto-dependencies && lerna run --scope '@aws-sdk/{client-cloudformation,karma-credential-loader}' --include-dependencies pretest",
"test:e2e": "node ./tests/e2e/index.js",
"local-publish": "node ./scripts/verdaccio-publish/index.js"
},
Expand Down
74 changes: 74 additions & 0 deletions tests/e2e/IntegTestResourcesStack.template.json
@@ -0,0 +1,74 @@
{
"Description": "Resources needed for SDK integration test",
"Resources": {
"IntegTestIdentityPool": {
"Type": "AWS::Cognito::IdentityPool",
"Properties": {
"AllowUnauthenticatedIdentities": true,
"CognitoIdentityProviders": [],
"IdentityPoolName": "IntegTestIdentityPool"
},
"Metadata": {
"aws:cdk:path": "IntegTestResourcesStack/IntegTestIdentityPool"
}
},
"IntegTestIdentityPoolUnauthRole85D387D0": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRoleWithWebIdentity",
"Effect": "Allow",
"Principal": {
"Federated": "cognito-identity.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": ["arn:aws:iam::aws:policy/AdministratorAccess"]
},
"Metadata": {
"aws:cdk:path": "IntegTestResourcesStack/IntegTestIdentityPoolUnauthRole/Resource"
}
},
"AttachUnauthRoleToIdentityPool": {
"Type": "AWS::Cognito::IdentityPoolRoleAttachment",
"Properties": {
"IdentityPoolId": {
"Ref": "IntegTestIdentityPool"
},
"Roles": {
"unauthenticated": {
"Fn::GetAtt": ["IntegTestIdentityPoolUnauthRole85D387D0", "Arn"]
}
}
},
"Metadata": {
"aws:cdk:path": "IntegTestResourcesStack/AttachUnauthRoleToIdentityPool"
}
},
"IntegTestBucketA93771AE": {
"Type": "AWS::S3::Bucket",
"Properties": {
"CorsConfiguration": {
"CorsRules": [
{
"AllowedHeaders": ["*"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
"AllowedOrigins": ["*"],
"ExposedHeaders": ["ETag", "Date", "x-amz-request-id", "x-amz-id-2"],
"MaxAge": 3000
}
]
}
},
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain",
"Metadata": {
"aws:cdk:path": "IntegTestResourcesStack/IntegTestBucket/Resource"
}
}
}
}
45 changes: 45 additions & 0 deletions tests/e2e/README.md
@@ -0,0 +1,45 @@
## Prerequisites

1. You have a CloudFormation stack called `SdkReleaseV3IntegTestResourcesStack` in the AWS account you used to run the
integration test. If not you can deploy the stack with:

```console
aws cloudformation deploy --stack-name SdkReleaseV3IntegTestResourcesStack --template-file ./IntegTestResourcesStack.template.json --capabilities CAPABILITY_IAM
```

1. You have `ubuntu/standard/4.0` docker image built. If not, please follow [the guide to build the image](https://github.com/aws/aws-codebuild-docker-images#how-to-build-docker-images).

## Steps

1. Launch the image:

```console
docker run -it --entrypoint sh aws/codebuild/standard:4.0 -c bash
```

Get 12-digit container ID by:

```console
docker container ls
```

Note that you should run this command outside the launched container.

1. Copy the working SDK repository into the container by:

```console
docker cp -a path/to/sdk [12-digit-container-id]:/path/to/working/dir
```

1. Inside the container, configure the credentials to be the one that has permission to the `SdkReleaseV3IntegTestResourcesStack`
stack. Region also needs to be configured. You can configure the credentials and region following
[this guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html).

1. Change directory to the SDK directory, make sure the clients that contains end-to-end test suites has been built to
JS files.

1. Run the end-to-end test suite from the SDK root:

```console
yarn test:e2e
```

0 comments on commit f6f700d

Please sign in to comment.