Skip to content

Commit 8560f4c

Browse files
Update docs
1 parent b904ea6 commit 8560f4c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

docs/features/wait-strategies.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,14 @@ const container = await new GenericContainer("alpine")
256256
.withWaitStrategy(new ReadyAfterDelayWaitStrategy())
257257
.start();
258258
```
259+
260+
## Restart wait strategies
261+
262+
The default wait strategy used when a container restarts is the same as the one used when it starts. However sometimes a container behaves differently between its first start and subsequent starts. Postgres is one such example. For this reason you can specify a wait strategy specifically used for restarts:
263+
264+
```javascript
265+
const container = await new GenericContainer("postgres")
266+
.withWaitStrategy(Wait.forLogMessage(/.*database system is ready to accept connections.*/, 2))
267+
.withRestartWaitStrategy(Wait.forLogMessage(/.*database system is ready to accept connections.*/, 1))
268+
.start();
269+
```

docs/modules/postgresql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ tests very modular, since they always run on a brand-new database.
3838
not work if the database for the container is set to `"postgres"`.
3939

4040
<!--codeinclude-->
41-
[Test with a reusable Postgres container](../../packages/modules/postgresql/src/postgresql-container.test.ts) inside_block:createAndRestoreFromSnapshot
41+
[Test with a reusable Postgres container](../../packages/modules/postgresql/src/postgresql-container-snapshot.test.ts) inside_block:createAndRestoreFromSnapshot
4242
<!--/codeinclude-->

0 commit comments

Comments
 (0)