fix tests to run in parallel

This commit is contained in:
Philipp Kunz 2017-01-29 18:05:39 +01:00
parent 98d5127846
commit a4a006e490
4 changed files with 16 additions and 38 deletions

File diff suppressed because one or more lines are too long

View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQix3Q0FBd0M7QUFFeEMsK0JBQTJCO0FBQzNCLElBQUksUUFBUSxHQUFHLElBQUksV0FBSSxDQUFDLE9BQU8sQ0FBQ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xNQUFNLENBQUMsQ0FBQTtnQkFDcEIsaUJBQWlCLENBQUMsWUFBWSxDQUFDLEdBQUcsWUFBWSxtQkFBbUIsRUFBRSxHQUFHLENBQUM7cUJBQ2xFLElBQUksQ0FBQyxVQUFVLFdBQVc7b0JBQ3ZCLE9BQU8sQ0FBQyxHQUFHLENBQUMsV0FBVyxDQUFDLENBQUE7b0JBQ3hCLElBQUksRUFBRSxDQUFBO2dCQUNWLENBQUMsQ0FBQyxDQUFBO1lBQ1YsQ0FBQyxDQUFDLENBQUE7UUFDTixDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==

View File

@ -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()

View File

@ -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'))