fix(server): exclude archived assets from orphaned files ()

* fix(server): exclude archived assets from orphaned files

* add e2e test
This commit is contained in:
Michel Heusschen 2024-02-22 17:16:10 +01:00 committed by GitHub
parent b3131dfe14
commit 07ef008b40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 68 additions and 2 deletions
e2e/src

View file

@ -17,14 +17,17 @@ import {
updatePerson,
} from '@immich/sdk';
import { BrowserContext } from '@playwright/test';
import { spawn } from 'child_process';
import { exec, spawn } from 'child_process';
import { randomBytes } from 'node:crypto';
import { access } from 'node:fs/promises';
import path from 'node:path';
import { promisify } from 'node:util';
import pg from 'pg';
import { loginDto, signupDto } from 'src/fixtures';
import request from 'supertest';
const execPromise = promisify(exec);
export const app = 'http://127.0.0.1:2283/api';
const directoryExists = (directory: string) =>
@ -35,6 +38,9 @@ const directoryExists = (directory: string) =>
// TODO move test assets into e2e/assets
export const testAssetDir = path.resolve(`./../server/test/assets/`);
const serverContainerName = 'immich-e2e-server';
const uploadMediaDir = '/usr/src/app/upload/upload';
if (!(await directoryExists(`${testAssetDir}/albums`))) {
throw new Error(
`Test assets not found. Please checkout https://github.com/immich-app/test-assets into ${testAssetDir} before testing`
@ -50,6 +56,14 @@ export const asKeyAuth = (key: string) => ({ 'x-api-key': key });
let client: pg.Client | null = null;
export const fileUtils = {
reset: async () => {
await execPromise(
`docker exec -i "${serverContainerName}" rm -R "${uploadMediaDir}"`
);
},
};
export const dbUtils = {
createFace: async ({
assetId,