Supported container runtimes
S3Mock
登录后可跨设备保存划线和私人笔记登录
S3Mock
Install
1npm install @testcontainers/s3mock --save-devExamples
These examples use the following libraries:
-
1npm install @aws-sdk/client-s3
Choose an image from the container registry and substitute IMAGE.
Create a S3 bucket
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17await using container = await new S3MockContainer(IMAGE).start();
const client = new S3Client({
endpoint: container.getHttpConnectionUrl(),
forcePathStyle: true,
region: "auto",
credentials: {
secretAccessKey: container.getSecretAccessKey(),
accessKeyId: container.getAccessKeyId(),
},
});
const input = { Bucket: "testcontainers" };
const command = new CreateBucketCommand(input);
expect((await client.send(command)).$metadata.httpStatusCode).toEqual(200);
expect((await client.send(new HeadBucketCommand(input))).$metadata.httpStatusCode).toEqual(200);评论
登录后参与评论
正在加载评论…
KnowForge