Switch mac client install to tarball download
This commit is contained in:
42
test/install-script.test.js
Normal file
42
test/install-script.test.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import test from 'node:test';
|
||||
|
||||
const root = path.resolve(import.meta.dirname, '..');
|
||||
|
||||
test('one-line installer extracts the archive and hands it to the macOS installer', () => {
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'harbor-install-'));
|
||||
try {
|
||||
const source = path.join(tmp, 'fixture', 'harbor-net');
|
||||
fs.mkdirSync(path.join(source, 'scripts'), { recursive: true });
|
||||
fs.writeFileSync(path.join(source, 'marker'), 'ok');
|
||||
fs.writeFileSync(path.join(source, 'scripts', 'install-macos-client.sh'), [
|
||||
'#!/bin/bash',
|
||||
'set -eu',
|
||||
'test "$(cat "$VPN_PROXY_SOURCE_DIR/marker")" = ok',
|
||||
'printf bootstrap-ok',
|
||||
].join('\n'));
|
||||
|
||||
const archive = path.join(tmp, 'source.tar.gz');
|
||||
execFileSync('tar', ['-czf', archive, '-C', path.dirname(source), path.basename(source)]);
|
||||
const bin = path.join(tmp, 'bin');
|
||||
fs.mkdirSync(bin);
|
||||
fs.writeFileSync(path.join(bin, 'curl'), '#!/bin/sh\ncat "$FIXTURE_ARCHIVE"\n', { mode: 0o755 });
|
||||
|
||||
const output = execFileSync('sh', [path.join(root, 'install.sh')], {
|
||||
encoding: 'utf8',
|
||||
env: {
|
||||
...process.env,
|
||||
FIXTURE_ARCHIVE: archive,
|
||||
PATH: `${bin}:/usr/bin:/bin`,
|
||||
VPN_PROXY_ARCHIVE_URL: 'https://example.invalid/source.tar.gz',
|
||||
},
|
||||
});
|
||||
assert.equal(output, 'bootstrap-ok');
|
||||
} finally {
|
||||
fs.rmSync(tmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
@@ -13,6 +13,7 @@ test('version paths map to the components actually shipped by this repository',
|
||||
assert.deepEqual(affectedComponents(['src/web/App.jsx']), ['macClient', 'gatewayClient']);
|
||||
assert.deepEqual(affectedComponents(['src/server/index.js']), ['macClient', 'gatewayBackend']);
|
||||
assert.deepEqual(affectedComponents(['docker-compose.client.local.yml']), ['macClient']);
|
||||
assert.deepEqual(affectedComponents(['install.sh']), ['macClient']);
|
||||
assert.deepEqual(affectedComponents(['package-lock.json']), [
|
||||
'macClient',
|
||||
'gatewayClient',
|
||||
|
||||
Reference in New Issue
Block a user