diff --git a/server.js b/server.js index a55f73dedea0a..40634d2dbd10a 100644 --- a/server.js +++ b/server.js @@ -386,7 +386,7 @@ cache(function(data, match, sendBadge, request) { if (err != null) { log.error('Travis error: ' + err.stack); if (res) { log.error(''+res); } - badgeData.text[1] = 'invalid'; + badgeData.text[1] = 'inaccessible'; sendBadge(format, badgeData); return; } diff --git a/service-tests/README.md b/service-tests/README.md index 9ce64a0d66f2e..ab67bc2013475 100644 --- a/service-tests/README.md +++ b/service-tests/README.md @@ -55,7 +55,7 @@ cache(function(data, match, sendBadge, request) { if (err != null) { console.error('Travis error: ' + err.stack); // 5 if (res) { console.error(''+res); } - badgeData.text[1] = 'invalid'; + badgeData.text[1] = 'inaccessible'; sendBadge(format, badgeData); return; } @@ -271,7 +271,7 @@ network connection errors on any unmocked requests. t.create('connection error') .get('/foo/bar.json') .networkOff() - .expectJSON({ name: 'build', value: 'invalid' }); + .expectJSON({ name: 'build', value: 'inaccessible' }); ``` @@ -338,7 +338,7 @@ t.create('missing content-disposition header') t.create('connection error') .get('/foo/bar.json') .networkOff() - .expectJSON({ name: 'build', value: 'invalid' }); + .expectJSON({ name: 'build', value: 'inaccessible' }); ``` diff --git a/service-tests/travis.js b/service-tests/travis.js index 7152ae845b412..6bb93f2943b09 100644 --- a/service-tests/travis.js +++ b/service-tests/travis.js @@ -4,9 +4,43 @@ const Joi = require('joi'); const ServiceTester = require('./runner/service-tester'); const {isPhpVersionReduction} = require('./helpers/validators'); -const t = new ServiceTester({ id: 'travis', title: 'PHP version from .travis.yml' }); +const t = new ServiceTester({ id: 'travis', title: 'Travis CI/PHP version from .travis.yml' }); module.exports = t; +// Travis CI + +t.create('build status on default branch') + .get('/rust-lang/rust.json') + .expectJSONTypes(Joi.object().keys({ + name: 'build', + value: Joi.equal('failing', 'passing', 'unknown') + })); + +t.create('build status on named branch') + .get('/rust-lang/rust/stable.json') + .expectJSONTypes(Joi.object().keys({ + name: 'build', + value: Joi.equal('failing', 'passing', 'unknown') + })); + +t.create('unknown repo') + .get('/this-repo/does-not-exist.json') + .expectJSON({ name: 'build', value: 'unknown' }); + +t.create('missing content-disposition header') + .get('/foo/bar.json') + .intercept(nock => nock('https://api.travis-ci.org') + .head('/foo/bar.svg') + .reply(200)) + .expectJSON({ name: 'build', value: 'invalid' }); + +t.create('connection error') + .get('/foo/bar.json') + .networkOff() + .expectJSON({ name: 'build', value: 'inaccessible' }); + +// PHP version from .travis.yml + t.create('gets the package version of symfony') .get('/php-v/symfony/symfony.json') .expectJSONTypes(Joi.object().keys({ name: 'PHP', value: isPhpVersionReduction }));