@zukhruf/testing 0.3.43 → 0.3.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +5 -3
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -98,7 +98,7 @@ test('a holder in another container', async () => {
98
98
  | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
99
99
  | `start(options)` | A container this process owns. It stays after it stops, so its logs remain, until disposal removes it. | `OwnedContainer` |
100
100
  | `serve(options)` | A dedicated server whose `internalPort` answers on `127.0.0.1` of this machine. Failure or disposal removes it. | `ServiceContainer` |
101
- | `reuse(options)` | One server per configuration on the engine, shared across processes and runs. | `ServiceContainer` |
101
+ | `reuse(options)` | One server per configuration and package version on the engine, shared across processes and runs. | `ServiceContainer` |
102
102
  | `run(options)` | A container that runs to completion. It gives the output and the exit code, and removes the container. A non-zero exit code does not throw. | `ExecResult` |
103
103
  | `volume()` | A named volume. | `OwnedVolume` |
104
104
  | `directory()` | A directory on the engine's host, for bind mounts. It has `mkdir`, `writeFile`, `readFile`, `chmod` and `symlink`. | `DockerDirectory` |
@@ -115,7 +115,9 @@ A `ServiceContainer` has `container`, `host` and `port`. On an SSH engine, the p
115
115
 
116
116
  `reuse(options)` finds the server for this configuration, or creates it. Docker reserves the name atomically, so concurrent processes attach to the same container. Different images, passwords, environments or labels select separate servers. A readiness failure leaves the shared server running for diagnosis. Dispose a reused server only after all its users finish: disposal stops it for every caller.
117
117
 
118
- Shared servers remain until you stop them:
118
+ A shared server belongs to one version of `@zukhruf/testing`. Its label `dev.zukhruf.testing.version` holds that version, and the version is part of its name. At the start of each run, the global setup removes each shared server on its engine whose version is not this version, and each shared server that has no version label ([ADR 0012](./docs/adr/0012-a-shared-server-belongs-to-one-version-of-the-package-and-the-global-setup-removes-the-servers-of-every-other-version.md)). Thus a project on an older version breaks when it uses the same engine: move it to the latest release.
119
+
120
+ When you change your own options in one version, for example the image tag, the old server stays. Stop it:
119
121
 
120
122
  ```sh
121
123
  docker ps -a --filter label=dev.zukhruf.testing.shared=1
@@ -148,7 +150,7 @@ The global teardown removes the labeled containers with their anonymous volumes,
148
150
 
149
151
  If cleanup fails, for example because the engine is unreachable, the global teardown prints the error, keeps the run's records, and sets exit code 1. The next run on the same engine removes what the run left, from any project of this user. This is recovery. Recovery does not touch a run while its runner or one of its recorded processes lives. The records are in `$XDG_STATE_HOME/zukhruf-testing/docker-runs` (`~/.local/state/zukhruf-testing/docker-runs` by default). Do not delete a record to hide a cleanup failure.
150
152
 
151
- The global setup selects the engine as the Docker CLI does, through `@zukhruf/docker`, so the Docker CLI is not necessary. It calls the engine only when a dead run on that engine has records to sweep.
153
+ The global setup selects the engine as the Docker CLI does, through `@zukhruf/docker`, so the Docker CLI is not necessary. It calls the engine at the start of each run, to remove the shared servers of other versions, and to sweep a dead run on that engine.
152
154
 
153
155
  On an SSH engine, run one test file at a time with `--test-concurrency=1` if the engine cannot take more. An SSH forward runs `cat` in a remote shell, so the SSH user needs a shell on the engine's host. The forward ends when the process that opened it ends, also when that process is killed.
154
156
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/testing",
3
- "version": "0.3.43",
3
+ "version": "0.3.44",
4
4
  "description": "Disposable fixtures for integration tests: Docker containers and database servers, SQLite and DuckDB databases, HTTP servers and streams, temporary directories and intercepted requests. Node's global setup and global teardown remove what a killed test run left behind.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -144,7 +144,7 @@
144
144
  "pg": "^8.23.1"
145
145
  },
146
146
  "dependencies": {
147
- "@zukhruf/docker": "^0.3.43",
147
+ "@zukhruf/docker": "^0.3.44",
148
148
  "nano-spawn": "^2.1.0",
149
149
  "p-memoize": "^8.0.0",
150
150
  "p-retry": "^8.0.1"