Log-entry should be a thrown error
Signed-off-by: Gustaf Lundh <gustaf.lundh@axis.com>
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
'@backstage/integration': patch
|
||||
---
|
||||
|
||||
Gerrit: Gitiles auth-links could still be broken
|
||||
Additional fix for Gitiles auth links
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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.',
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user