@milaboratories/pl-deployments 2.15.7 → 2.15.8

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 (106) hide show
  1. package/README.md +18 -5
  2. package/dist/common/os_and_arch.cjs +19 -19
  3. package/dist/common/os_and_arch.cjs.map +1 -1
  4. package/dist/common/os_and_arch.js +19 -19
  5. package/dist/common/os_and_arch.js.map +1 -1
  6. package/dist/common/pl_binary.cjs +9 -9
  7. package/dist/common/pl_binary.cjs.map +1 -1
  8. package/dist/common/pl_binary.d.ts +6 -6
  9. package/dist/common/pl_binary.d.ts.map +1 -1
  10. package/dist/common/pl_binary.js +9 -9
  11. package/dist/common/pl_binary.js.map +1 -1
  12. package/dist/common/pl_binary_download.cjs +16 -16
  13. package/dist/common/pl_binary_download.cjs.map +1 -1
  14. package/dist/common/pl_binary_download.d.ts +6 -6
  15. package/dist/common/pl_binary_download.d.ts.map +1 -1
  16. package/dist/common/pl_binary_download.js +16 -16
  17. package/dist/common/pl_binary_download.js.map +1 -1
  18. package/dist/common/pl_version.cjs +1 -1
  19. package/dist/common/pl_version.cjs.map +1 -1
  20. package/dist/common/pl_version.js +1 -1
  21. package/dist/common/pl_version.js.map +1 -1
  22. package/dist/index.d.ts +5 -5
  23. package/dist/local/options.d.ts +4 -4
  24. package/dist/local/pid.cjs +1 -1
  25. package/dist/local/pid.cjs.map +1 -1
  26. package/dist/local/pid.js +1 -1
  27. package/dist/local/pid.js.map +1 -1
  28. package/dist/local/pl.cjs +26 -26
  29. package/dist/local/pl.cjs.map +1 -1
  30. package/dist/local/pl.d.ts +8 -8
  31. package/dist/local/pl.d.ts.map +1 -1
  32. package/dist/local/pl.js +26 -26
  33. package/dist/local/pl.js.map +1 -1
  34. package/dist/local/process.cjs +16 -16
  35. package/dist/local/process.cjs.map +1 -1
  36. package/dist/local/process.d.ts +2 -2
  37. package/dist/local/process.js +16 -16
  38. package/dist/local/process.js.map +1 -1
  39. package/dist/local/trace.cjs.map +1 -1
  40. package/dist/local/trace.d.ts +1 -1
  41. package/dist/local/trace.js.map +1 -1
  42. package/dist/package.json.cjs +2 -1
  43. package/dist/package.json.cjs.map +1 -1
  44. package/dist/package.json.js +2 -1
  45. package/dist/package.json.js.map +1 -1
  46. package/dist/ssh/__tests__/common-utils.d.ts +2 -2
  47. package/dist/ssh/__tests__/common-utils.d.ts.map +1 -1
  48. package/dist/ssh/connection_info.cjs +13 -7
  49. package/dist/ssh/connection_info.cjs.map +1 -1
  50. package/dist/ssh/connection_info.d.ts +1 -1
  51. package/dist/ssh/connection_info.d.ts.map +1 -1
  52. package/dist/ssh/connection_info.js +13 -7
  53. package/dist/ssh/connection_info.js.map +1 -1
  54. package/dist/ssh/pl.cjs +79 -76
  55. package/dist/ssh/pl.cjs.map +1 -1
  56. package/dist/ssh/pl.d.ts +18 -18
  57. package/dist/ssh/pl.d.ts.map +1 -1
  58. package/dist/ssh/pl.js +79 -76
  59. package/dist/ssh/pl.js.map +1 -1
  60. package/dist/ssh/pl_paths.cjs +13 -13
  61. package/dist/ssh/pl_paths.cjs.map +1 -1
  62. package/dist/ssh/pl_paths.d.ts.map +1 -1
  63. package/dist/ssh/pl_paths.js +13 -13
  64. package/dist/ssh/pl_paths.js.map +1 -1
  65. package/dist/ssh/ssh.cjs +43 -40
  66. package/dist/ssh/ssh.cjs.map +1 -1
  67. package/dist/ssh/ssh.d.ts +9 -9
  68. package/dist/ssh/ssh.d.ts.map +1 -1
  69. package/dist/ssh/ssh.js +43 -40
  70. package/dist/ssh/ssh.js.map +1 -1
  71. package/dist/ssh/ssh_errors.cjs +7 -5
  72. package/dist/ssh/ssh_errors.cjs.map +1 -1
  73. package/dist/ssh/ssh_errors.d.ts.map +1 -1
  74. package/dist/ssh/ssh_errors.js +7 -5
  75. package/dist/ssh/ssh_errors.js.map +1 -1
  76. package/dist/ssh/supervisord.cjs +15 -13
  77. package/dist/ssh/supervisord.cjs.map +1 -1
  78. package/dist/ssh/supervisord.d.ts +2 -2
  79. package/dist/ssh/supervisord.d.ts.map +1 -1
  80. package/dist/ssh/supervisord.js +15 -13
  81. package/dist/ssh/supervisord.js.map +1 -1
  82. package/package.json +37 -36
  83. package/src/common/os_and_arch.ts +19 -19
  84. package/src/common/pl_binary.ts +30 -27
  85. package/src/common/pl_binary_download.ts +80 -59
  86. package/src/common/pl_version.ts +2 -2
  87. package/src/index.ts +5 -5
  88. package/src/local/config.test.yaml +19 -19
  89. package/src/local/options.ts +4 -4
  90. package/src/local/pid.ts +4 -4
  91. package/src/local/pl.test.ts +245 -253
  92. package/src/local/pl.ts +45 -50
  93. package/src/local/process.ts +21 -21
  94. package/src/local/trace.ts +1 -1
  95. package/src/ssh/__tests__/common-utils.ts +21 -19
  96. package/src/ssh/__tests__/pl-docker.test.ts +68 -59
  97. package/src/ssh/__tests__/ssh-docker.test.ts +152 -90
  98. package/src/ssh/__tests__/ssh-upload.test.ts +42 -31
  99. package/src/ssh/connection_info.ts +33 -27
  100. package/src/ssh/pl.test.ts +15 -13
  101. package/src/ssh/pl.ts +228 -143
  102. package/src/ssh/pl_paths.ts +22 -18
  103. package/src/ssh/ssh.ts +151 -74
  104. package/src/ssh/ssh_errors.test.ts +39 -39
  105. package/src/ssh/ssh_errors.ts +8 -6
  106. package/src/ssh/supervisord.ts +28 -28
