Skip to content

Commit

Permalink
feat(ng-dev/caretaker): add status urls to caretaker check
Browse files Browse the repository at this point in the history
Add the status urls to the caretaker check for failing services to allow easier detail
checks of the status for caretakers.
  • Loading branch information
josephperrott authored and devversion committed Oct 26, 2022
1 parent e7b8ac6 commit d87b1b5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ng-dev/caretaker/check/services.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ describe('ServicesModule', () => {
let infoGroupSpy: jasmine.Spy;
let git: AuthenticatedGitClient;

services.splice(0, Infinity, {url: 'fakeStatus.com/api.json', name: 'Service Name'});
services.splice(0, Infinity, {
url: 'fakeStatus.com/api.json',
prettyUrl: 'fakeStatus.com',
name: 'Service Name',
});

beforeEach(async () => {
getStatusFromStandardApiSpy = spyOn(ServicesModule.prototype, 'getStatusFromStandardApi');
Expand All @@ -35,6 +39,7 @@ describe('ServicesModule', () => {
expect(getStatusFromStandardApiSpy).toHaveBeenCalledWith({
url: 'fakeStatus.com/api.json',
name: 'Service Name',
prettyUrl: 'fakeStatus.com',
});
});
});
Expand All @@ -47,12 +52,14 @@ describe('ServicesModule', () => {
status: 'passing',
description: 'Everything is working great',
lastUpdated: new Date(0),
statusUrl: 'http://google.com',
},
{
name: 'Service 2',
status: 'failing',
description: 'Literally everything is broken',
lastUpdated: new Date(0),
statusUrl: 'http://notgoogle.com',
},
]);

Expand All @@ -66,6 +73,7 @@ describe('ServicesModule', () => {
`Service 2 ❌ (Updated: ${new Date(0).toLocaleString()})`,
);
expect(infoSpy).toHaveBeenCalledWith(' Details: Literally everything is broken');
expect(infoSpy).toHaveBeenCalledWith(' Status URL: http://notgoogle.com');
});
});
});
8 changes: 8 additions & 0 deletions ng-dev/caretaker/check/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {BaseModule} from './base.js';
interface ServiceConfig {
name: string;
url: string;
prettyUrl: string;
}

/**
Expand All @@ -36,23 +37,28 @@ interface StatusCheckResult {
status: 'passing' | 'failing';
description: string;
lastUpdated: Date;
statusUrl: string;
}

/** List of services Angular relies on. */
export const services: ServiceConfig[] = [
{
prettyUrl: 'https://status.us-west-1.saucelabs.com',
url: 'https://status.us-west-1.saucelabs.com/api/v2/status.json',
name: 'Saucelabs',
},
{
prettyUrl: 'https://status.npmjs.org/',
url: 'https://status.npmjs.org/api/v2/status.json',
name: 'Npm',
},
{
prettyUrl: 'https://status.circleci.com',
url: 'https://status.circleci.com/api/v2/status.json',
name: 'CircleCi',
},
{
prettyUrl: 'https://www.githubstatus.com',
url: 'https://www.githubstatus.com/api/v2/status.json',
name: 'Github',
},
Expand All @@ -74,6 +80,7 @@ export class ServicesModule extends BaseModule<StatusCheckResult[]> {
} else {
Log.info.group(`${name} ❌ (Updated: ${status.lastUpdated.toLocaleString()})`);
Log.info(` Details: ${status.description}`);
Log.info(` Status URL: ${status.statusUrl}`);
Log.info.groupEnd();
}
}
Expand All @@ -87,6 +94,7 @@ export class ServicesModule extends BaseModule<StatusCheckResult[]> {
const status = result.status.indicator === 'none' ? 'passing' : 'failing';
return {
name: service.name,
statusUrl: service.prettyUrl,
status,
description: result.status.description,
lastUpdated: new Date(result.page.updated_at),
Expand Down

0 comments on commit d87b1b5

Please sign in to comment.