Skip to content

Commit 651f538

Browse files
authored
Merge branch 'main' into improve-endpoint-status-codes
2 parents b372027 + 3d54835 commit 651f538

File tree

4 files changed

+55
-27
lines changed

4 files changed

+55
-27
lines changed

test/ConfigLoader.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,13 @@ describe('ConfigLoader', () => {
332332
});
333333

334334
it('should load configuration from git repository', async function () {
335-
const source = {
335+
const source: GitSource = {
336336
type: 'git',
337337
repository: 'https://github.com/finos/git-proxy.git',
338338
path: 'proxy.config.json',
339339
branch: 'main',
340340
enabled: true,
341-
} as GitSource;
341+
};
342342

343343
const config = await configLoader.loadFromSource(source);
344344

@@ -348,37 +348,37 @@ describe('ConfigLoader', () => {
348348
}, 10000);
349349

350350
it('should throw error for invalid configuration file path (git)', async () => {
351-
const source = {
351+
const source: GitSource = {
352352
type: 'git',
353353
repository: 'https://github.com/finos/git-proxy.git',
354354
path: '\0', // Invalid path
355355
branch: 'main',
356356
enabled: true,
357-
} as GitSource;
357+
};
358358

359359
await expect(configLoader.loadFromSource(source)).rejects.toThrow(
360360
'Invalid configuration file path in repository',
361361
);
362362
});
363363

364364
it('should throw error for invalid configuration file path (file)', async () => {
365-
const source = {
365+
const source: FileSource = {
366366
type: 'file',
367367
path: '\0', // Invalid path
368368
enabled: true,
369-
} as FileSource;
369+
};
370370

371371
await expect(configLoader.loadFromSource(source)).rejects.toThrow(
372372
'Invalid configuration file path',
373373
);
374374
});
375375

376376
it('should load configuration from http', async function () {
377-
const source = {
377+
const source: HttpSource = {
378378
type: 'http',
379379
url: 'https://raw.githubusercontent.com/finos/git-proxy/refs/heads/main/proxy.config.json',
380380
enabled: true,
381-
} as HttpSource;
381+
};
382382

383383
const config = await configLoader.loadFromSource(source);
384384

@@ -388,27 +388,27 @@ describe('ConfigLoader', () => {
388388
}, 10000);
389389

390390
it('should throw error if repository is invalid', async () => {
391-
const source = {
391+
const source: GitSource = {
392392
type: 'git',
393393
repository: 'invalid-repository',
394394
path: 'proxy.config.json',
395395
branch: 'main',
396396
enabled: true,
397-
} as GitSource;
397+
};
398398

399399
await expect(configLoader.loadFromSource(source)).rejects.toThrow(
400400
'Invalid repository URL format',
401401
);
402402
});
403403

404404
it('should throw error if branch name is invalid', async () => {
405-
const source = {
405+
const source: GitSource = {
406406
type: 'git',
407407
repository: 'https://github.com/finos/git-proxy.git',
408408
path: 'proxy.config.json',
409409
branch: '..', // invalid branch pattern
410410
enabled: true,
411-
} as GitSource;
411+
};
412412

413413
await expect(configLoader.loadFromSource(source)).rejects.toThrow(
414414
'Invalid branch name format',

test/proxy.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import fs from 'fs';
1212
1313
Related: skipped tests in testProxyRoute.test.ts - these have a race condition
1414
where either these or those tests fail depending on execution order
15-
TODO: Find root cause of this error and fix it
15+
TODO: Find root cause of this error and fix it
16+
https://github.com/finos/git-proxy/issues/1294
1617
*/
1718
describe.skip('Proxy Module TLS Certificate Loading', () => {
1819
let proxyModule: any;
@@ -111,8 +112,8 @@ describe.skip('Proxy Module TLS Certificate Loading', () => {
111112
afterEach(async () => {
112113
try {
113114
await proxyModule.stop();
114-
} catch {
115-
// ignore cleanup errors
115+
} catch (err) {
116+
console.error('Error occurred when stopping the proxy: ', err);
116117
}
117118
vi.restoreAllMocks();
118119
});

test/testProxyRoute.test.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ import service from '../src/service';
2020
const TEST_DEFAULT_REPO = {
2121
url: 'https://github.com/finos/git-proxy.git',
2222
name: 'git-proxy',
23-
project: 'finos/git-proxy',
23+
project: 'finos',
2424
host: 'github.com',
2525
proxyUrlPrefix: '/github.com/finos/git-proxy.git',
2626
};
2727

2828
const TEST_GITLAB_REPO = {
2929
url: 'https://gitlab.com/gitlab-community/meta.git',
3030
name: 'gitlab',
31-
project: 'gitlab-community/meta',
31+
project: 'gitlab-community',
3232
host: 'gitlab.com',
3333
proxyUrlPrefix: '/gitlab.com/gitlab-community/meta.git',
3434
};
3535

3636
const TEST_UNKNOWN_REPO = {
3737
url: 'https://github.com/finos/fdc3.git',
3838
name: 'fdc3',
39-
project: 'finos/fdc3',
39+
project: 'finos',
4040
host: 'github.com',
4141
proxyUrlPrefix: '/github.com/finos/fdc3.git',
4242
fallbackUrlPrefix: '/finos/fdc3.git',
@@ -214,6 +214,31 @@ describe.skip('proxy express application', () => {
214214
expect(res2.status).toBe(200);
215215
expect(res2.text).toContain('Rejecting repo');
216216
}, 5000);
217+
218+
it('should create the default repo if it does not exist', async function () {
219+
// Remove the default repo from the db and check it no longer exists
220+
await cleanupRepo(TEST_DEFAULT_REPO.url);
221+
222+
const repo = await db.getRepoByUrl(TEST_DEFAULT_REPO.url);
223+
expect(repo).toBeNull();
224+
225+
// Restart the proxy
226+
await proxy.stop();
227+
await proxy.start();
228+
229+
// Check that the default repo was created in the db
230+
const repo2 = await db.getRepoByUrl(TEST_DEFAULT_REPO.url);
231+
expect(repo2).not.toBeNull();
232+
233+
// Check that the default repo isn't duplicated on subsequent restarts
234+
await proxy.stop();
235+
await proxy.start();
236+
237+
const allRepos = await db.getRepos();
238+
const matchingRepos = allRepos.filter((r) => r.url === TEST_DEFAULT_REPO.url);
239+
240+
expect(matchingRepos).toHaveLength(1);
241+
});
217242
});
218243

219244
describe('handleRefsErrorMessage', () => {

website/src/pages/index.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Layout from '@theme/Layout';
33
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
44
import Avatar from '../components/avatar';
55
import Testimonials from './testimonials';
6-
import ReactPlayer from 'react-player';
76
import axios from 'axios';
87

98
/**
@@ -60,14 +59,17 @@ function Home() {
6059
</header>
6160
{showDemo ? (
6261
<section style={{ background: 'black' }}>
63-
<ReactPlayer
64-
url='https://www.finos.org/hubfs/Projects%20%2B%20SIGs/Open%20Source%20Readiness%20OSR/OSR%20Meeting_%20GitProxy%20Jamie%20Slome%20Citi%20Presentation.mp4#t=496'
65-
controls={true}
66-
width='100%'
67-
pip={true}
68-
stopOnUnmount={false}
69-
playing={true}
70-
/>
62+
<video
63+
controls
64+
style={{ width: '100%', display: 'block', aspectRatio: '16/9' }}
65+
preload='metadata'
66+
>
67+
<source
68+
src='https://www.finos.org/hubfs/Projects%20%2B%20SIGs/Open%20Source%20Readiness%20OSR/OSR%20Meeting_%20GitProxy%20Jamie%20Slome%20Citi%20Presentation.mp4#t=496'
69+
type='video/mp4'
70+
/>
71+
Your browser does not support the video tag.
72+
</video>
7173
</section>
7274
) : (
7375
<section className='terminal'>

0 commit comments

Comments
 (0)