Skip to content

Commit 0be55f4

Browse files
Merge branch 'main' into codex/azurite-https-oauth-996
2 parents 45af182 + f1a9a0b commit 0be55f4

34 files changed

Lines changed: 452 additions & 92 deletions

AGENTS.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ It captures practical rules that prevent avoidable CI and PR churn.
1313
- Tests should verify observable behavior changes, not only internal/config state.
1414
- Example: for a security option, assert a real secure/insecure behavior difference.
1515
- Test-only helper files under `src` (for example `*-test-utils.ts`) must be explicitly excluded from package `tsconfig.build.json` so they are not emitted into `build` and accidentally published.
16+
- Vitest runs tests concurrently by default (`sequence.concurrent: true` in `vitest.config.ts`).
17+
- Tests that rely on shared/global mocks (for example `vi.spyOn` on shared loggers/singletons) can be flaky due to interleaving or automatic mock resets.
18+
- Prefer asserting observable behavior instead of shared global mock state when possible.
19+
- If a test must depend on shared/global mock state, use `it.sequential(...)` or `describe.sequential(...)`.
1620

1721
## Permission and Escalation
1822

@@ -30,16 +34,17 @@ It captures practical rules that prevent avoidable CI and PR churn.
3034
2. Create a branch prefixed with `codex/`.
3135
3. Implement scoped changes only.
3236
4. Run required checks: `npm run format`, `npm run lint`, and targeted tests.
33-
5. Verify git diff only contains intended files. If changes are still being discussed, share the diff and get user approval before committing or pushing.
34-
6. Commit with focused message(s), using `git commit --no-verify`.
35-
7. Push branch. Ask for explicit user permission before any force push.
36-
8. Open PR against `main` using a human-readable title (no `feat(...)` / `fix(...)` prefixes).
37-
9. Before posting any comment on GitHub issues or PRs, share the proposed message with the user and get explicit approval.
37+
5. Verify git diff only contains intended files.
38+
6. Never commit, push, or post on GitHub (issues, PRs, or comments) without first sharing the proposed diff/message and getting explicit user approval.
39+
7. Commit with focused message(s), using `git commit --no-verify`.
40+
8. Push branch. Ask for explicit user permission before any force push.
41+
9. Open PR against `main` using a human-readable title (no `feat(...)` / `fix(...)` prefixes).
3842
10. Add labels for both change type and semantic version impact.
3943
11. Ensure PR body includes:
4044
- summary of changes
4145
- verification commands run
4246
- test results summary
47+
- if semver impact is not `major`, evidence that the change is not breaking
4348
- `Closes #<issue>`
4449

4550
## Labels

docs/features/compose.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ Provide a list of service names to only start those services:
2929

3030
```js
3131
const environment = await new DockerComposeEnvironment(composeFilePath, composeFile)
32-
.up(["redis-1", "postgres-1"]);
32+
.up(["redis", "postgres"]);
3333
```
3434

3535
### With wait strategy
3636

37+
`withWaitStrategy` expects **container names**, not service names. With Docker Compose v2, the default container name for the first replica is usually `<service>-1`.
38+
3739
```js
3840
const environment = await new DockerComposeEnvironment(composeFilePath, composeFile)
3941
.withWaitStrategy("redis-1", Wait.forLogMessage("Ready to accept connections"))
4042
.withWaitStrategy("postgres-1", Wait.forHealthCheck())
41-
.up();
43+
.up(["redis", "postgres"]);
4244
```
4345

4446
### With a default wait strategy
@@ -187,7 +189,7 @@ await environment.stop();
187189

188190
## Interacting with the containers
189191

190-
Interact with the containers in your compose environment as you would any other Generic Container. Note that the container name suffix has changed from `_` to `-` between docker-compose v1 and v2 respectively.
192+
Interact with the containers in your compose environment as you would any other Generic Container. Compose-managed container names use the `<service-name>-<index>` format.
191193

192194
```js
193195
const container = environment.getContainer("alpine-1");

docs/features/containers.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ const container = await new GenericContainer("alpine")
137137
tar: nodeReadable,
138138
target: "/some/nested/remotedir"
139139
}])
140+
.withCopyToContainerOptions({
141+
copyUIDGID: true
142+
})
140143
.start();
141144
```
142145

@@ -157,9 +160,13 @@ container.copyContentToContainer([{
157160
content: "hello world",
158161
target: "/remote/file2.txt"
159162
}])
160-
container.copyArchiveToContainer(nodeReadable, "/some/nested/remotedir");
163+
container.copyArchiveToContainer(nodeReadable, "/some/nested/remotedir", {
164+
copyUIDGID: true
165+
});
161166
```
162167

168+
When copying files, symbolic links in `source` are followed and the linked file content is copied into the container.
169+
163170
An optional `mode` can be specified in octal for setting file permissions:
164171

165172
```js
@@ -182,6 +189,21 @@ const container = await new GenericContainer("alpine")
182189
.start();
183190
```
184191

192+
Archive copy options can also be specified:
193+
194+
```js
195+
const container = await new GenericContainer("alpine")
196+
.withCopyToContainerOptions({
197+
copyUIDGID: true,
198+
noOverwriteDirNonDir: true
199+
})
200+
.start();
201+
```
202+
203+
- `copyUIDGID`: preserve UID/GID from tar archive entries.
204+
Note: Podman may ignore this for archive copy in some cases, see [containers/podman#27538](https://github.com/containers/podman/issues/27538).
205+
- `noOverwriteDirNonDir`: fail if extraction would replace a file with a directory (or vice versa).
206+
185207
### Copy archive from container
186208

187209
Files and directories can be fetched from a started or stopped container as a tar archive. The archive is returned as a readable stream:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
version: "3.5"
22

33
services:
4-
service_1:
4+
service-a:
55
image: cristianrgreco/testcontainer:1.1.14
66
ports:
77
- 8080
8-
service_2:
8+
service-b:
99
image: cristianrgreco/testcontainer:1.1.14
1010
ports:
1111
- 8080
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!example2
3+
!example4/nested
4+
!example5/example5.txt
5+
!index.js
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:10-alpine
2+
3+
MAINTAINER Cristian Greco
4+
5+
EXPOSE 8080
6+
7+
RUN apk add --no-cache curl dumb-init
8+
9+
RUN npm init -y \
10+
&& npm install express@4.16.4
11+
12+
WORKDIR /opt/app
13+
14+
COPY . .
15+
16+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
17+
CMD ["node", "index.js"]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hello world

packages/testcontainers/fixtures/docker/docker-with-dockerignore-nested-exclusions/example2/example2.txt

Whitespace-only changes.

packages/testcontainers/fixtures/docker/docker-with-dockerignore-nested-exclusions/example3/example3.txt

Whitespace-only changes.

packages/testcontainers/fixtures/docker/docker-with-dockerignore-nested-exclusions/example4/nested/example4.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)