|
| 1 | +import { expect, test, describe } from 'vitest' |
| 2 | +import { build } from '../src/server/app.js' |
| 3 | +import { TEST_CONNECTION_STRING } from './lib/utils.js' |
| 4 | + |
| 5 | +describe('server/routes/config', () => { |
| 6 | + test('should list config with query parameters', async () => { |
| 7 | + const app = build() |
| 8 | + const response = await app.inject({ |
| 9 | + method: 'GET', |
| 10 | + url: '/config?limit=5&offset=0', |
| 11 | + headers: { |
| 12 | + pg: TEST_CONNECTION_STRING, |
| 13 | + }, |
| 14 | + }) |
| 15 | + expect(response.statusCode).toBe(200) |
| 16 | + expect(response.json()).toMatchInlineSnapshot(` |
| 17 | + [ |
| 18 | + { |
| 19 | + "boot_val": "on", |
| 20 | + "category": "Autovacuum", |
| 21 | + "context": "sighup", |
| 22 | + "enumvals": null, |
| 23 | + "extra_desc": null, |
| 24 | + "group": "Autovacuum", |
| 25 | + "max_val": null, |
| 26 | + "min_val": null, |
| 27 | + "name": "autovacuum", |
| 28 | + "pending_restart": false, |
| 29 | + "reset_val": "on", |
| 30 | + "setting": "on", |
| 31 | + "short_desc": "Starts the autovacuum subprocess.", |
| 32 | + "source": "default", |
| 33 | + "sourcefile": null, |
| 34 | + "sourceline": null, |
| 35 | + "subgroup": "", |
| 36 | + "unit": null, |
| 37 | + "vartype": "bool", |
| 38 | + }, |
| 39 | + { |
| 40 | + "boot_val": "0.1", |
| 41 | + "category": "Autovacuum", |
| 42 | + "context": "sighup", |
| 43 | + "enumvals": null, |
| 44 | + "extra_desc": null, |
| 45 | + "group": "Autovacuum", |
| 46 | + "max_val": "100", |
| 47 | + "min_val": "0", |
| 48 | + "name": "autovacuum_analyze_scale_factor", |
| 49 | + "pending_restart": false, |
| 50 | + "reset_val": "0.1", |
| 51 | + "setting": "0.1", |
| 52 | + "short_desc": "Number of tuple inserts, updates, or deletes prior to analyze as a fraction of reltuples.", |
| 53 | + "source": "default", |
| 54 | + "sourcefile": null, |
| 55 | + "sourceline": null, |
| 56 | + "subgroup": "", |
| 57 | + "unit": null, |
| 58 | + "vartype": "real", |
| 59 | + }, |
| 60 | + { |
| 61 | + "boot_val": "50", |
| 62 | + "category": "Autovacuum", |
| 63 | + "context": "sighup", |
| 64 | + "enumvals": null, |
| 65 | + "extra_desc": null, |
| 66 | + "group": "Autovacuum", |
| 67 | + "max_val": "2147483647", |
| 68 | + "min_val": "0", |
| 69 | + "name": "autovacuum_analyze_threshold", |
| 70 | + "pending_restart": false, |
| 71 | + "reset_val": "50", |
| 72 | + "setting": "50", |
| 73 | + "short_desc": "Minimum number of tuple inserts, updates, or deletes prior to analyze.", |
| 74 | + "source": "default", |
| 75 | + "sourcefile": null, |
| 76 | + "sourceline": null, |
| 77 | + "subgroup": "", |
| 78 | + "unit": null, |
| 79 | + "vartype": "integer", |
| 80 | + }, |
| 81 | + { |
| 82 | + "boot_val": "200000000", |
| 83 | + "category": "Autovacuum", |
| 84 | + "context": "postmaster", |
| 85 | + "enumvals": null, |
| 86 | + "extra_desc": null, |
| 87 | + "group": "Autovacuum", |
| 88 | + "max_val": "2000000000", |
| 89 | + "min_val": "100000", |
| 90 | + "name": "autovacuum_freeze_max_age", |
| 91 | + "pending_restart": false, |
| 92 | + "reset_val": "200000000", |
| 93 | + "setting": "200000000", |
| 94 | + "short_desc": "Age at which to autovacuum a table to prevent transaction ID wraparound.", |
| 95 | + "source": "default", |
| 96 | + "sourcefile": null, |
| 97 | + "sourceline": null, |
| 98 | + "subgroup": "", |
| 99 | + "unit": null, |
| 100 | + "vartype": "integer", |
| 101 | + }, |
| 102 | + { |
| 103 | + "boot_val": "3", |
| 104 | + "category": "Autovacuum", |
| 105 | + "context": "postmaster", |
| 106 | + "enumvals": null, |
| 107 | + "extra_desc": null, |
| 108 | + "group": "Autovacuum", |
| 109 | + "max_val": "262143", |
| 110 | + "min_val": "1", |
| 111 | + "name": "autovacuum_max_workers", |
| 112 | + "pending_restart": false, |
| 113 | + "reset_val": "3", |
| 114 | + "setting": "3", |
| 115 | + "short_desc": "Sets the maximum number of simultaneously running autovacuum worker processes.", |
| 116 | + "source": "default", |
| 117 | + "sourcefile": null, |
| 118 | + "sourceline": null, |
| 119 | + "subgroup": "", |
| 120 | + "unit": null, |
| 121 | + "vartype": "integer", |
| 122 | + }, |
| 123 | + ] |
| 124 | + `) |
| 125 | + await app.close() |
| 126 | + }) |
| 127 | +}) |
0 commit comments