@@ -1,26 +1,24 @@
1
- import { test, expect } from 'vitest';
2
- import { localPlatformaInit } from './pl';
3
- import { ConsoleLoggerAdapter, sleep } from '@milaboratories/ts-helpers';
4
- import * as fs from 'fs/promises';
5
- import upath from 'upath';
6
- import { ProcessOptions, processStop } from './process';
7
- import * as yaml from 'yaml';
8
- import * as os from 'os';
9
- import { mergeDefaultOps } from './pl';
10
- import type { LocalPlOptions, LocalPlOptionsFull } from './pl';
11
- import { plProcessOps } from './pl';
12
- import { describe, it, beforeEach, afterEach } from 'vitest';
13
- import { getPorts } from '@milaboratories/pl-config';
1
+ import { test, expect } from "vitest";
2
+ import { localPlatformaInit } from "./pl";
3
+ import { ConsoleLoggerAdapter, sleep } from "@milaboratories/ts-helpers";
4
+ import * as fs from "fs/promises";
5
+ import upath from "upath";
6
+ import { ProcessOptions, processStop } from "./process";
7
+ import * as yaml from "yaml";
8
+ import * as os from "os";
9
+ import { mergeDefaultOps } from "./pl";
10
+ import type { LocalPlOptions, LocalPlOptionsFull } from "./pl";
11
+ import { plProcessOps } from "./pl";
12
+ import { getPorts } from "@milaboratories/pl-config";
14
13
 
