mirror of
https://github.com/immich-app/immich.git
synced 2024-12-23 02:06:15 +02:00
4e9b96ff1a
* Allow building and installing cli * feat: add format fix * docs: remove cli folder * feat: use immich scoped package * feat: rewrite cli readme * docs: add info on running without building * cleanup * chore: remove import functionality from cli * feat: add logout to cli * docs: add todo for file format from server * docs: add compilation step to cli * fix: success message spacing * feat: can create albums * fix: add check step to cli * fix: typos * feat: pull file formats from server * chore: use crawl service from server * chore: fix lint * docs: add cli documentation * chore: rename ignore pattern * chore: add version number to cli * feat: use sdk * fix: cleanup * feat: album name on windows * chore: remove skipped asset field * feat: add more info to server-info command * chore: cleanup * wip * chore: remove unneeded packages * e2e test can start * git ignore for geocode in cli * add cli e2e to github actions * can do e2e tests in the cli * simplify e2e test * cleanup * set matrix strategy in workflow * run npm ci in server * choose different working directory * check out submodules too * increase test timeout * set node version * cli docker e2e tests * fix cli docker file * run cli e2e in correct folder * set docker context * correct docker build * remove cli from dockerignore * chore: fix docs links * feat: add cli v2 milestone * fix: set correct cli date * remove submodule * chore: add npmignore * chore(cli): push to npm * fix: server e2e * run npm ci in server * remove state from e2e * run npm ci in server * reshuffle docker compose files * use new e2e composes in makefile * increase test timeout to 10 minutes * make github actions run makefile e2e tests * cleanup github test names * assert on server version * chore: split cli e2e tests into one file per command * chore: set cli release working dir * chore: add repo url to npmjs * chore: bump node setup to v4 * chore: normalize the github url * check e2e code in lint * fix lint * test key login flow * feat: allow configurable config dir * fix session service tests * create missing dir * cleanup * bump cli version to 2.0.4 * remove form-data * feat: allow single files as argument * add version option * bump dependencies * fix lint * wip use axios as upload * version bump * cApiTALiZaTiON * don't touch package lock * wip: don't use job queues * don't use make for cli e2e * fix server e2e * chore: remove old gha step * add npm ci to server --------- Co-authored-by: Alex <alex.tran1502@gmail.com> Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
import { PostgreSqlContainer } from '@testcontainers/postgresql';
|
|
import { access } from 'fs/promises';
|
|
import path from 'path';
|
|
|
|
export default async () => {
|
|
const allTests: boolean = process.env.IMMICH_RUN_ALL_TESTS === 'true';
|
|
|
|
if (!allTests) {
|
|
console.warn(
|
|
`\n\n
|
|
*** Not running all server e2e tests. Run 'make test-e2e' to run all tests inside Docker (recommended)\n
|
|
*** or set 'IMMICH_RUN_ALL_TESTS=true' to run all tests (requires dependencies to be installed)\n`,
|
|
);
|
|
}
|
|
|
|
let IMMICH_TEST_ASSET_PATH: string = '';
|
|
|
|
if (process.env.IMMICH_TEST_ASSET_PATH === undefined) {
|
|
IMMICH_TEST_ASSET_PATH = path.normalize(`${__dirname}/../assets/`);
|
|
process.env.IMMICH_TEST_ASSET_PATH = IMMICH_TEST_ASSET_PATH;
|
|
} else {
|
|
IMMICH_TEST_ASSET_PATH = process.env.IMMICH_TEST_ASSET_PATH;
|
|
}
|
|
|
|
const directoryExists = async (dirPath: string) =>
|
|
await access(dirPath)
|
|
.then(() => true)
|
|
.catch(() => false);
|
|
|
|
if (!(await directoryExists(`${IMMICH_TEST_ASSET_PATH}/albums`))) {
|
|
throw new Error(
|
|
`Test assets not found. Please checkout https://github.com/immich-app/test-assets into ${IMMICH_TEST_ASSET_PATH} before testing`,
|
|
);
|
|
}
|
|
|
|
if (process.env.DB_HOSTNAME === undefined) {
|
|
// DB hostname not set which likely means we're not running e2e through docker compose. Start a local postgres container.
|
|
const pg = await new PostgreSqlContainer('tensorchord/pgvecto-rs:pg14-v0.1.11')
|
|
.withExposedPorts(5432)
|
|
.withDatabase('immich')
|
|
.withUsername('postgres')
|
|
.withPassword('postgres')
|
|
.withReuse()
|
|
.start();
|
|
|
|
process.env.DB_URL = pg.getConnectionUri();
|
|
}
|
|
|
|
process.env.NODE_ENV = 'development';
|
|
process.env.IMMICH_TEST_ENV = 'true';
|
|
process.env.IMMICH_CONFIG_FILE = path.normalize(`${__dirname}/immich-e2e-config.json`);
|
|
process.env.TZ = 'Z';
|
|
};
|