Skip to content

Commit

Permalink
Merge pull request #160 from jsdelivr/new-qa
Browse files Browse the repository at this point in the history
feat: different qa endpoints
  • Loading branch information
jimaek authored Jun 13, 2023
2 parents 3efc319 + 431d6ad commit 1957942
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/lib/status-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ export class StatusManager {
private async pingTest () {
const packets = config.get<number>('status.numberOfPackets');
const results = await Promise.allSettled([
this.pingCmd({ type: 'ping', target: 'a.root-servers.net', packets, inProgressUpdates: false }),
this.pingCmd({ type: 'ping', target: 'ns1.registry.in', packets, inProgressUpdates: false }),
this.pingCmd({ type: 'ping', target: 'k.root-servers.net', packets, inProgressUpdates: false }),
this.pingCmd({ type: 'ping', target: 'j.root-servers.net', packets, inProgressUpdates: false }),
this.pingCmd({ type: 'ping', target: 'ns1.dns.nl', packets, inProgressUpdates: false }),
]);

const fulfilledPromises = results.filter((promise): promise is PromiseFulfilledResult<ExecaReturnValue> => promise.status === 'fulfilled');
Expand Down
8 changes: 4 additions & 4 deletions test/unit/lib/status-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ describe('StatusManager', () => {
pingCmd.rejects({ stdout: 'host not found' });
await statusManager.start();
expect(pingCmd.callCount).to.equal(3);
expect(pingCmd.args[0]).to.deep.equal([{ type: 'ping', target: 'a.root-servers.net', packets: 6, inProgressUpdates: false }]);
expect(pingCmd.args[0]).to.deep.equal([{ type: 'ping', target: 'ns1.registry.in', packets: 6, inProgressUpdates: false }]);
expect(pingCmd.args[1]).to.deep.equal([{ type: 'ping', target: 'k.root-servers.net', packets: 6, inProgressUpdates: false }]);
expect(pingCmd.args[2]).to.deep.equal([{ type: 'ping', target: 'j.root-servers.net', packets: 6, inProgressUpdates: false }]);
expect(pingCmd.args[2]).to.deep.equal([{ type: 'ping', target: 'ns1.dns.nl', packets: 6, inProgressUpdates: false }]);
expect(statusManager.getStatus()).to.equal('ping-test-failed');
expect(socket.emit.callCount).to.equal(1);
expect(socket.emit.args[0]).to.deep.equal([ 'probe:status:update', 'ping-test-failed' ]);
Expand Down Expand Up @@ -110,9 +110,9 @@ describe('StatusManager', () => {
const statusManager = initStatusManager(socket, pingCmd);
await statusManager.start();
expect(pingCmd.callCount).to.equal(3);
expect(pingCmd.args[0]).to.deep.equal([{ type: 'ping', target: 'a.root-servers.net', packets: 6, inProgressUpdates: false }]);
expect(pingCmd.args[0]).to.deep.equal([{ type: 'ping', target: 'ns1.registry.in', packets: 6, inProgressUpdates: false }]);
expect(pingCmd.args[1]).to.deep.equal([{ type: 'ping', target: 'k.root-servers.net', packets: 6, inProgressUpdates: false }]);
expect(pingCmd.args[2]).to.deep.equal([{ type: 'ping', target: 'j.root-servers.net', packets: 6, inProgressUpdates: false }]);
expect(pingCmd.args[2]).to.deep.equal([{ type: 'ping', target: 'ns1.dns.nl', packets: 6, inProgressUpdates: false }]);
expect(statusManager.getStatus()).to.equal('ready');
expect(socket.emit.callCount).to.equal(1);
expect(socket.emit.args[0]).to.deep.equal([ 'probe:status:update', 'ready' ]);
Expand Down

0 comments on commit 1957942

Please sign in to comment.