15
14
  test(
16
- 'should start and stop platforma of the current version with hardcoded config',
15
+ "should start and stop platforma of the current version with hardcoded config",
17
16
  { timeout: 25000 },
18
17
  async ({ expect }) => {
19
18
  const logger = new ConsoleLoggerAdapter();
20
19
  const config = await readTestConfig();
21
20
 
22
-
23
- logger.info('Config:\n' + yaml.stringify(config));
21
+ logger.info("Config:\n" + yaml.stringify(config));
24
22
 
25
23
  const dir = await prepareDirForTestConfig();
26
24
 
@@ -43,7 +41,7 @@ test(
43
41
  );
44
42
 
45
43
  test(
46
- 'should close old platforma when starting a new one if the option is set',
44
+ "should close old platforma when starting a new one if the option is set",
47
45
  { timeout: 35000 },
48
46
  async ({ expect }) => {
49
47
  const logger = new ConsoleLoggerAdapter();
@@ -74,7 +72,7 @@ test(
74
72
  );
75
73
 
76
74
  test(
77
- 'should restart platforma if restart option was provided',
75
+ "should restart platforma if restart option was provided",
78
76
  { timeout: 25000 },
79
77
  async ({ expect }) => {
80
78
  const logger = new ConsoleLoggerAdapter();
@@ -108,19 +106,19 @@ test(
108
106
  );
109
107
 
110
108
  async function readTestConfig() {
111
- const testConfig = upath.join(__dirname, 'config.test.yaml');
109
+ const testConfig = upath.join(__dirname, "config.test.yaml");
112
110
  const config = (await fs.readFile(testConfig)).toString();
113
111
 
114
112
  const parsed = yaml.parse(config);
115
113
  parsed.license.value = process.env.MI_LICENSE;
116
- if ((parsed.license.value ?? '') == '') {
114
+ if ((parsed.license.value ?? "") == "") {
117
115
  parsed.license.file = process.env.MI_LICENSE_FILE;
118
- if ((parsed.license.file ?? '') == '') {
119
- parsed.license.file = upath.join(os.homedir(), '.pl.license');
116
+ if ((parsed.license.file ?? "") == "") {
117
+ parsed.license.file = upath.join(os.homedir(), ".pl.license");
120
118
  }
121
119
  }
122
120
 
123
- const freePort = await getPorts({ type: 'pickFree' });
121
+ const freePort = await getPorts({ type: "pickFree" });
124
122
  parsed.core.grpc.listen = `127.0.0.1:${freePort.grpc}`;
125
123
  parsed.core.http.listen = `127.0.0.1:${freePort.http}`;
126
124
 
@@ -128,13 +126,13 @@ async function readTestConfig() {
128
126
  }
129
127
 
130
128
  async function prepareDirForTestConfig() {
131
- const dir = upath.join(__dirname, '..', '..', '.test');
129
+ const dir = upath.join(__dirname, "..", "..", ".test");
132
130
  await fs.rm(dir, { recursive: true, force: true });
133
131
  await fs.mkdir(dir);
134
132
 
135
- await fs.mkdir(upath.join(dir, 'storages', 'work'), { recursive: true });
136
- await fs.mkdir(upath.join(dir, 'storages', 'main'), { recursive: true });
137
- await fs.mkdir(upath.join(dir, 'packages'), { recursive: true });
133
+ await fs.mkdir(upath.join(dir, "storages", "work"), { recursive: true });
134
+ await fs.mkdir(upath.join(dir, "storages", "main"), { recursive: true });
135
+ await fs.mkdir(upath.join(dir, "packages"), { recursive: true });
138
136
 
139
137
  return dir;
140
138
  }
@@ -147,148 +145,148 @@ const mergeDefaultOpsCases: {
147
145
  };
148
146
  expected: LocalPlOptionsFull;
149
147
  }[] = [
150
- {
151
- name: 'should set default values when minimal input is provided',
152
- input: {
153
- ops: {
154
- workingDir: '/test',
155
- config: 'config',
156
- plBinary: { type: 'Download', version: '1.29.2' },
157
- },
158
- numCpu: 4,
159
- },
160
- expected: {
161
- workingDir: '/test',
162
- config: 'config',
163
- plBinary: { type: 'Download', version: '1.29.2' },
164
- spawnOptions: {
165
- env: {
166
- GOMAXPROCS: '4',
167
- },
168
- },
169
- closeOld: true,
148
+ {
149
+ name: "should set default values when minimal input is provided",
150
+ input: {
151
+ ops: {
152
+ workingDir: "/test",
153
+ config: "config",
154
+ plBinary: { type: "Download", version: "1.29.2" },
170
155
  },
156
+ numCpu: 4,
171
157
  },
172
- {
173
- name: 'should override outermost options when provided',
174
- input: {
175
- ops: {
176
- workingDir: '/test',
177
- config: 'config',
178
- // we provided plBinary and closeOld, they should appear in the result
179
- plBinary: { type: 'Local', path: '/custom/binary' },
180
- closeOld: false,
158
+ expected: {
159
+ workingDir: "/test",
160
+ config: "config",
161
+ plBinary: { type: "Download", version: "1.29.2" },
162
+ spawnOptions: {
163
+ env: {
164
+ GOMAXPROCS: "4",
181
165
  },
182
- numCpu: 2,
183
166
  },
184
- expected: {
185
- workingDir: '/test',
186
- config: 'config',
187
- spawnOptions: {
188
- env: {
189
- GOMAXPROCS: '2',
190
- },
191
- },
192
- plBinary: { type: 'Local', path: '/custom/binary' },
167
+ closeOld: true,
168
+ },
169
+ },
170
+ {
171
+ name: "should override outermost options when provided",
172
+ input: {
173
+ ops: {
174
+ workingDir: "/test",
175
+ config: "config",
176
+ // we provided plBinary and closeOld, they should appear in the result
177
+ plBinary: { type: "Local", path: "/custom/binary" },
193
178
  closeOld: false,
194
179
  },
180
+ numCpu: 2,
195
181
  },
196
- {
197
- name: 'should merge env variables when provided',
198
- input: {
199
- ops: {
200
- workingDir: '/test',
201
- config: 'config',
202
- plBinary: { type: 'Download', version: '1.29.2' },
203
- spawnOptions: {
204
- env: {
205
- NODE_ENV: 'test',
206
- DEBUG: 'true',
207
- },
208
- },
182
+ expected: {
183
+ workingDir: "/test",
184
+ config: "config",
185
+ spawnOptions: {
186
+ env: {
187
+ GOMAXPROCS: "2",
209
188
  },
210
- numCpu: 3,
211
189
  },
212
- expected: {
213
- workingDir: '/test',
214
- config: 'config',
215
- plBinary: { type: 'Download', version: '1.29.2' },
190
+ plBinary: { type: "Local", path: "/custom/binary" },
191
+ closeOld: false,
192
+ },
193
+ },
194
+ {
195
+ name: "should merge env variables when provided",
196
+ input: {
197
+ ops: {
198
+ workingDir: "/test",
199
+ config: "config",
200
+ plBinary: { type: "Download", version: "1.29.2" },
216
201
  spawnOptions: {
217
202
  env: {
218
- GOMAXPROCS: '3',
219
- NODE_ENV: 'test',
220
- DEBUG: 'true',
203
+ NODE_ENV: "test",
204
+ DEBUG: "true",
221
205
  },
222
206
  },
223
- closeOld: true,
224
207
  },
208
+ numCpu: 3,
225
209
  },
226
- {
227
- name: 'should override other spawnOptions properties',
228
- input: {
229
- ops: {
230
- workingDir: '/test',
231
- config: 'config',
232
- plBinary: { type: 'Download', version: '1.29.2' },
233
- spawnOptions: {
234
- stdio: 'inherit',
235
- detached: true,
236
- },
210
+ expected: {
211
+ workingDir: "/test",
212
+ config: "config",
213
+ plBinary: { type: "Download", version: "1.29.2" },
214
+ spawnOptions: {
215
+ env: {
216
+ GOMAXPROCS: "3",
217
+ NODE_ENV: "test",
218
+ DEBUG: "true",
237
219
  },
238
- numCpu: 2,
239
220
  },
240
- expected: {
241
- workingDir: '/test',
242
- config: 'config',
243
- plBinary: { type: 'Download', version: '1.29.2' },
221
+ closeOld: true,
222
+ },
223
+ },
224
+ {
225
+ name: "should override other spawnOptions properties",
226
+ input: {
227
+ ops: {
228
+ workingDir: "/test",
229
+ config: "config",
230
+ plBinary: { type: "Download", version: "1.29.2" },
244
231
  spawnOptions: {
245
- env: {
246
- GOMAXPROCS: '2',
247
- },
248
- stdio: 'inherit',
232
+ stdio: "inherit",
249
233
  detached: true,
250
234
  },
251
- closeOld: true,
252
235
  },
236
+ numCpu: 2,
253
237
  },
254
- {
255
- name: 'should handle complex case with multiple overrides',
256
- input: {
257
- ops: {
258
- workingDir: '/test',
259
- config: 'config',
260
- plBinary: { type: 'Local', path: '/custom/binary' },
261
- closeOld: false,
262
- spawnOptions: {
263
- env: {
264
- NODE_ENV: 'production',
265
- LOG_LEVEL: 'debug',
266
- },
267
- cwd: '/custom/dir',
268
- windowsHide: false,
269
- },
238
+ expected: {
239
+ workingDir: "/test",
240
+ config: "config",
241
+ plBinary: { type: "Download", version: "1.29.2" },
242
+ spawnOptions: {
243
+ env: {
244
+ GOMAXPROCS: "2",
270
245
  },
271
- numCpu: 6,
246
+ stdio: "inherit",
247
+ detached: true,
272
248
  },
273
- expected: {
274
- workingDir: '/test',
275
- config: 'config',
276
- plBinary: { type: 'Local', path: '/custom/binary' },
249
+ closeOld: true,
250
+ },
251
+ },
252
+ {
253
+ name: "should handle complex case with multiple overrides",
254
+ input: {
255
+ ops: {
256
+ workingDir: "/test",
257
+ config: "config",
258
+ plBinary: { type: "Local", path: "/custom/binary" },
277
259
  closeOld: false,
278
260
  spawnOptions: {
279
261
  env: {
280
- GOMAXPROCS: '6',
281
- NODE_ENV: 'production',
282
- LOG_LEVEL: 'debug',
262
+ NODE_ENV: "production",
263
+ LOG_LEVEL: "debug",
283
264
  },
284
- cwd: '/custom/dir',
265
+ cwd: "/custom/dir",
285
266
  windowsHide: false,
286
267
  },
287
268
  },
269
+ numCpu: 6,
288
270
  },
289
- ];
271
+ expected: {
272
+ workingDir: "/test",
273
+ config: "config",
274
+ plBinary: { type: "Local", path: "/custom/binary" },
275
+ closeOld: false,
276
+ spawnOptions: {
277
+ env: {
278
+ GOMAXPROCS: "6",
279
+ NODE_ENV: "production",
280
+ LOG_LEVEL: "debug",
281
+ },
282
+ cwd: "/custom/dir",
283
+ windowsHide: false,
284
+ },
285
+ },
286
+ },
287
+ ];
290
288
 
291
- test.each(mergeDefaultOpsCases)('mergeDefaultOps: $name', ({ name, input, expected }) => {
289
+ test.each(mergeDefaultOpsCases)("mergeDefaultOps: $name", ({ input, expected }) => {
292
290
  const result = mergeDefaultOps(input.ops, input.numCpu);
293
291
 
294
292
  expect(result).toEqual(expected);
@@ -304,148 +302,142 @@ const plProcessOpsCases: {
304
302
  };
305
303
  expected: ProcessOptions;
306
304
  }[] = [
307
- {
308
- name: 'should set basic options with minimal input',
309
- input: {
310
- binaryPath: '/path/to/binary',
311
- configPath: '/path/to/config.yaml',
312
- ops: {
313
- workingDir: '/work/dir',
314
- config: 'config-content',
315
- plBinary: { type: 'Download', version: '1.29.2' },
316
- spawnOptions: {},
317
- closeOld: true,
318
- },
319
- workDir: '/work/dir',
320
- },
321
- expected: {
322
- cmd: '/path/to/binary',
323
- args: ['--config', '/path/to/config.yaml'],
324
- opts: {
325
- env: {},
326
- cwd: '/work/dir',
327
- stdio: ['pipe', 'ignore', 'inherit'],
328
- windowsHide: true,
329
- },
305
+ {
306
+ name: "should set basic options with minimal input",
307
+ input: {
308
+ binaryPath: "/path/to/binary",
309
+ configPath: "/path/to/config.yaml",
310
+ ops: {
311
+ workingDir: "/work/dir",
312
+ config: "config-content",
313
+ plBinary: { type: "Download", version: "1.29.2" },
314
+ spawnOptions: {},
315
+ closeOld: true,
330
316
  },
317
+ workDir: "/work/dir",
331
318
  },
332
- {
333
- name: 'should merge environment variables when provided',
334
- input: {
335
- binaryPath: '/path/to/binary',
336
- configPath: '/config.yaml',
337
- ops: {
338
- workingDir: '/work',
339
- config: 'content',
340
- plBinary: { type: 'Download', version: '1.29.2' },
341
- spawnOptions: {
342
- env: {
343
- DEBUG: 'true',
344
- LOG_LEVEL: 'info',
345
- },
346
- },
347
- closeOld: true,
348
- },
349
- workDir: '/work',
319
+ expected: {
320
+ cmd: "/path/to/binary",
321
+ args: ["--config", "/path/to/config.yaml"],
322
+ opts: {
323
+ env: {},
324
+ cwd: "/work/dir",
325
+ stdio: ["pipe", "ignore", "inherit"],
326
+ windowsHide: true,
350
327
  },
351
- expected: {
352
- cmd: '/path/to/binary',
353
- args: ['--config', '/config.yaml'],
354
- opts: {
328
+ },
329
+ },
330
+ {
331
+ name: "should merge environment variables when provided",
332
+ input: {
333
+ binaryPath: "/path/to/binary",
334
+ configPath: "/config.yaml",
335
+ ops: {
336
+ workingDir: "/work",
337
+ config: "content",
338
+ plBinary: { type: "Download", version: "1.29.2" },
339
+ spawnOptions: {
355
340
  env: {
356
- DEBUG: 'true',
357
- LOG_LEVEL: 'info',
341
+ DEBUG: "true",
342
+ LOG_LEVEL: "info",
358
343
  },
359
- cwd: '/work',
360
- stdio: ['pipe', 'ignore', 'inherit'],
361
- windowsHide: true,
362
344
  },
345
+ closeOld: true,
363
346
  },
347
+ workDir: "/work",
364
348
  },
365
- {
366
- name: 'should override spawn options when provided',
367
- input: {
368
- binaryPath: '/binary',
369
- configPath: '/config.yaml',
370
- ops: {
371
- workingDir: '/work',
372
- config: 'content',
373
- plBinary: { type: 'Download', version: '1.29.2' },
374
- spawnOptions: {
375
- stdio: 'inherit',
376
- detached: true,
377
- shell: true,
378
- },
379
- closeOld: true,
349
+ expected: {
350
+ cmd: "/path/to/binary",
351
+ args: ["--config", "/config.yaml"],
352
+ opts: {
353
+ env: {
354
+ DEBUG: "true",
355
+ LOG_LEVEL: "info",
380
356
  },
381
- workDir: '/work',
357
+ cwd: "/work",
358
+ stdio: ["pipe", "ignore", "inherit"],
359
+ windowsHide: true,
382
360
  },
383
- expected: {
384
- cmd: '/binary',
385
- args: ['--config', '/config.yaml'],
386
- opts: {
387
- env: {},
388
- cwd: '/work',
389
- stdio: 'inherit',
361
+ },
362
+ },
363
+ {
364
+ name: "should override spawn options when provided",
365
+ input: {
366
+ binaryPath: "/binary",
367
+ configPath: "/config.yaml",
368
+ ops: {
369
+ workingDir: "/work",
370
+ config: "content",
371
+ plBinary: { type: "Download", version: "1.29.2" },
372
+ spawnOptions: {
373
+ stdio: "inherit",
390
374
  detached: true,
391
375
  shell: true,
392
- windowsHide: true,
393
376
  },
377
+ closeOld: true,
394
378
  },
379
+ workDir: "/work",
395
380
  },
396
- {
397
- name: 'should handle complex case with multiple options',
398
- input: {
399
- binaryPath: '/bin/platforma',
400
- configPath: '/etc/platforma/config.yaml',
401
- ops: {
402
- workingDir: '/var/platforma',
403
- config: 'yaml content',
404
- plBinary: { type: 'Download', version: '1.29.2' },
405
- spawnOptions: {
406
- env: {
407
- PL_DEBUG: 'true',
408
- PL_MODE: 'development',
409
- GOMAXPROCS: '4',
410
- },
411
- stdio: ['ignore', 'pipe', 'pipe'],
412
- detached: false,
413
- windowsHide: false,
414
- uid: 1000,
415
- gid: 1000,
416
- },
417
- closeOld: true,
418
- },
419
- workDir: '/var/platforma/runtime',
381
+ expected: {
382
+ cmd: "/binary",
383
+ args: ["--config", "/config.yaml"],
384
+ opts: {
385
+ env: {},
386
+ cwd: "/work",
387
+ stdio: "inherit",
388
+ detached: true,
389
+ shell: true,
390
+ windowsHide: true,
420
391
  },
421
- expected: {
422
- cmd: '/bin/platforma',
423
- args: ['--config', '/etc/platforma/config.yaml'],
424
- opts: {
392
+ },
393
+ },
394
+ {
395
+ name: "should handle complex case with multiple options",
396
+ input: {
397
+ binaryPath: "/bin/platforma",
398
+ configPath: "/etc/platforma/config.yaml",
399
+ ops: {
400
+ workingDir: "/var/platforma",
401
+ config: "yaml content",
402
+ plBinary: { type: "Download", version: "1.29.2" },
403
+ spawnOptions: {
425
404
  env: {
426
- PL_DEBUG: 'true',
427
- PL_MODE: 'development',
428
- GOMAXPROCS: '4',
405
+ PL_DEBUG: "true",
406
+ PL_MODE: "development",
407
+ GOMAXPROCS: "4",
429
408
  },
430
- cwd: '/var/platforma/runtime',
431
- stdio: ['ignore', 'pipe', 'pipe'],
409
+ stdio: ["ignore", "pipe", "pipe"],
432
410
  detached: false,
433
411
  windowsHide: false,
434
412
  uid: 1000,
435
413
  gid: 1000,
436
414
  },
415
+ closeOld: true,
437
416
  },
417
+ workDir: "/var/platforma/runtime",
438
418
  },
439
- ];
440
-
441
- test.each(plProcessOpsCases)('plProcessOps: $name', ({ name, input, expected }) => {
442
- const result = plProcessOps(
443
- input.binaryPath,
444
- input.configPath,
445
- input.ops,
446
- input.workDir,
447
- {},
448
- );
419
+ expected: {
420
+ cmd: "/bin/platforma",
421
+ args: ["--config", "/etc/platforma/config.yaml"],
422
+ opts: {
423
+ env: {
424
+ PL_DEBUG: "true",
425
+ PL_MODE: "development",
426
+ GOMAXPROCS: "4",
427
+ },
428
+ cwd: "/var/platforma/runtime",
429
+ stdio: ["ignore", "pipe", "pipe"],
430
+ detached: false,
431
+ windowsHide: false,
432
+ uid: 1000,
433
+ gid: 1000,
434
+ },
435
+ },
436
+ },
437
+ ];
438
+
439
+ test.each(plProcessOpsCases)("plProcessOps: $name", ({ input, expected }) => {
440
+ const result = plProcessOps(input.binaryPath, input.configPath, input.ops, input.workDir, {});
449
441
 
450
442
  expect(result).toEqual(expected);
451
443
  });