Skip to content

Commit

Permalink
Merge pull request #55 from HangHae-plus-2-9/dev
Browse files Browse the repository at this point in the history
Remove Http checking on health check
  • Loading branch information
HC-kang authored Oct 31, 2023
2 parents 0ec01d8 + b7b523f commit 3f55a1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/modules/health-check/health-check.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ describe('HealthCheckController', () => {

it('should run general health checks', async () => {
// Arrange
const httpResult = { status: 'up' };
// const httpResult = { status: 'up' };
const dbResult = { status: 'up' };
const sampleResult = { status: 'up' };

const httpSpy = jest
.spyOn(mockHttp, 'pingCheck')
.mockResolvedValue(httpResult as unknown as HealthIndicatorResult);
// const httpSpy = jest
// .spyOn(mockHttp, 'pingCheck')
// .mockResolvedValue(httpResult as unknown as HealthIndicatorResult);
const dbSpy = jest
.spyOn(mockTypeOrm, 'pingCheck')
.mockResolvedValue(dbResult as unknown as HealthIndicatorResult);
Expand All @@ -99,12 +99,13 @@ describe('HealthCheckController', () => {

// Assert
expect(healthSpy).toHaveBeenCalled();
expect(httpSpy).toHaveBeenCalledWith('google', 'https://google.com');
// expect(httpSpy).toHaveBeenCalledWith('google', 'https://google.com');
expect(dbSpy).toHaveBeenCalledWith('database', { timeout: 300 });
expect(sampleSpy).toHaveBeenCalledWith('sample');
expect(result).toEqual({
status: 'up',
info: [httpResult, dbResult, sampleResult],
info: [dbResult, sampleResult],
// info: [httpResult, dbResult, sampleResult],
});
});
});
2 changes: 1 addition & 1 deletion src/modules/health-check/health-check.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class HealthCheckController {
@HealthCheck()
check() {
return this.health.check([
() => this.http.pingCheck('google', 'https://google.com'),
// () => this.http.pingCheck('google', 'https://google.com'),
() => this.db.pingCheck('database', { timeout: 300 }),
() => this.sampleHealthIndicator.isHealthy('sample'),
]);
Expand Down

0 comments on commit 3f55a1b

Please sign in to comment.