neonctl 2.22.2 → 2.23.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.
Files changed (113) hide show
  1. package/README.md +84 -0
  2. package/analytics.js +5 -2
  3. package/commands/branches.js +9 -1
  4. package/commands/connection_string.js +9 -1
  5. package/commands/functions.js +277 -0
  6. package/commands/index.js +4 -0
  7. package/commands/neon_auth.js +1013 -0
  8. package/commands/projects.js +9 -1
  9. package/commands/psql.js +6 -1
  10. package/functions_api.js +44 -0
  11. package/package.json +15 -5
  12. package/psql/cli.js +51 -0
  13. package/psql/command/cmd_cond.js +437 -0
  14. package/psql/command/cmd_connect.js +815 -0
  15. package/psql/command/cmd_copy.js +1025 -0
  16. package/psql/command/cmd_describe.js +1810 -0
  17. package/psql/command/cmd_format.js +909 -0
  18. package/psql/command/cmd_io.js +2187 -0
  19. package/psql/command/cmd_lo.js +385 -0
  20. package/psql/command/cmd_meta.js +970 -0
  21. package/psql/command/cmd_misc.js +187 -0
  22. package/psql/command/cmd_pipeline.js +1141 -0
  23. package/psql/command/cmd_restrict.js +171 -0
  24. package/psql/command/cmd_show.js +751 -0
  25. package/psql/command/dispatch.js +343 -0
  26. package/psql/command/inputQueue.js +42 -0
  27. package/psql/command/shared.js +71 -0
  28. package/psql/complete/filenames.js +139 -0
  29. package/psql/complete/index.js +104 -0
  30. package/psql/complete/matcher.js +314 -0
  31. package/psql/complete/psqlVars.js +247 -0
  32. package/psql/complete/queries.js +491 -0
  33. package/psql/complete/rules.js +2387 -0
  34. package/psql/core/common.js +1250 -0
  35. package/psql/core/help.js +576 -0
  36. package/psql/core/mainloop.js +1353 -0
  37. package/psql/core/prompt.js +437 -0
  38. package/psql/core/settings.js +684 -0
  39. package/psql/core/sqlHelp.js +1066 -0
  40. package/psql/core/startup.js +840 -0
  41. package/psql/core/syncVars.js +116 -0
  42. package/psql/core/variables.js +287 -0
  43. package/psql/describe/formatters.js +1277 -0
  44. package/psql/describe/processNamePattern.js +270 -0
  45. package/psql/describe/queries.js +2373 -0
  46. package/psql/describe/versionGate.js +43 -0
  47. package/psql/index.js +2005 -0
  48. package/psql/io/history.js +299 -0
  49. package/psql/io/input.js +120 -0
  50. package/psql/io/lineEditor/buffer.js +323 -0
  51. package/psql/io/lineEditor/complete.js +227 -0
  52. package/psql/io/lineEditor/filename.js +159 -0
  53. package/psql/io/lineEditor/index.js +891 -0
  54. package/psql/io/lineEditor/keymap.js +738 -0
  55. package/psql/io/lineEditor/vt100.js +363 -0
  56. package/psql/io/pgpass.js +202 -0
  57. package/psql/io/pgservice.js +194 -0
  58. package/psql/io/psqlrc.js +422 -0
  59. package/psql/print/aligned.js +1756 -0
  60. package/psql/print/asciidoc.js +248 -0
  61. package/psql/print/crosstab.js +460 -0
  62. package/psql/print/csv.js +92 -0
  63. package/psql/print/html.js +258 -0
  64. package/psql/print/json.js +96 -0
  65. package/psql/print/latex.js +396 -0
  66. package/psql/print/pager.js +265 -0
  67. package/psql/print/troff.js +258 -0
  68. package/psql/print/unaligned.js +118 -0
  69. package/psql/print/units.js +135 -0
  70. package/psql/scanner/slash.js +513 -0
  71. package/psql/scanner/sql.js +910 -0
  72. package/psql/scanner/stringutils.js +390 -0
  73. package/psql/types/backslash.js +1 -0
  74. package/psql/types/connection.js +1 -0
  75. package/psql/types/index.js +7 -0
  76. package/psql/types/printer.js +1 -0
  77. package/psql/types/repl.js +1 -0
  78. package/psql/types/scanner.js +24 -0
  79. package/psql/types/settings.js +1 -0
  80. package/psql/types/variables.js +1 -0
  81. package/psql/wire/connection.js +2844 -0
  82. package/psql/wire/copy.js +108 -0
  83. package/psql/wire/notify.js +59 -0
  84. package/psql/wire/pipeline.js +519 -0
  85. package/psql/wire/protocol.js +466 -0
  86. package/psql/wire/sasl.js +296 -0
  87. package/psql/wire/tls.js +596 -0
  88. package/test_utils/fixtures.js +1 -0
  89. package/utils/esbuild.js +147 -0
  90. package/utils/psql.js +107 -11
  91. package/utils/zip.js +4 -0
  92. package/writer.js +1 -1
  93. package/commands/auth.test.js +0 -211
  94. package/commands/branches.test.js +0 -460
  95. package/commands/checkout.test.js +0 -170
  96. package/commands/connection_string.test.js +0 -196
  97. package/commands/data_api.test.js +0 -169
  98. package/commands/databases.test.js +0 -39
  99. package/commands/help.test.js +0 -9
  100. package/commands/init.test.js +0 -56
  101. package/commands/ip_allow.test.js +0 -59
  102. package/commands/link.test.js +0 -381
  103. package/commands/operations.test.js +0 -7
  104. package/commands/orgs.test.js +0 -7
  105. package/commands/projects.test.js +0 -144
  106. package/commands/psql.test.js +0 -49
  107. package/commands/roles.test.js +0 -37
  108. package/commands/set_context.test.js +0 -159
  109. package/commands/vpc_endpoints.test.js +0 -69
  110. package/context.test.js +0 -119
  111. package/env.test.js +0 -55
  112. package/utils/formats.test.js +0 -32
  113. package/writer.test.js +0 -104
