diff --git a/cli/src/index.ts b/cli/src/index.ts index 1aab0386a1..e9485190a7 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -44,7 +44,7 @@ program .default(false), ) .addOption( - new Option('-c, --concurrency', 'Number of assets to upload at the same time') + new Option('-c, --concurrency ', 'Number of assets to upload at the same time') .env('IMMICH_UPLOAD_CONCURRENCY') .default(4), ) diff --git a/e2e/src/cli/specs/upload.e2e-spec.ts b/e2e/src/cli/specs/upload.e2e-spec.ts index 27362ef237..bc4382f98e 100644 --- a/e2e/src/cli/specs/upload.e2e-spec.ts +++ b/e2e/src/cli/specs/upload.e2e-spec.ts @@ -142,4 +142,42 @@ describe(`immich upload`, () => { expect(assets.length).toBe(9); }); }); + + describe('immich upload --concurrency ', () => { + it('should work', async () => { + const { stderr, stdout, exitCode } = await immichCli([ + 'upload', + `${testAssetDir}/albums/nature/`, + '--concurrency', + '2', + ]); + + expect(stderr).toBe(''); + expect(stdout.split('\n')).toEqual( + expect.arrayContaining([expect.stringContaining('Successfully uploaded 9 assets')]), + ); + expect(exitCode).toBe(0); + + const assets = await getAllAssets({}, { headers: asKeyAuth(key) }); + expect(assets.length).toBe(9); + }); + + it('should reject string argument', async () => { + const { stderr, exitCode } = await immichCli([ + 'upload', + `${testAssetDir}/albums/nature/`, + '--concurrency string', + ]); + + expect(stderr).toContain('unknown option'); + expect(exitCode).not.toBe(0); + }); + + it('should reject command without number', async () => { + const { stderr, exitCode } = await immichCli(['upload', `${testAssetDir}/albums/nature/`, '--concurrency']); + + expect(stderr).toContain('argument missing'); + expect(exitCode).not.toBe(0); + }); + }); });