Skip to content

Commit 280c07a

Browse files
authored
test(clients): run endpoint tests in client mode (#7130)
* test(clients): run endpoint tests in client mode * fix(client-s3): defer endpoint validations to ruleset
1 parent bfe38d0 commit 280c07a

28 files changed

+386
-249
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ test-integration: bundles
4141
make test-endpoints
4242

4343
test-endpoints:
44-
npx jest -c ./tests/endpoints-2.0/jest.config.js --bail
44+
npx jest -c ./tests/endpoints-2.0/jest.config.js --bail --verbose false
4545

4646
test-e2e: bundles
4747
yarn g:vitest run -c vitest.config.e2e.ts --retry=4

clients/client-s3-control/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@aws-crypto/sha256-js": "5.2.0",
2525
"@aws-sdk/core": "*",
2626
"@aws-sdk/credential-provider-node": "*",
27+
"@aws-sdk/middleware-bucket-endpoint": "*",
2728
"@aws-sdk/middleware-host-header": "*",
2829
"@aws-sdk/middleware-logger": "*",
2930
"@aws-sdk/middleware-recursion-detection": "*",

clients/client-s3-control/src/S3ControlClient.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,10 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
707707
*/
708708
credentialDefaultProvider?: (input: any) => AwsCredentialIdentityProvider;
709709

710+
/**
711+
* Whether to override the request region with the region inferred from requested resource's ARN. Defaults to undefined.
712+
*/
713+
useArnRegion?: boolean | undefined | Provider<boolean | undefined>;
710714
/**
711715
* Value for how many times a request will be made at most in case of retry.
712716
*/

clients/client-s3-control/src/models/models_1.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
StorageLensTag,
2020
Tag,
2121
} from "./models_0";
22-
2322
import { S3ControlServiceException as __BaseException } from "./S3ControlServiceException";
2423

2524
/**

clients/client-s3-control/src/runtimeConfig.shared.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const getRuntimeConfig = (config: S3ControlClientConfig) => {
3333
serviceId: config?.serviceId ?? "S3 Control",
3434
signingEscapePath: config?.signingEscapePath ?? false,
3535
urlParser: config?.urlParser ?? parseUrl,
36+
useArnRegion: config?.useArnRegion ?? undefined,
3637
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
3738
utf8Encoder: config?.utf8Encoder ?? toUtf8,
3839
};

clients/client-s3-control/src/runtimeConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import packageInfo from "../package.json"; // eslint-disable-line
44

55
import { NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
66
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
7+
import { NODE_USE_ARN_REGION_CONFIG_OPTIONS } from "@aws-sdk/middleware-bucket-endpoint";
78
import { NODE_APP_ID_CONFIG_OPTIONS, createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-node";
89
import {
910
NODE_REGION_CONFIG_FILE_OPTIONS,
@@ -67,6 +68,7 @@ export const getRuntimeConfig = (config: S3ControlClientConfig) => {
6768
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
6869
streamCollector: config?.streamCollector ?? streamCollector,
6970
streamHasher: config?.streamHasher ?? streamHasher,
71+
useArnRegion: config?.useArnRegion ?? loadNodeConfig(NODE_USE_ARN_REGION_CONFIG_OPTIONS, loaderConfig),
7072
useDualstackEndpoint:
7173
config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
7274
useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),

clients/client-s3-control/test/S3Control.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe("S3Control Client", () => {
9898
expect(request.headers[HEADER_OUTPOST_ID]).eql(OutpostId);
9999
expect(request.headers[HEADER_ACCOUNT_ID]).eql(AccountId);
100100
expect(request.headers["authorization"]).contains(
101-
`Credential=${credentials.accessKeyId}/${dateStr}/${region}/s3/aws4_request`
101+
`Credential=${credentials.accessKeyId}/${dateStr}/${region}/s3-outposts/aws4_request`
102102
);
103103
});
104104
});
@@ -129,7 +129,7 @@ describe("S3Control Client", () => {
129129
expect(request.headers[HEADER_OUTPOST_ID]).eql(OutpostId);
130130
expect(request.headers[HEADER_ACCOUNT_ID]).eql(AccountId);
131131
expect(request.headers["authorization"]).contains(
132-
`Credential=${credentials.accessKeyId}/${dateStr}/${region}/s3/aws4_request`
132+
`Credential=${credentials.accessKeyId}/${dateStr}/${region}/s3-outposts/aws4_request`
133133
);
134134
});
135135
});

clients/client-s3/src/S3Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,9 +755,9 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
755755
signingEscapePath?: boolean;
756756

757757
/**
758-
* Whether to override the request region with the region inferred from requested resource's ARN. Defaults to false.
758+
* Whether to override the request region with the region inferred from requested resource's ARN. Defaults to undefined.
759759
*/
760-
useArnRegion?: boolean | Provider<boolean>;
760+
useArnRegion?: boolean | undefined | Provider<boolean | undefined>;
761761
/**
762762
* The internal function that inject utilities to runtime-specific stream to help users consume the data
763763
* @internal

clients/client-s3/src/models/models_0.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// smithy-typescript generated code
22
import { ExceptionOptionType as __ExceptionOptionType, SENSITIVE_STRING } from "@smithy/smithy-client";
3-
43
import { StreamingBlobTypes } from "@smithy/types";
54

65
import { S3ServiceException as __BaseException } from "./S3ServiceException";

clients/client-s3/src/models/models_1.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// smithy-typescript generated code
22
import { ExceptionOptionType as __ExceptionOptionType, SENSITIVE_STRING } from "@smithy/smithy-client";
3-
43
import { StreamingBlobTypes } from "@smithy/types";
54

65
import {
@@ -41,7 +40,6 @@ import {
4140
Tag,
4241
TransitionDefaultMinimumObjectSize,
4342
} from "./models_0";
44-
4543
import { S3ServiceException as __BaseException } from "./S3ServiceException";
4644

4745
/**

0 commit comments

Comments
 (0)