chore: update port to 4000 in tests and compose

This commit is contained in:
asepharyana
2026-08-02 14:30:58 +07:00
parent 66fb92e5af
commit ad7747bfd4
6 changed files with 26 additions and 26 deletions
+3 -3
View File
@@ -10,7 +10,7 @@ services:
- STORAGE_CHANNEL_ID=${STORAGE_CHANNEL_ID}
- BASE_URL=${BASE_URL}
- DATABASE_URL=${DATABASE_URL}
- PORT=3000
- PORT=4000
- NODE_ENV=production
- LOG_LEVEL=info
- TRUST_PROXY=true
@@ -46,7 +46,7 @@ services:
healthcheck:
test:
- CMD-SHELL
- "bun -e \"fetch('http://localhost:3000/health').then(r => r.status === 200 ? process.exit(0) : process.exit(1))\""
- "bun -e \"fetch('http://localhost:4000/health').then(r => r.status === 200 ? process.exit(0) : process.exit(1))\""
interval: 30s
timeout: 10s
retries: 3
@@ -59,7 +59,7 @@ services:
- "traefik.http.routers.filedrop.entrypoints=websecure"
- "traefik.http.routers.filedrop.tls=true"
- "traefik.http.routers.filedrop.tls.certresolver=cloudflare"
- "traefik.http.services.filedrop.loadbalancer.server.port=3000"
- "traefik.http.services.filedrop.loadbalancer.server.port=4000"
- "traefik.http.middlewares.filedrop-rl.ratelimit.average=300"
- "traefik.http.middlewares.filedrop-rl.ratelimit.burst=100"
- "traefik.http.middlewares.filedrop-rl.ratelimit.period=1m"
+6 -6
View File
@@ -151,7 +151,7 @@ describe('File Route Handlers', () => {
it('should return 404 if file is not found in database', async () => {
mockFindByPublicId.mockImplementationOnce(async () => null);
const req = requestWithPublicId('http://localhost:3000/f/missing-id', 'missing-id');
const req = requestWithPublicId('http://localhost:4000/f/missing-id', 'missing-id');
const res = await handleFileRedirect(req);
expect(res.status).toBe(404);
const body = await responseJson<ErrorBody>(res);
@@ -187,7 +187,7 @@ describe('File Route Handlers', () => {
updatedAt: new Date('2026-05-18T00:00:00.000Z'),
}));
const req = requestWithPublicId('http://localhost:3000/f/test-id', 'test-id');
const req = requestWithPublicId('http://localhost:4000/f/test-id', 'test-id');
const res = await handleFileRedirect(req);
expect(res.status).toBe(302);
@@ -201,7 +201,7 @@ describe('File Route Handlers', () => {
throw new Error('DB Connection Error');
});
const req = requestWithPublicId('http://localhost:3000/f/test-id', 'test-id');
const req = requestWithPublicId('http://localhost:4000/f/test-id', 'test-id');
const res = await handleFileRedirect(req);
expect(res.status).toBe(500);
const body = await responseJson<ErrorBody>(res);
@@ -213,7 +213,7 @@ describe('File Route Handlers', () => {
it('should return 404 if file is not found in database', async () => {
mockFindByPublicId.mockImplementationOnce(async () => null);
const req = requestWithPublicId('http://localhost:3000/file/missing-id/info', 'missing-id');
const req = requestWithPublicId('http://localhost:4000/file/missing-id/info', 'missing-id');
const res = await handleFileInfo(req);
expect(res.status).toBe(404);
const body = await responseJson<ErrorBody>(res);
@@ -251,7 +251,7 @@ describe('File Route Handlers', () => {
mockFindByPublicId.mockImplementationOnce(async () => dbFile);
const req = requestWithPublicId('http://localhost:3000/file/test-id/info', 'test-id');
const req = requestWithPublicId('http://localhost:4000/file/test-id/info', 'test-id');
const res = await handleFileInfo(req);
expect(res.status).toBe(200);
const body = await responseJson<FileInfoBody>(res);
@@ -273,7 +273,7 @@ describe('File Route Handlers', () => {
throw new Error('DB Connection Error');
});
const req = requestWithPublicId('http://localhost:3000/file/test-id/info', 'test-id');
const req = requestWithPublicId('http://localhost:4000/file/test-id/info', 'test-id');
const res = await handleFileInfo(req);
expect(res.status).toBe(500);
const body = await responseJson<ErrorBody>(res);
+2 -2
View File
@@ -19,7 +19,7 @@ describe('Health Route Handler', () => {
});
it('should return status 200 and ok when DB is healthy', async () => {
const req = new Request('http://localhost:3000/health');
const req = new Request('http://localhost:4000/health');
const res = await handleHealth(req);
expect(res.status).toBe(200);
@@ -30,7 +30,7 @@ describe('Health Route Handler', () => {
it('should return status 500 and error details when DB health check fails', async () => {
mockExecute.mockImplementationOnce(() => Promise.reject(new Error('DB Connection Failed')));
const req = new Request('http://localhost:3000/health');
const req = new Request('http://localhost:4000/health');
const res = await handleHealth(req);
expect(res.status).toBe(500);
+3 -3
View File
@@ -3,7 +3,7 @@ import { afterAll, beforeAll, describe, expect, it, mock } from 'bun:test';
process.env.NODE_ENV = 'test';
process.env.BOT_TOKEN = '123456:ABC-DEF';
process.env.STORAGE_CHANNEL_ID = '-1001234567890';
process.env.BASE_URL = 'http://localhost:3000';
process.env.BASE_URL = 'http://localhost:4000';
process.env.DATABASE_URL = 'postgresql://localhost/test';
process.env.PORT = '3000';
process.env.S3_ACCESS_KEY = 'filedrop-admin';
@@ -90,7 +90,7 @@ describe('S3 bucket configuration compatibility', () => {
});
it('returns VersioningConfiguration for path-style GetBucketVersioning', async () => {
const res = await handleS3Request(new Request('http://localhost:3000/gitea?versioning'));
const res = await handleS3Request(new Request('http://localhost:4000/gitea?versioning'));
const body = await res.text();
expect(res.status).toBe(200);
@@ -101,7 +101,7 @@ describe('S3 bucket configuration compatibility', () => {
it('returns VersioningConfiguration for virtual-hosted GetBucketVersioning', async () => {
const res = await handleS3Request(
new Request('http://gitea.localhost:3000/?versioning'),
new Request('http://gitea.localhost:4000/?versioning'),
'gitea',
);
const body = await res.text();
+7 -7
View File
@@ -117,7 +117,7 @@ describe('Upload Route Handler', () => {
});
it('should reject unsupported content types with 400 status', async () => {
const req = new Request('http://localhost:3000/api/upload', {
const req = new Request('http://localhost:4000/api/upload', {
method: 'POST',
headers: {
'content-type': 'text/plain',
@@ -132,7 +132,7 @@ describe('Upload Route Handler', () => {
});
it('should process JSON upload (base64) successfully', async () => {
const req = new Request('http://localhost:3000/api/upload', {
const req = new Request('http://localhost:4000/api/upload', {
method: 'POST',
headers: {
'content-type': 'application/json',
@@ -160,7 +160,7 @@ describe('Upload Route Handler', () => {
});
it('should reject JSON upload without file key', async () => {
const req = new Request('http://localhost:3000/api/upload', {
const req = new Request('http://localhost:4000/api/upload', {
method: 'POST',
headers: {
'content-type': 'application/json',
@@ -181,7 +181,7 @@ describe('Upload Route Handler', () => {
const fileBlob = new Blob([realPhotoBuffer], { type: 'image/png' });
formData.append('file', fileBlob, 'test_multi.png');
const req = new Request('http://localhost:3000/api/upload', {
const req = new Request('http://localhost:4000/api/upload', {
method: 'POST',
body: formData,
});
@@ -214,7 +214,7 @@ describe('Upload Route Handler', () => {
const fileBlob = new Blob([Buffer.from('multipart hello')], { type: 'text/plain' });
formData.append('file', fileBlob, 'test_multi.txt');
const req = new Request('http://localhost:3000/api/upload', {
const req = new Request('http://localhost:4000/api/upload', {
method: 'POST',
body: formData,
});
@@ -252,7 +252,7 @@ describe('Upload Route Handler', () => {
updatedAt: new Date('2026-05-18T00:00:00.000Z'),
};
const req = new Request('http://localhost:3000/api/upload', {
const req = new Request('http://localhost:4000/api/upload', {
method: 'POST',
headers: {
'content-type': 'application/json',
@@ -281,7 +281,7 @@ describe('Upload Route Handler', () => {
});
it('should reject oversized request by Content-Length header', async () => {
const req = new Request('http://localhost:3000/api/upload', {
const req = new Request('http://localhost:4000/api/upload', {
method: 'POST',
headers: {
'content-type': 'application/json',
+5 -5
View File
@@ -58,7 +58,7 @@ describe('Web API v1', () => {
beforeAll(async () => {
process.env.BOT_TOKEN = '123456:ABC-DEF';
process.env.STORAGE_CHANNEL_ID = '-1001234567890';
process.env.BASE_URL = 'http://localhost:3000';
process.env.BASE_URL = 'http://localhost:4000';
process.env.DATABASE_URL = 'postgresql://localhost/test';
const webApi = await import('../src/interfaces/http/controllers/web-api-controller');
handleWebApiV1 = webApi.handleWebApiV1;
@@ -74,7 +74,7 @@ describe('Web API v1', () => {
});
it('should list buckets via GET /api/v1/buckets', async () => {
const req = new Request('http://localhost:3000/api/v1/buckets');
const req = new Request('http://localhost:4000/api/v1/buckets');
const res = await handleWebApiV1(req);
expect(res.status).toBe(200);
const data = (await res.json()) as { buckets: { name: string }[] };
@@ -84,7 +84,7 @@ describe('Web API v1', () => {
});
it('should return 404 for unknown API path', async () => {
const req = new Request('http://localhost:3000/api/v1/unknown');
const req = new Request('http://localhost:4000/api/v1/unknown');
const res = await handleWebApiV1(req);
expect(res.status).toBe(404);
const data = (await res.json()) as { error: string };
@@ -92,7 +92,7 @@ describe('Web API v1', () => {
});
it('should return 400 for invalid bucket name on create', async () => {
const req = new Request('http://localhost:3000/api/v1/buckets', {
const req = new Request('http://localhost:4000/api/v1/buckets', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ name: 'INVALID_NAME!' }),
@@ -117,7 +117,7 @@ describe('Web API v1', () => {
},
];
const req = new Request('http://localhost:3000/api/v1/buckets/test-bucket/objects');
const req = new Request('http://localhost:4000/api/v1/buckets/test-bucket/objects');
const res = await handleWebApiV1(req);
expect(res.status).toBe(200);