techdocs: fix tests by reusing the instantiated discovery
This commit is contained in:
@@ -23,7 +23,6 @@ import { Entity, EntityName } from '@backstage/catalog-model';
|
||||
import {
|
||||
resolvePackagePath,
|
||||
PluginEndpointDiscovery,
|
||||
SingleHostDiscovery,
|
||||
} from '@backstage/backend-common';
|
||||
import { Config } from '@backstage/config';
|
||||
import {
|
||||
@@ -143,10 +142,9 @@ export class LocalPublish implements PublisherBase {
|
||||
}
|
||||
|
||||
async getStorageUrl() {
|
||||
const discoveryApi = SingleHostDiscovery.fromConfig(this.config);
|
||||
return (
|
||||
this.config.getOptionalString('techdocs.storageUrl') ??
|
||||
(await discoveryApi.getBaseUrl('techdocs'))
|
||||
(await this.discovery.getBaseUrl('techdocs'))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,7 @@ import {
|
||||
PublisherBase,
|
||||
getLocationForEntity,
|
||||
} from '@backstage/techdocs-common';
|
||||
import {
|
||||
PluginEndpointDiscovery,
|
||||
SingleHostDiscovery,
|
||||
} from '@backstage/backend-common';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { getEntityNameFromUrlPath } from './helpers';
|
||||
import { DocsBuilder } from '../DocsBuilder';
|
||||
@@ -105,10 +102,9 @@ export async function createRouter({
|
||||
|
||||
router.get('/docs/:namespace/:kind/:name/*', async (req, res) => {
|
||||
const { kind, namespace, name } = req.params;
|
||||
const discoveryApi = SingleHostDiscovery.fromConfig(config);
|
||||
const storageUrl =
|
||||
config.getOptionalString('techdocs.storageUrl') ??
|
||||
`${await discoveryApi.getBaseUrl('techdocs')}/static/docs`;
|
||||
`${await discovery.getBaseUrl('techdocs')}/static/docs`;
|
||||
|
||||
const catalogUrl = await discovery.getBaseUrl('catalog');
|
||||
const triple = [kind, namespace, name].map(encodeURIComponent).join('/');
|
||||
|
||||
Reference in New Issue
Block a user