Log-entry should be a thrown error

Signed-off-by: Gustaf Lundh <gustaf.lundh@axis.com>
This commit is contained in:
Gustaf Lundh
2023-08-22 12:57:37 +02:00
parent b26c173fab
commit 9726f3f0b8
3 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/integration': patch
---
Gerrit: Gitiles auth-links could still be broken
Additional fix for Gitiles auth links
+11 -1
View File
@@ -90,12 +90,22 @@ describe('gerrit core', () => {
'https://gerrit.com/gerrit/a/plugins/gitiles/repo/+archive/refs/heads/dev/docs.tar.gz',
);
});
it('can create an authenticated url when auth is enabled and an url-path + slash is used', () => {
it('Cannot build an authenticated url when a dedicated Gitiles server is used', () => {
const authConfig = {
...configWithDedicatedGitiles,
username: 'username',
password: 'password',
};
expect(() =>
buildGerritGitilesArchiveUrl(authConfig, 'repo', 'dev', 'docs'),
).toThrow(
'Since the baseUrl (Gerrit) is not part of the gitilesBaseUrl, an authentication URL could not be constructed.',
);
});
it('Build a non-authenticated url when a dedicated Gitiles server is used', () => {
const authConfig = {
...configWithDedicatedGitiles,
};
expect(
buildGerritGitilesArchiveUrl(authConfig, 'repo', 'dev', 'docs'),
).toEqual(
+1 -3
View File
@@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { logger } from '@azure/identity';
import { trimStart } from 'lodash';
import { GerritIntegrationConfig } from './config';
@@ -169,7 +167,7 @@ export function getGitilesAuthenticationUrl(
);
}
if (config.password) {
logger.warning(
throw new Error(
'Since the baseUrl (Gerrit) is not part of the gitilesBaseUrl, an authentication URL could not be constructed.',
);
}