From fc91038652c8ee279fe3adfb74e46a7b1c08d7eb Mon Sep 17 00:00:00 2001 From: Caleb Cartwright Date: Sat, 19 Sep 2020 15:08:23 -0500 Subject: [PATCH] Fix [GitlabPipeline] not found repo service test (#5538) * tests(GitlabPipelineStatus): fix not found service test * docs: describe gitlab innaccessible message Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com> --- services/gitlab/gitlab-pipeline-status.service.js | 3 +++ services/gitlab/gitlab-pipeline-status.tester.js | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/services/gitlab/gitlab-pipeline-status.service.js b/services/gitlab/gitlab-pipeline-status.service.js index 2800341e7e..4e179e6c73 100644 --- a/services/gitlab/gitlab-pipeline-status.service.js +++ b/services/gitlab/gitlab-pipeline-status.service.js @@ -32,6 +32,9 @@ const documentation = `

Your badge should be working fine now.

+

+ NB - The badge will display 'inaccessible' if the specified repo was not found on the target Gitlab instance. +

` class GitlabPipelineStatus extends BaseSvgScrapingService { diff --git a/services/gitlab/gitlab-pipeline-status.tester.js b/services/gitlab/gitlab-pipeline-status.tester.js index 49183c38e1..0ab56554a6 100644 --- a/services/gitlab/gitlab-pipeline-status.tester.js +++ b/services/gitlab/gitlab-pipeline-status.tester.js @@ -20,11 +20,18 @@ t.create('Pipeline status (nonexistent branch)') message: 'branch not found', }) +// Gitlab will redirect users to a sign-in page +// (which we ultimately see as a 503 error) in the event +// a nonexistent, or private, repository is specified. +// Given the additional complexity that would've been required to +// present users with a more traditional and friendly 'Not Found' +// error message, we will simply display inaccessible +// https://github.com/badges/shields/pull/5538 t.create('Pipeline status (nonexistent repo)') .get('/this-repo/does-not-exist/master.json') .expectBadge({ label: 'build', - message: 'repo not found', + message: 'inaccessible', }) t.create('Pipeline status (custom gitlab URL)')