@@ -1,381 +0,0 @@
1
- import { fork } from 'node:child_process';
2
- import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync, } from 'node:fs';
3
- import { tmpdir } from 'node:os';
4
- import { join } from 'node:path';
5
- import { beforeAll, describe, expect } from 'vitest';
6
- import { test as originalTest } from '../test_utils/fixtures';
7
- // All tests in this file share a single temporary directory whose path is
8
- // normalized in snapshots to `<TMP>` so that absolute paths in command output
9
- // (both human summaries and agent JSON) remain stable across runs and machines.
10
- const TEST_TMP = mkdtempSync(join(tmpdir(), 'neonctl-link-'));
11
- const TMP_TOKEN = '<TMP>';
12
- beforeAll(() => {
13
- // Replace any reference to the per-run tmp directory with a stable token so
14
- // snapshots only carry the deterministic suffix portion of paths.
15
- expect.addSnapshotSerializer({
16
- test: (val) => typeof val === 'string' && val.includes(TEST_TMP),
17
- serialize: (val, config, indentation, depth, refs, printer) => printer(val.split(TEST_TMP).join(TMP_TOKEN), config, indentation, depth, refs),
18
- });
19
- });
20
- const test = originalTest.extend({
21
- // eslint-disable-next-line no-empty-pattern
22
- cleanupFile: async ({}, use) => {
23
- let writtenFilename;
24
- await use((name) => (writtenFilename = name));
25
- if (writtenFilename) {
26
- try {
27
- rmSync(writtenFilename);
28
- }
29
- catch {
30
- // ignore
31
- }
32
- }
33
- },
34
- readFile: async ({ cleanupFile }, use) => {
35
- await use((name) => {
36
- const content = readFileSync(name, 'utf-8');
37
- cleanupFile(name);
38
- return content;
39
- });
40
- },
41
- // eslint-disable-next-line no-empty-pattern
42
- removeFile: async ({}, use) => {
43
- await use((name) => {
44
- try {
45
- rmSync(name);
46
- }
47
- catch {
48
- // ignore
49
- }
50
- });
51
- },
52
- // Each test gets its OWN sub-directory under TEST_TMP so the
53
- // `.gitignore` scaffolded next to the `.neon` written by one test doesn't
54
- // affect another test in the same file.
55
- // eslint-disable-next-line no-empty-pattern
56
- tmpContext: async ({}, use) => {
57
- await use((label) => {
58
- const dir = join(TEST_TMP, label);
59
- mkdirSync(dir, { recursive: true });
60
- return join(dir, '.neon');
61
- });
62
- },
63
- runLinkInCi: async ({ runMockServer }, use) => {
64
- await use(async (args) => {
65
- const server = await runMockServer('main');
66
- const port = server.address().port;
67
- return new Promise((resolve, reject) => {
68
- const cp = fork(join(process.cwd(), './dist/index.js'), [
69
- '--api-host',
70
- `http://localhost:${port}`,
71
- '--output',
72
- 'yaml',
73
- '--api-key',
74
- 'test-key',
75
- '--no-analytics',
76
- ...args,
77
- ], {
78
- stdio: 'pipe',
79
- env: {
80
- PATH: `mocks/bin:${process.env.PATH}`,
81
- CI: 'true',
82
- },
83
- });
84
- let stdout = '';
85
- let stderr = '';
86
- cp.stdout?.on('data', (data) => {
87
- stdout += data.toString();
88
- });
89
- cp.stderr?.on('data', (data) => {
90
- stderr += data.toString();
91
- });
92
- cp.on('error', reject);
93
- cp.on('close', (code) => {
94
- resolve({ code: code ?? -1, stdout, stderr });
95
- });
96
- });
97
- });
98
- },
99
- });
100
- describe('link', () => {
101
- describe('non-interactive flag mode', () => {
102
- test('link to existing project writes .neon with default branch id', async ({ testCliCommand, readFile, tmpContext, }) => {
103
- const ctx = tmpContext('flag_existing');
104
- await testCliCommand([
105
- 'link',
106
- '--org-id',
107
- 'org-2',
108
- '--project-id',
109
- 'test',
110
- '--context-file',
111
- ctx,
112
- ]);
113
- expect(readFile(ctx)).toMatchSnapshot();
114
- });
115
- test('link with --params JSON behaves like flags', async ({ testCliCommand, readFile, tmpContext, }) => {
116
- const ctx = tmpContext('flag_params');
117
- await testCliCommand([
118
- 'link',
119
- '--params',
120
- JSON.stringify({ orgId: 'org-2', projectId: 'test' }),
121
- '--context-file',
122
- ctx,
123
- ]);
124
- expect(readFile(ctx)).toMatchSnapshot();
125
- });
126
- test('link creates a new project and writes .neon', async ({ testCliCommand, readFile, tmpContext, }) => {
127
- const ctx = tmpContext('flag_create');
128
- await testCliCommand([
129
- 'link',
130
- '--org-id',
131
- 'org-2',
132
- '--project-name',
133
- 'test_project',
134
- '--region-id',
135
- 'aws-us-east-2',
136
- '--context-file',
137
- ctx,
138
- ]);
139
- expect(readFile(ctx)).toMatchSnapshot();
140
- });
141
- test('conflicting inputs (--project-id with --project-name) fails', async ({ testCliCommand, tmpContext, }) => {
142
- await testCliCommand([
143
- 'link',
144
- '--org-id',
145
- 'org-2',
146
- '--project-id',
147
- 'test',
148
- '--project-name',
149
- 'test_project',
150
- '--context-file',
151
- tmpContext('flag_conflict'),
152
- ], {
153
- code: 1,
154
- stderr: 'ERROR: Conflicting inputs: --project-id selects an existing project; --project-name and --region-id describe a new one. Pass only one set.',
155
- });
156
- });
157
- });
158
- describe('--agent mode', () => {
159
- test('with no flags emits needs_org JSON', async ({ testCliCommand, removeFile, tmpContext, }) => {
160
- const ctx = tmpContext('agent_needs_org');
161
- await testCliCommand(['link', '--agent', '--context-file', ctx]);
162
- removeFile(ctx);
163
- });
164
- test('with only --org-id emits needs_project JSON', async ({ testCliCommand, removeFile, tmpContext, }) => {
165
- const ctx = tmpContext('agent_needs_project');
166
- await testCliCommand([
167
- 'link',
168
- '--agent',
169
- '--org-id',
170
- 'org-2',
171
- '--context-file',
172
- ctx,
173
- ]);
174
- removeFile(ctx);
175
- });
176
- test('with org+project emits linked JSON and writes .neon', async ({ testCliCommand, readFile, tmpContext, }) => {
177
- const ctx = tmpContext('agent_linked_existing');
178
- await testCliCommand([
179
- 'link',
180
- '--agent',
181
- '--org-id',
182
- 'org-2',
183
- '--project-id',
184
- 'test',
185
- '--context-file',
186
- ctx,
187
- ]);
188
- expect(readFile(ctx)).toMatchSnapshot();
189
- });
190
- test('with org+projectName but no region emits needs_project_details JSON', async ({ testCliCommand, removeFile, tmpContext, }) => {
191
- const ctx = tmpContext('agent_needs_region');
192
- await testCliCommand([
193
- 'link',
194
- '--agent',
195
- '--org-id',
196
- 'org-2',
197
- '--project-name',
198
- 'demo',
199
- '--context-file',
200
- ctx,
201
- ]);
202
- removeFile(ctx);
203
- });
204
- test('with full project details creates project and emits linked JSON', async ({ testCliCommand, readFile, tmpContext, }) => {
205
- const ctx = tmpContext('agent_linked_create');
206
- await testCliCommand([
207
- 'link',
208
- '--agent',
209
- '--org-id',
210
- 'org-2',
211
- '--project-name',
212
- 'test_project',
213
- '--region-id',
214
- 'aws-us-east-2',
215
- '--context-file',
216
- ctx,
217
- ]);
218
- expect(readFile(ctx)).toMatchSnapshot();
219
- });
220
- });
221
- describe('org-scoped API key behavior', () => {
222
- test('agent mode with no orgs available and no projects emits orgKeyLimited needs_org', async ({ testCliCommand, removeFile, tmpContext, }) => {
223
- const ctx = tmpContext('orgkey_empty');
224
- await testCliCommand(['link', '--agent', '--context-file', ctx], {
225
- mockDir: 'org-key-empty',
226
- });
227
- removeFile(ctx);
228
- });
229
- test('agent mode auto-detects org from existing projects when org listing is forbidden', async ({ testCliCommand, removeFile, tmpContext, }) => {
230
- const ctx = tmpContext('orgkey_autodetect');
231
- await testCliCommand(['link', '--agent', '--context-file', ctx], {
232
- mockDir: 'org-key',
233
- });
234
- removeFile(ctx);
235
- });
236
- test('agent mode falls back to static regions when getActiveRegions is forbidden', async ({ testCliCommand, removeFile, tmpContext, }) => {
237
- const ctx = tmpContext('orgkey_regions_fallback');
238
- await testCliCommand([
239
- 'link',
240
- '--agent',
241
- '--org-id',
242
- 'org-detected-99887766',
243
- '--project-name',
244
- 'whatever',
245
- '--context-file',
246
- ctx,
247
- ], { mockDir: 'org-key' });
248
- removeFile(ctx);
249
- });
250
- });
251
- describe('agent error responses', () => {
252
- test('invalid --params JSON yields error JSON, exit 1', async ({ runLinkInCi, tmpContext, }) => {
253
- const result = await runLinkInCi([
254
- 'link',
255
- '--agent',
256
- '--params',
257
- 'not-valid-json',
258
- '--context-file',
259
- tmpContext('agent_bad_params'),
260
- ]);
261
- expect(result.code).toBe(1);
262
- const parsed = JSON.parse(result.stdout);
263
- expect(parsed.status).toBe('error');
264
- expect(parsed.code).toBe('INTERNAL_ERROR');
265
- expect(parsed.message).toContain('Failed to parse --params JSON');
266
- });
267
- test('conflicting flags in agent mode yields error JSON, exit 1', async ({ runLinkInCi, tmpContext, }) => {
268
- const result = await runLinkInCi([
269
- 'link',
270
- '--agent',
271
- '--org-id',
272
- 'org-2',
273
- '--project-id',
274
- 'test',
275
- '--project-name',
276
- 'x',
277
- '--context-file',
278
- tmpContext('agent_conflict'),
279
- ]);
280
- expect(result.code).toBe(1);
281
- const parsed = JSON.parse(result.stdout);
282
- expect(parsed.status).toBe('error');
283
- expect(parsed.message).toContain('Conflicting inputs');
284
- });
285
- });
286
- describe('CI guard', () => {
287
- test('errors out with helpful message when no inputs provided in CI', async ({ runLinkInCi, tmpContext, }) => {
288
- const result = await runLinkInCi([
289
- 'link',
290
- '--context-file',
291
- tmpContext('ci_guard'),
292
- ]);
293
- expect(result.code).toBe(1);
294
- expect(result.stderr).toContain('CI environment detected');
295
- expect(result.stderr).toContain('neonctl link --agent');
296
- });
297
- });
298
- describe('set-context regression', () => {
299
- test('set-context --branch-id writes branchId to .neon', async ({ testCliCommand, readFile, tmpContext, }) => {
300
- const ctx = tmpContext('sc_branch');
301
- await testCliCommand([
302
- 'set-context',
303
- '--project-id',
304
- 'test_project',
305
- '--branch-id',
306
- 'br-main-branch-123456',
307
- '--context-file',
308
- ctx,
309
- ]);
310
- expect(readFile(ctx)).toMatchSnapshot();
311
- });
312
- });
313
- test('overwrites an existing .neon when re-linking non-interactively', async ({ testCliCommand, readFile, tmpContext, }) => {
314
- const ctx = tmpContext('overwrite');
315
- writeFileSync(ctx, JSON.stringify({ orgId: 'old', projectId: 'old', branchId: 'old' }));
316
- await testCliCommand([
317
- 'link',
318
- '--org-id',
319
- 'org-2',
320
- '--project-id',
321
- 'test',
322
- '--context-file',
323
- ctx,
324
- ]);
325
- expect(readFile(ctx)).toMatchSnapshot();
326
- });
327
- describe('gitignore scaffolding', () => {
328
- test('creates a .gitignore listing .neon next to the context file', async ({ testCliCommand, tmpContext, }) => {
329
- const ctx = tmpContext('gi_creates');
330
- await testCliCommand([
331
- 'link',
332
- '--org-id',
333
- 'org-2',
334
- '--project-id',
335
- 'test',
336
- '--context-file',
337
- ctx,
338
- ]);
339
- const giPath = join(ctx, '..', '.gitignore');
340
- expect(readFileSync(giPath, 'utf-8')).toBe('.neon\n');
341
- });
342
- test('appends .neon to an existing .gitignore without duplicating', async ({ testCliCommand, tmpContext, }) => {
343
- const ctx = tmpContext('gi_appends');
344
- const giPath = join(ctx, '..', '.gitignore');
345
- writeFileSync(giPath, 'node_modules\ndist\n');
346
- await testCliCommand([
347
- 'link',
348
- '--org-id',
349
- 'org-2',
350
- '--project-id',
351
- 'test',
352
- '--context-file',
353
- ctx,
354
- ]);
355
- expect(readFileSync(giPath, 'utf-8')).toBe('node_modules\ndist\n.neon\n');
356
- // Re-link in the same dir must not produce a duplicate entry.
357
- await testCliCommand([
358
- 'link',
359
- '--org-id',
360
- 'org-2',
361
- '--project-id',
362
- 'test',
363
- '--context-file',
364
- ctx,
365
- ]);
366
- expect(readFileSync(giPath, 'utf-8')).toBe('node_modules\ndist\n.neon\n');
367
- });
368
- test('set-context also scaffolds .gitignore via the shared applyContext', async ({ testCliCommand, tmpContext, }) => {
369
- const ctx = tmpContext('gi_set_context');
370
- await testCliCommand([
371
- 'set-context',
372
- '--project-id',
373
- 'test',
374
- '--context-file',
375
- ctx,
376
- ]);
377
- const giPath = join(ctx, '..', '.gitignore');
378
- expect(readFileSync(giPath, 'utf-8')).toBe('.neon\n');
379
- });
380
- });
381
- });
@@ -1,7 +0,0 @@
1
- import { describe } from 'vitest';
2
- import { test } from '../test_utils/fixtures';
3
- describe('operations', () => {
4
- test('list', async ({ testCliCommand }) => {
5
- await testCliCommand(['operations', 'list', '--project-id', 'test']);
6
- });
7
- });
@@ -1,7 +0,0 @@
1
- import { describe } from 'vitest';
2
- import { test } from '../test_utils/fixtures';
3
- describe('orgs', () => {
4
- test('list', async ({ testCliCommand }) => {
5
- await testCliCommand(['orgs', 'list']);
6
- });
7
- });
@@ -1,144 +0,0 @@
1
- import { describe, expect } from 'vitest';
2
- import { readFileSync, rmSync } from 'node:fs';
3
- import { tmpdir } from 'node:os';
4
- import { join } from 'node:path';
5
- import { test } from '../test_utils/fixtures';
6
- describe('projects', () => {
7
- test('list', async ({ testCliCommand }) => {
8
- await testCliCommand(['projects', 'list']);
9
- });
10
- test('list with org id', async ({ testCliCommand }) => {
11
- await testCliCommand(['projects', 'list', '--org-id', 'org-2']);
12
- });
13
- test('list recoverable projects', async ({ testCliCommand }) => {
14
- await testCliCommand(['projects', 'list', '--recoverable-only']);
15
- });
16
- test('create', async ({ testCliCommand }) => {
17
- await testCliCommand(['projects', 'create', '--name', 'test_project']);
18
- });
19
- test('create with hipaa flag', async ({ testCliCommand }) => {
20
- await testCliCommand([
21
- 'projects',
22
- 'create',
23
- '--name',
24
- 'test_project',
25
- '--hipaa',
26
- ]);
27
- });
28
- test('create with org id', async ({ testCliCommand }) => {
29
- await testCliCommand([
30
- 'projects',
31
- 'create',
32
- '--name',
33
- 'test_project',
34
- '--org-id',
35
- 'org-2',
36
- ]);
37
- });
38
- test('create with database and role', async ({ testCliCommand }) => {
39
- await testCliCommand([
40
- 'projects',
41
- 'create',
42
- '--name',
43
- 'test_project',
44
- '--database',
45
- 'test_db',
46
- '--role',
47
- 'test_role',
48
- ]);
49
- });
50
- test('create and connect with psql', async ({ testCliCommand }) => {
51
- await testCliCommand([
52
- 'projects',
53
- 'create',
54
- '--name',
55
- 'test_project',
56
- '--psql',
57
- ]);
58
- });
59
- test('create and connect with psql and psql args', async ({ testCliCommand, }) => {
60
- await testCliCommand([
61
- 'projects',
62
- 'create',
63
- '--name',
64
- 'test_project',
65
- '--psql',
66
- '--',
67
- '-c',
68
- 'SELECT 1',
69
- ]);
70
- });
71
- test('create project with setting the context', async ({ testCliCommand, }) => {
72
- const CONTEXT_FILE = join(tmpdir(), `neon_project_create_ctx_${Date.now()}`);
73
- await testCliCommand([
74
- 'projects',
75
- 'create',
76
- '--name',
77
- 'test_project',
78
- '--context-file',
79
- CONTEXT_FILE,
80
- '--set-context',
81
- ]);
82
- expect(readFileSync(CONTEXT_FILE, 'utf-8')).toContain('new-project-123456');
83
- rmSync(CONTEXT_FILE);
84
- });
85
- test('create project with default fixed size CU', async ({ testCliCommand, }) => {
86
- await testCliCommand([
87
- 'projects',
88
- 'create',
89
- '--name',
90
- 'test_project_with_fixed_cu',
91
- '--cu',
92
- '2',
93
- ]);
94
- });
95
- test('create project with default autoscaled CU', async ({ testCliCommand, }) => {
96
- await testCliCommand([
97
- 'projects',
98
- 'create',
99
- '--name',
100
- 'test_project_with_autoscaling',
101
- '--cu',
102
- '0.5-2',
103
- ]);
104
- });
105
- test('delete', async ({ testCliCommand }) => {
106
- await testCliCommand(['projects', 'delete', 'test']);
107
- });
108
- test('recover deleted project', async ({ testCliCommand }) => {
109
- await testCliCommand(['projects', 'recover', 'test']);
110
- });
111
- test('update name', async ({ testCliCommand }) => {
112
- await testCliCommand([
113
- 'projects',
114
- 'update',
115
- 'test',
116
- '--name',
117
- 'test_project_new_name',
118
- ]);
119
- });
120
- test('update hipaa flag', async ({ testCliCommand }) => {
121
- await testCliCommand(['projects', 'update', 'test', '--hipaa']);
122
- });
123
- test('update project with default fixed size CU', async ({ testCliCommand, }) => {
124
- await testCliCommand([
125
- 'projects',
126
- 'update',
127
- 'test_project_with_fixed_cu',
128
- '--cu',
129
- '2',
130
- ]);
131
- });
132
- test('update project with default autoscaled CU', async ({ testCliCommand, }) => {
133
- await testCliCommand([
134
- 'projects',
135
- 'update',
136
- 'test_project_with_autoscaling',
137
- '--cu',
138
- '0.5-2',
139
- ]);
140
- });
141
- test('get', async ({ testCliCommand }) => {
142
- await testCliCommand(['projects', 'get', 'test']);
143
- });
144
- });
@@ -1,49 +0,0 @@
1
- import { describe } from 'vitest';
2
- import { test } from '../test_utils/fixtures';
3
- describe('psql', () => {
4
- test('psql connects to a branch', async ({ testCliCommand }) => {
5
- await testCliCommand([
6
- 'psql',
7
- 'test_branch',
8
- '--project-id',
9
- 'test',
10
- '--database-name',
11
- 'test_db',
12
- '--role-name',
13
- 'test_role',
14
- ]);
15
- });
16
- test('psql forwards args after --', async ({ testCliCommand }) => {
17
- await testCliCommand([
18
- 'psql',
19
- 'test_branch',
20
- '--project-id',
21
- 'test',
22
- '--database-name',
23
- 'test_db',
24
- '--role-name',
25
- 'test_role',
26
- '--',
27
- '-c',
28
- 'SELECT 1',
29
- ]);
30
- });
31
- test('psql pooled', async ({ testCliCommand }) => {
32
- await testCliCommand([
33
- 'psql',
34
- 'test_branch',
35
- '--project-id',
36
- 'test',
37
- '--database-name',
38
- 'test_db',
39
- '--role-name',
40
- 'test_role',
41
- '--pooled',
42
- ]);
43
- });
44
- test('psql without any args should pass', async ({ testCliCommand }) => {
45
- await testCliCommand(['psql'], {
46
- mockDir: 'single_project',
47
- });
48
- });
49
- });
@@ -1,37 +0,0 @@
1
- import { describe } from 'vitest';
2
- import { test } from '../test_utils/fixtures';
3
- describe('roles', () => {
4
- test('list', async ({ testCliCommand }) => {
5
- await testCliCommand([
6
- 'roles',
7
- 'list',
8
- '--project-id',
9
- 'test',
10
- '--branch',
11
- 'test_branch',
12
- ]);
13
- });
14
- test('create', async ({ testCliCommand }) => {
15
- await testCliCommand([
16
- 'roles',
17
- 'create',
18
- '--project-id',
19
- 'test',
20
- '--branch',
21
- 'test_branch',
22
- '--name',
23
- 'test_role',
24
- ]);
25
- });
26
- test('delete', async ({ testCliCommand }) => {
27
- await testCliCommand([
28
- 'roles',
29
- 'delete',
30
- 'test_role',
31
- '--project-id',
32
- 'test',
33
- '--branch',
34
- 'test_branch',
35
- ]);
36
- });
37
- });