forked from Cutlery/immich
* feat: asset e2e with job option * feat: checkout test assets * feat: library e2e tests * fix: use node 21 in e2e * fix: tests * fix: use normalized external path * feat: more external path tests * chore: use parametrized tests * chore: remove unused test code * chore: refactor test asset path * feat: centralize test app creation * fix: correct error message for missing assets * feat: test file formats * fix: don't compare checksum * feat: build libvips * fix: install meson * fix: use immich test asset repo * feat: test nikon raw files * fix: set Z timezone * feat: test offline library files * feat: richer metadata tests * feat: e2e tests in docker * feat: e2e test with arm64 docker * fix: manual docker compose run * fix: remove metadata processor import * fix: run e2e tests in test.yml * fix: checkout e2e assets * fix: typo * fix: checkout files in app directory * fix: increase e2e memory * fix: rm submodules * fix: revert action name * test: mark file offline when external path changes * feat: rename env var to TEST_ENV * docs: new test procedures * feat: can run docker e2e tests manually if needed * chore: use new node 20.8 for e2e * chore: bump exiftool-vendored * feat: simplify test launching * fix: rename env vars to use immich_ prefix * feat: asset folder is submodule * chore: cleanup after 20.8 upgrade * fix: don't log postgres in e2e * fix: better warning about not running all tests --------- Co-authored-by: Jonathan Jogenfors <jonathan@jogenfors.se>
80 lines
2.4 KiB
TypeScript
80 lines
2.4 KiB
TypeScript
import { QueueName } from '@app/domain';
|
|
import { RegisterQueueOptions } from '@nestjs/bullmq';
|
|
import { QueueOptions } from 'bullmq';
|
|
import { RedisOptions } from 'ioredis';
|
|
import { ConfigurationOptions } from 'typesense/lib/Typesense/Configuration';
|
|
|
|
function parseRedisConfig(): RedisOptions {
|
|
if (process.env.IMMICH_TEST_ENV == 'true') {
|
|
return {};
|
|
}
|
|
|
|
const redisUrl = process.env.REDIS_URL;
|
|
if (redisUrl && redisUrl.startsWith('ioredis://')) {
|
|
try {
|
|
const decodedString = Buffer.from(redisUrl.slice(10), 'base64').toString();
|
|
return JSON.parse(decodedString);
|
|
} catch (error) {
|
|
throw new Error(`Failed to decode redis options: ${error}`);
|
|
}
|
|
}
|
|
return {
|
|
host: process.env.REDIS_HOSTNAME || 'immich_redis',
|
|
port: parseInt(process.env.REDIS_PORT || '6379'),
|
|
db: parseInt(process.env.REDIS_DBINDEX || '0'),
|
|
username: process.env.REDIS_USERNAME || undefined,
|
|
password: process.env.REDIS_PASSWORD || undefined,
|
|
path: process.env.REDIS_SOCKET || undefined,
|
|
};
|
|
}
|
|
|
|
export const redisConfig: RedisOptions = parseRedisConfig();
|
|
|
|
export const bullConfig: QueueOptions = {
|
|
prefix: 'immich_bull',
|
|
connection: redisConfig,
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
removeOnComplete: true,
|
|
removeOnFail: false,
|
|
},
|
|
};
|
|
|
|
export const bullQueues: RegisterQueueOptions[] = Object.values(QueueName).map((name) => ({ name }));
|
|
|
|
function parseTypeSenseConfig(): ConfigurationOptions {
|
|
const typesenseURL = process.env.TYPESENSE_URL;
|
|
const common = {
|
|
apiKey: process.env.TYPESENSE_API_KEY as string,
|
|
numRetries: 15,
|
|
retryIntervalSeconds: 4,
|
|
connectionTimeoutSeconds: 10,
|
|
};
|
|
if (typesenseURL && typesenseURL.startsWith('ha://')) {
|
|
try {
|
|
const decodedString = Buffer.from(typesenseURL.slice(5), 'base64').toString();
|
|
return {
|
|
nodes: JSON.parse(decodedString),
|
|
...common,
|
|
};
|
|
} catch (error) {
|
|
throw new Error(`Failed to decode typesense options: ${error}`);
|
|
}
|
|
}
|
|
return {
|
|
nodes: [
|
|
{
|
|
host: process.env.TYPESENSE_HOST || 'typesense',
|
|
port: Number(process.env.TYPESENSE_PORT) || 8108,
|
|
protocol: process.env.TYPESENSE_PROTOCOL || 'http',
|
|
},
|
|
],
|
|
...common,
|
|
};
|
|
}
|
|
|
|
export const typesenseConfig: ConfigurationOptions = parseTypeSenseConfig();
|
|
|
|
export const REVERSE_GEOCODING_DUMP_DIRECTORY =
|
|
process.env.REVERSE_GEOCODING_DUMP_DIRECTORY || process.cwd() + '/.reverse-geocoding-dump/';
|