-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(packages): consolidate middleware integ tests
- Loading branch information
Showing
30 changed files
with
324 additions
and
39 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# @aws-sdk/aws-client-retry-test | ||
|
||
This is not a runtime or published package. | ||
|
||
This is a test spec. | ||
|
||
The purpose of this package is to perform integration tests on the retry-middleware. | ||
|
||
If tests in this package fail, the author should either fix their changes such that the API contract | ||
is maintained, or appropriately announce and safely deprecate the interfaces affected by incoming changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const base = require("../../jest.config.base.js"); | ||
|
||
module.exports = { | ||
...base, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"name": "@aws-sdk/aws-middleware-test", | ||
"description": "Integration test suite for AWS middleware", | ||
"version": "3.0.0", | ||
"scripts": { | ||
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", | ||
"build:cjs": "tsc -p tsconfig.cjs.json", | ||
"build:es": "tsc -p tsconfig.es.json", | ||
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", | ||
"build:types": "tsc -p tsconfig.types.json", | ||
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", | ||
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo", | ||
"test": "jest --coverage --passWithNoTests" | ||
}, | ||
"main": "./dist-cjs/index.js", | ||
"types": "./dist-types/index.d.ts", | ||
"module": "./dist-es/index.js", | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@aws-sdk/client-accessanalyzer": "*", | ||
"@aws-sdk/client-ec2": "*", | ||
"@aws-sdk/client-lambda": "*", | ||
"@aws-sdk/client-s3": "*", | ||
"@aws-sdk/client-s3-control": "*", | ||
"@aws-sdk/client-sagemaker": "*", | ||
"@aws-sdk/client-sagemaker-runtime": "*", | ||
"@aws-sdk/client-xray": "*", | ||
"tslib": "^2.5.0" | ||
}, | ||
"devDependencies": { | ||
"@tsconfig/node14": "1.0.3", | ||
"@types/node": "^12.7.5", | ||
"concurrently": "7.0.0", | ||
"downlevel-dts": "0.10.1", | ||
"typedoc": "0.23.23", | ||
"typescript": "~4.9.5" | ||
}, | ||
"overrides": { | ||
"typedoc": { | ||
"typescript": "~4.9.5" | ||
} | ||
}, | ||
"engines": { | ||
"node": ">=14.0.0" | ||
}, | ||
"typesVersions": { | ||
"<4.0": { | ||
"dist-types/*": [ | ||
"dist-types/ts3.4/*" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"dist-*/**" | ||
], | ||
"author": { | ||
"name": "AWS SDK for JavaScript Team", | ||
"url": "https://aws.amazon.com/javascript/" | ||
}, | ||
"license": "Apache-2.0", | ||
"private": true, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/aws/aws-sdk-js-v3.git", | ||
"directory": "private/aws-middleware-test" | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
private/aws-client-retry-test/readme.md → private/aws-middleware-test/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# @aws-sdk/aws-client-api-test | ||
# @aws-sdk/aws-middleware-test | ||
|
||
This is not a runtime or published package. | ||
|
||
This is a test spec. | ||
|
||
The purpose of this package is to perform integration tests on the retry-middleware. | ||
The purpose of this package is to perform integration tests on the AWS middleware. | ||
|
||
If tests in this package fail, the author should either fix their changes such that the API contract | ||
is maintained, or appropriately announce and safely deprecate the interfaces affected by incoming changes. |
2 changes: 1 addition & 1 deletion
2
...dleware-apply-body-checksum.integ.spec.ts → ...rc/middleware-apply-body-checksum.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...int/src/middleware-endpoint.integ.spec.ts → ...ware-test/src/middleware-endpoint.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-retry/src/middleware-retry.integ.spec.ts → ...dleware-test/src/middleware-retry.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "./tsconfig", | ||
"compilerOptions": { | ||
"outDir": "dist-cjs" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig", | ||
"compilerOptions": { | ||
"lib": ["dom"], | ||
"module": "esnext", | ||
"outDir": "dist-es" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "@tsconfig/node14/tsconfig.json", | ||
"compilerOptions": { | ||
"downlevelIteration": true, | ||
"importHelpers": true, | ||
"incremental": true, | ||
"removeComments": true, | ||
"resolveJsonModule": true, | ||
"rootDir": "src", | ||
"useUnknownInCatchVariables": false | ||
}, | ||
"exclude": ["test/"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "./tsconfig", | ||
"compilerOptions": { | ||
"removeComments": false, | ||
"declaration": true, | ||
"declarationDir": "dist-types", | ||
"emitDeclarationOnly": true | ||
}, | ||
"exclude": ["test/**/*", "dist-types/**/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./requests/test-http-handler"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./requests/test-http-handler"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { HttpHandler, HttpRequest, HttpResponse } from "@aws-sdk/protocol-http"; | ||
import { Client, HttpHandlerOptions, RequestHandlerOutput } from "@aws-sdk/types"; | ||
/** | ||
* Instructs {@link TestHttpHandler} how to match the handled request and the expected request. | ||
* @internal | ||
*/ | ||
export type Matcher = string | number | boolean | RegExp | null | undefined | ((value: any) => void); | ||
/** | ||
* @internal | ||
*/ | ||
export type HttpRequestMatcher = { | ||
protocol?: Matcher; | ||
hostname?: Matcher; | ||
port?: Matcher; | ||
path?: Matcher; | ||
query?: Record<string, Matcher> | Map<RegExp | string, Matcher>; | ||
headers?: Record<string, Matcher> | Map<RegExp | string, Matcher>; | ||
body?: Matcher; | ||
method?: Matcher; | ||
log?: boolean; | ||
}; | ||
/** | ||
* Supplied to test clients to assert correct requests. | ||
* @internal | ||
*/ | ||
export declare class TestHttpHandler implements HttpHandler { | ||
readonly matcher: HttpRequestMatcher; | ||
private static WATCHER; | ||
private originalSend?; | ||
private originalRequestHandler?; | ||
private client?; | ||
private assertions; | ||
constructor(matcher: HttpRequestMatcher); | ||
/** | ||
* @param client - to watch for requests. | ||
* @param matcher - optional override of this instance's matchers. | ||
* | ||
* Temporarily hooks the client.send call to check the outgoing request. | ||
*/ | ||
watch(client: Client<any, any, any>, matcher?: HttpRequestMatcher): void; | ||
/** | ||
* @throws TestHttpHandlerSuccess to indicate success (only way to control it). | ||
* @throws Error any other exception to indicate failure. | ||
*/ | ||
handle(request: HttpRequest, handlerOptions?: HttpHandlerOptions): Promise<RequestHandlerOutput<HttpResponse>>; | ||
destroy(): Promise<void>; | ||
private check; | ||
private checkAll; | ||
} | ||
/** | ||
* This is used as an interrupt signal for success. | ||
* It does not indicate a true error. | ||
* | ||
* @internal | ||
*/ | ||
export declare class TestHttpHandlerSuccess extends Error { | ||
static readonly ID: unique symbol; | ||
readonly id: symbol; | ||
} | ||
/** | ||
* @internal | ||
*/ | ||
export declare const requireRequestsFrom: (client: Client<any, any, any>) => { | ||
toMatch(matcher: HttpRequestMatcher): void; | ||
}; |
Oops, something went wrong.