Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
55 lines
1.9 KiB
JavaScript
55 lines
1.9 KiB
JavaScript
import fs from 'node:fs';
|
|
import os from 'node:os';
|
|
import path from 'node:path';
|
|
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { runSetupPreflight, validateSetupInputs } from '../setup-engine.mjs';
|
|
|
|
const initialTenant = {
|
|
tenantName: 'Acme MSP',
|
|
adminFirstName: 'Ava',
|
|
adminLastName: 'Admin',
|
|
adminEmail: 'ava@example.com',
|
|
adminPassword: 'Str0ng!Pass',
|
|
adminPasswordConfirm: 'Str0ng!Pass'
|
|
};
|
|
|
|
test('validateSetupInputs rejects invalid custom DNS values', () => {
|
|
assert.throws(
|
|
() => validateSetupInputs({ channel: 'stable', dnsMode: 'custom', dnsServers: '8.8.8.8,not-an-ip', ...initialTenant }),
|
|
/Invalid custom DNS server/
|
|
);
|
|
});
|
|
|
|
test('validateSetupInputs requires matching initial admin password confirmation', () => {
|
|
assert.throws(
|
|
() => validateSetupInputs({ channel: 'stable', dnsMode: 'system', ...initialTenant, adminPasswordConfirm: 'Different!1' }),
|
|
/confirmation does not match/
|
|
);
|
|
});
|
|
|
|
test('runSetupPreflight blocks early when no system resolvers are present', async () => {
|
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'alga-appliance-preflight-'));
|
|
const stateFile = path.join(tmp, 'install-state.json');
|
|
const resolvConf = path.join(tmp, 'resolv.conf');
|
|
fs.writeFileSync(resolvConf, '# empty resolver file\n');
|
|
|
|
const inputs = validateSetupInputs({
|
|
channel: 'stable',
|
|
appHostname: 'psa.example.com',
|
|
dnsMode: 'system',
|
|
dnsServers: '',
|
|
...initialTenant
|
|
});
|
|
|
|
const result = await runSetupPreflight(inputs, { stateFile, resolvConfPath: resolvConf });
|
|
assert.equal(result.ok, false);
|
|
assert.equal(result.phase, 'dns');
|
|
assert.match(result.message, /No system DNS resolvers detected/);
|
|
|
|
const persisted = JSON.parse(fs.readFileSync(stateFile, 'utf8'));
|
|
assert.equal(persisted.status, 'preflight-blocked');
|
|
assert.equal(persisted.phase, 'dns');
|
|
assert.equal(persisted.failure.phase, 'dns');
|
|
});
|