@specific.dev/spectest 0.77.0 → 0.78.0

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.
@@ -1,7 +1,5 @@
1
1
  import { type S3ClientLike } from "../s3.js";
2
2
  export interface S3Options {
3
- /** HTTP port the S3 API is served on. Default `9090`. */
4
- port?: number;
5
3
  /**
6
4
  * Buckets to create on first boot. The backing server's own `initialBuckets`
7
5
  * env is unreliable across versions, so the component creates them in `setup`
@@ -17,7 +15,7 @@ export interface S3Options {
17
15
  /**
18
16
  * Hostnames to additionally serve the store at over **HTTPS** (CA-trusted),
19
17
  * via the daemon's TLS-terminating reverse proxy. Optional — defaults to none;
20
- * the store is always reachable at `http://<key>:<port>` regardless. Set this
18
+ * the store is always reachable at `http://<key>:9090` regardless. Set this
21
19
  * only when the app under test hardcodes a specific prod S3 endpoint it can't
22
20
  * be told to override (`https://<bucket>.s3.amazonaws.com`, a provider's
23
21
  * storage host): the daemon mints a cert for each host and proxies to the
@@ -3,6 +3,15 @@ import { S3Client } from "../s3.js";
3
3
  // is the current release; avoid exactly 5.0.0, which crashed at startup on
4
4
  // Java 25 (`NoClassDefFoundError: KotlinBuiltIns$2`) — fixed in 5.1.0.
5
5
  const S3_IMAGE = "adobe/s3mock:5.1.0";
6
+ // Port the store listens on, fixed like the image and deliberately NOT an
7
+ // option. The backing server's HTTP port is baked into the image, and nothing
8
+ // the component returns can move it — so a `port` option could only relabel
9
+ // the ready check, the declared ports and the client endpoint while the
10
+ // container kept listening here. That is exactly what it did until 0.78.0: a
11
+ // project that passed one got 60 s of refused probes and an environment that
12
+ // never booted, with a healthy container beside it. A service reaches the
13
+ // store at `http://<key>:9090`.
14
+ const S3_PORT = 9090;
6
15
  /**
7
16
  * A ready-to-use, S3-compatible object store (backed by
8
17
  * [`adobe/s3mock`](https://github.com/adobe/S3Mock)), with an instrumented S3
@@ -35,7 +44,6 @@ const S3_IMAGE = "adobe/s3mock:5.1.0";
35
44
  * ```
36
45
  */
37
46
  export function s3(opts = {}) {
38
- const port = opts.port ?? 9090;
39
47
  const buckets = opts.buckets ?? [];
40
48
  const defaultBucket = opts.bucket ?? buckets[0];
41
49
  const accessKeyId = opts.accessKeyId ?? "s3";
@@ -43,16 +51,16 @@ export function s3(opts = {}) {
43
51
  const region = opts.region ?? "us-east-1";
44
52
  return {
45
53
  image: { type: "registry", reference: S3_IMAGE },
46
- ports: [port],
54
+ ports: [S3_PORT],
47
55
  ...(opts.env ? { env: opts.env } : {}),
48
56
  ...(opts.hosts
49
- ? { tls: opts.hosts.map((hostname) => ({ hostname, port })) }
57
+ ? { tls: opts.hosts.map((hostname) => ({ hostname, port: S3_PORT })) }
50
58
  : {}),
51
59
  // GET / returns the ListBuckets XML with 200 once the store is up.
52
- readyCheck: { type: "http", port, path: "/", timeoutSecs: 60 },
60
+ readyCheck: { type: "http", port: S3_PORT, path: "/", timeoutSecs: 60 },
53
61
  helpers: ({ name }) => ({
54
62
  client: new S3Client({
55
- endpoint: `http://${name}:${port}`,
63
+ endpoint: `http://${name}:${S3_PORT}`,
56
64
  region,
57
65
  accessKeyId,
58
66
  secretAccessKey,
@@ -67,7 +75,7 @@ export function s3(opts = {}) {
67
75
  // CreateBucket is a plain `PUT` on the bucket root; the store
68
76
  // returns 200 (or 409 if it already exists — idempotent enough to
69
77
  // ignore).
70
- const res = await fetch(`http://${name}:${port}/${bucket}`, {
78
+ const res = await fetch(`http://${name}:${S3_PORT}/${bucket}`, {
71
79
  method: "PUT",
72
80
  });
73
81
  if (!res.ok && res.status !== 409) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specific.dev/spectest",
3
- "version": "0.77.0",
3
+ "version": "0.78.0",
4
4
  "description": "Spectest SDK for defining test environments in TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -2,8 +2,6 @@ import type { ServiceDefinition } from "../index.js";
2
2
  import { S3Client, type S3ClientLike } from "../s3.js";
3
3
 
4
4
  export interface S3Options {
5
- /** HTTP port the S3 API is served on. Default `9090`. */
6
- port?: number;
7
5
  /**
8
6
  * Buckets to create on first boot. The backing server's own `initialBuckets`
9
7
  * env is unreliable across versions, so the component creates them in `setup`
@@ -19,7 +17,7 @@ export interface S3Options {
19
17
  /**
20
18
  * Hostnames to additionally serve the store at over **HTTPS** (CA-trusted),
21
19
  * via the daemon's TLS-terminating reverse proxy. Optional — defaults to none;
22
- * the store is always reachable at `http://<key>:<port>` regardless. Set this
20
+ * the store is always reachable at `http://<key>:9090` regardless. Set this
23
21
  * only when the app under test hardcodes a specific prod S3 endpoint it can't
24
22
  * be told to override (`https://<bucket>.s3.amazonaws.com`, a provider's
25
23
  * storage host): the daemon mints a cert for each host and proxies to the
@@ -51,6 +49,16 @@ export interface S3Helpers {
51
49
  // Java 25 (`NoClassDefFoundError: KotlinBuiltIns$2`) — fixed in 5.1.0.
52
50
  const S3_IMAGE = "adobe/s3mock:5.1.0";
53
51
 
52
+ // Port the store listens on, fixed like the image and deliberately NOT an
53
+ // option. The backing server's HTTP port is baked into the image, and nothing
54
+ // the component returns can move it — so a `port` option could only relabel
55
+ // the ready check, the declared ports and the client endpoint while the
56
+ // container kept listening here. That is exactly what it did until 0.78.0: a
57
+ // project that passed one got 60 s of refused probes and an environment that
58
+ // never booted, with a healthy container beside it. A service reaches the
59
+ // store at `http://<key>:9090`.
60
+ const S3_PORT = 9090;
61
+
54
62
  /**
55
63
  * A ready-to-use, S3-compatible object store (backed by
56
64
  * [`adobe/s3mock`](https://github.com/adobe/S3Mock)), with an instrumented S3
@@ -83,7 +91,6 @@ const S3_IMAGE = "adobe/s3mock:5.1.0";
83
91
  * ```
84
92
  */
85
93
  export function s3(opts: S3Options = {}) {
86
- const port = opts.port ?? 9090;
87
94
  const buckets = opts.buckets ?? [];
88
95
  const defaultBucket = opts.bucket ?? buckets[0];
89
96
  const accessKeyId = opts.accessKeyId ?? "s3";
@@ -92,16 +99,16 @@ export function s3(opts: S3Options = {}) {
92
99
 
93
100
  return {
94
101
  image: { type: "registry", reference: S3_IMAGE },
95
- ports: [port],
102
+ ports: [S3_PORT],
96
103
  ...(opts.env ? { env: opts.env } : {}),
97
104
  ...(opts.hosts
98
- ? { tls: opts.hosts.map((hostname) => ({ hostname, port })) }
105
+ ? { tls: opts.hosts.map((hostname) => ({ hostname, port: S3_PORT })) }
99
106
  : {}),
100
107
  // GET / returns the ListBuckets XML with 200 once the store is up.
101
- readyCheck: { type: "http" as const, port, path: "/", timeoutSecs: 60 },
108
+ readyCheck: { type: "http" as const, port: S3_PORT, path: "/", timeoutSecs: 60 },
102
109
  helpers: ({ name }: { name: string }): S3Helpers => ({
103
110
  client: new S3Client({
104
- endpoint: `http://${name}:${port}`,
111
+ endpoint: `http://${name}:${S3_PORT}`,
105
112
  region,
106
113
  accessKeyId,
107
114
  secretAccessKey,
@@ -116,7 +123,7 @@ export function s3(opts: S3Options = {}) {
116
123
  // CreateBucket is a plain `PUT` on the bucket root; the store
117
124
  // returns 200 (or 409 if it already exists — idempotent enough to
118
125
  // ignore).
119
- const res = await fetch(`http://${name}:${port}/${bucket}`, {
126
+ const res = await fetch(`http://${name}:${S3_PORT}/${bucket}`, {
120
127
  method: "PUT",
121
128
  });
122
129
  if (!res.ok && res.status !== 409) {