From a4a006e490f40d151c875a483977fbf6450be085 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 29 Jan 2017 18:05:39 +0100 Subject: [PATCH] fix tests to run in parallel --- dist/cflare.classes.cflareaccount.js | 7 +++++-- test/test.js | 22 ++++------------------ test/test.ts | 21 ++++----------------- ts/cflare.classes.cflareaccount.ts | 4 +++- 4 files changed, 16 insertions(+), 38 deletions(-) diff --git a/dist/cflare.classes.cflareaccount.js b/dist/cflare.classes.cflareaccount.js index 1978f36..d1af7f1 100644 --- a/dist/cflare.classes.cflareaccount.js +++ b/dist/cflare.classes.cflareaccount.js @@ -137,10 +137,13 @@ class CflareAccount { if (response.statusCode === 200) { done.resolve(response.body); } - else if (response.statusCode === 429 || response.statusCode === 400) { + else if (response.statusCode === 429) { console.log('rate limited! Waiting for retry!'); retryRequest(); } + else if (response.statusCode === 400) { + console.log('bad request! Going to retry!'); + } else { console.log(response.statusCode); done.reject(new Error('request failed')); @@ -162,4 +165,4 @@ class CflareAccount { } } exports.CflareAccount = CflareAccount; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ZsYXJlLmNsYXNzZXMuY2ZsYXJlYWNjb3VudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2NmbGFyZS5jbGFzc2VzLmNmbGFyZWFjY291bnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUEsMEJBQXdCO0FBQ3hCLDRDQUE0QztBQUk1QztJQUdJO0lBRUEsQ0FBQztJQUVELElBQUksQ0FBQyxVQUEwQztRQUMzQyxJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxLQUFLLENBQUE7UUFDakMsSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsR0FBRyxDQUFBO0lBQ2pDLENBQUM7SUFFRCxTQUFTLENBQUMsVUFBa0I7UUFDeEIsSUFBSSx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QUcsSUFBSSxDQUFDO1lBQ3RGLE9BQU8sQ0FBQyxHQUFHLENBQUMsaUNBQWlDLFlBQVksS0FBSyxDQUFDLENBQUE7WUFDL0QsTUFBTSxPQUFPLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxZQUFZLENBQUMsQ0FBQTtZQUMvQyxFQUFFLENBQUMsQ0FBQyxVQUFVLEdBQUcsRUFBRSxDQUFDLENBQUMsQ0FBQztnQkFDbEIsVUFBVSxFQUFFLENBQUE7Z0JBQ1osTUFBTSxDQUFDLE1BQU0sV0FBVyxFQUFFLENBQUE7WUFDOUIsQ0FBQztRQUNMLENBQUMsQ0FBQSxDQUFBO1FBQ0QsV0FBVyxFQUFFLENBQUE7UUFDYixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtJQUN2QixDQUFDO0lBRU8sU0FBUztRQUNiLE1BQU0sQ0FBQyxDQUFDLElBQUksQ0FBQyxTQUFTLElBQUksSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFBLENBQUMsNkJBQTZCO0lBQ3pFLENBQUM7Q0FDSjtBQTNKRCxzQ0EySkMifQ== \ No newline at end of file diff --git a/test/test.js b/test/test.js index c587ef5..a87863d 100644 --- a/test/test.js +++ b/test/test.js @@ -9,6 +9,7 @@ testCflareAccount.auth({ email: process.env.CF_EMAIL, key: process.env.CF_KEY }); +let randomPrefix = Math.floor(Math.random() * 2000); describe('cflare', function () { describe('.CflareAccount', function () { describe('.listZones()', function () { @@ -40,16 +41,9 @@ describe('cflare', function () { }); }); describe('.createRecord', function () { - it('should create a valid record for a level 2 domain', function (done) { - this.timeout(600000); - testCflareAccount.createRecord('bleu.de', 'A', '127.0.0.1') - .then(function (responseArg) { - done(); - }); - }); it('should create a valid record for a subdomain', function (done) { this.timeout(600000); - testCflareAccount.createRecord('subdomain.bleu.de', 'A', '127.0.0.1') + testCflareAccount.createRecord(`${randomPrefix}subdomain.bleu.de`, 'A', '127.0.0.1') .then(function (responseArg) { done(); }); @@ -66,17 +60,9 @@ describe('cflare', function () { }); }); describe('.removeRecord', function () { - it('should remove a record from Cloudflare', function (done) { - this.timeout(600000); - testCflareAccount.removeRecord('bleu.de', 'A') - .then(function (responseArg) { - console.log(responseArg); - done(); - }); - }); it('should remove a subdomain record from Cloudflare', function (done) { this.timeout(600000); - testCflareAccount.removeRecord('subdomain.bleu.de', 'A') + testCflareAccount.removeRecord(`${randomPrefix}subdomain.bleu.de`, 'A') .then(function (responseArg) { console.log(responseArg); done(); @@ -85,4 +71,4 @@ describe('cflare', function () { }); }); }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQix3Q0FBd0M7QUFFeEMsK0JBQTJCO0FBQzNCLElBQUksUUFBUSxHQUFHLElBQUksV0FBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsRUFBRSxPQUFPLENBQUMsR0FBRyxFQUFFLEdBQUcsU0FBUyxDQUFDLENBQUE7QUFDakUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsY0FBYyxDQUFDLENBQUE7QUFDcEMsSUFBSSxpQkFBaUIsR0FBRyxJQUFJLE1BQU0sQ0FBQyxhQUFhLEVBQUUsQ0FBQTtBQUNsRCxpQkFBaUIsQ0FBQyxJQUFJLENBQUM7SUFDbkIsS0FBSyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsUUFBUTtJQUMzQixHQUFHLEVBQUUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxNQUFNO0NBQzFCLENBQUMsQ0FBQTtBQUVGLFFBQVEsQ0FBQyxRQUFRLEVBQUU7SUFDZixRQUFRLENBQUMsZ0JBQWdCLEVBQUU7UUFDdkIsUUFBUSxDQUFDLGNBQWMsRUFBRTtZ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DQUFDLENBQUMsQ0FBQTtRQUNGLFFBQVEsQ0FBQyxZQUFZLEVBQUU7WUFDbkIsRUFBRSxDQUFDLHFDQUFxQyxFQUFFLFVBQVUsSUFBSTtnQkFDcEQsSUFBSSxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQTtnQkFDcEIsaUJBQWlCLENBQUMsU0FBUyxDQUFDLFNBQVMsRUFBRSxHQUFHLENBQUM7cUJBQ3RDLElBQUksQ0FBQyxVQUFVLFdBQVc7b0JBQ3ZCLE9BQU8sQ0FBQyxHQUFHLENBQUMsV0FBVyxDQUFDLENBQUE7b0JBQ3hCLElBQUksRUFBRSxDQUFBO2dCQUNWLENBQUMsQ0FBQyxDQUFBO1lBQ1YsQ0FBQyxDQUFDLENBQUE7UUFDTixDQUFDLENBQUMsQ0FBQTtRQUNGLFFBQVEsQ0FBQyxlQUFlLEVBQUU7WUFDdEIsRUFBRSxDQUFDLGtEQUFrRCxFQUFFLFVBQVUsSUFBSTtnQkFDakUsSUFBSSxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQTtnQkFDcEIsaUJBQWlCLENBQUMsWUFBWSxDQUFDLEdBQUcsWUFBWSxtQkFBbUIsRUFBRSxHQUFHLENBQUM7cUJBQ2xFLElBQUksQ0FBQyxVQUFVLFdBQVc7b0JBQ3ZCLE9BQU8sQ0FBQyxHQUFHLENBQUMsV0FBVyxDQUFDLENBQUE7b0JBQ3hCLElBQUksRUFBRSxDQUFBO2dCQUNWLENBQUMsQ0FBQyxDQUFBO1lBQ1YsQ0FBQyxDQUFDLENBQUE7UUFDTixDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ== \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index ce45241..5d9a65d 100644 --- a/test/test.ts +++ b/test/test.ts @@ -10,6 +10,8 @@ testCflareAccount.auth({ key: process.env.CF_KEY }) +let randomPrefix = Math.floor(Math.random() * 2000) + describe('cflare', function () { describe('.CflareAccount', function () { describe('.listZones()', function () { @@ -41,16 +43,9 @@ describe('cflare', function () { }) }) describe('.createRecord', function () { - it('should create a valid record for a level 2 domain', function (done) { - this.timeout(600000) - testCflareAccount.createRecord('bleu.de', 'A', '127.0.0.1') - .then(function (responseArg) { - done() - }) - }) it('should create a valid record for a subdomain', function (done) { this.timeout(600000) - testCflareAccount.createRecord('subdomain.bleu.de', 'A', '127.0.0.1') + testCflareAccount.createRecord(`${randomPrefix}subdomain.bleu.de`, 'A', '127.0.0.1') .then(function (responseArg) { done() }) @@ -67,17 +62,9 @@ describe('cflare', function () { }) }) describe('.removeRecord', function () { - it('should remove a record from Cloudflare', function (done) { - this.timeout(600000) - testCflareAccount.removeRecord('bleu.de', 'A') - .then(function (responseArg) { - console.log(responseArg) - done() - }) - }) it('should remove a subdomain record from Cloudflare', function (done) { this.timeout(600000) - testCflareAccount.removeRecord('subdomain.bleu.de', 'A') + testCflareAccount.removeRecord(`${randomPrefix}subdomain.bleu.de`, 'A') .then(function (responseArg) { console.log(responseArg) done() diff --git a/ts/cflare.classes.cflareaccount.ts b/ts/cflare.classes.cflareaccount.ts index c43fc95..18ca946 100644 --- a/ts/cflare.classes.cflareaccount.ts +++ b/ts/cflare.classes.cflareaccount.ts @@ -133,9 +133,11 @@ export class CflareAccount { ) if (response.statusCode === 200) { done.resolve(response.body) - } else if (response.statusCode === 429 || response.statusCode === 400) { + } else if (response.statusCode === 429) { console.log('rate limited! Waiting for retry!') retryRequest() + } else if(response.statusCode === 400) { + console.log('bad request! Going to retry!') } else { console.log(response.statusCode) done.reject(new Error('request failed'))