Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions app-config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ catalog:
locations:
- type: file
target: ../../default-catalog/catalog-info.yaml
- type: file
target: ../../examples/entities.yaml
- type: file
target: ../../examples/org.yaml
- type: file
target: ../../examples/all.yaml
- type: file
target: ../../examples/acme-corp.yaml
## Uncomment the following to enable Plausible analytics in development mode
# plausible:
# enabled: true
Expand Down
10 changes: 1 addition & 9 deletions app-config.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ auth:
# See https://backstage.io/docs/auth/github/provider#resolvers for more resolvers.
- resolver: usernameMatchingUserEntityName
catalog:
# Overrides the default list locations from app-config.yaml as these contain example data.
# See https://backstage.io/docs/features/software-catalog/#adding-components-to-the-catalog for more details
# on how to get entities into the catalog.
# Load sample entities, including guest users, groups and templates, from one location.
providers:
github:
default:
Expand All @@ -61,14 +59,8 @@ catalog:
timeout: { minutes: 3 }

locations:
- type: file
target: ../../examples/entities.yaml
- type: file
target: ../../examples/org.yaml
- type: file
target: ../../examples/all.yaml
- type: file
target: ../../examples/acme-corp.yaml

plausible:
enabled: true
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"@types/supertest": "^6.0.2",
"jose": "^5.6.3",
"msw": "^2.3.4",
"supertest": "^7.0.0"
"supertest": "^7.0.0",
"yaml": "^2.2.2"
},
"files": [
"dist"
Expand Down
31 changes: 31 additions & 0 deletions packages/backend/src/catalogLocations.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { readFileSync, statSync } from 'node:fs';
import { resolve } from 'node:path';
import { ConfigReader } from '@backstage/config';
import { parse } from 'yaml';

const backendDirectory = resolve(__dirname, '..');
const repositoryDirectory = resolve(backendDirectory, '../..');

describe.each(['app-config.example.yaml', 'app-config.production.yaml'])(
'%s catalog locations',
configFile => {
const config = new ConfigReader(
parse(readFileSync(resolve(repositoryDirectory, configFile), 'utf8')),
);
const fileLocations = config
.getConfigArray('catalog.locations')
.filter(location => location.getString('type') === 'file')
.map(location => location.getString('target'));

it('loads the aggregate sample catalog', () => {
expect(fileLocations).toContain('../../examples/all.yaml');
});

it.each(fileLocations)('can read the file location %s', target => {
// Backstage resolves file locations from the backend package directory.
const locationPath = resolve(backendDirectory, target);
expect(statSync(locationPath).isFile()).toBe(true);
expect(readFileSync(locationPath, 'utf8').trim()).not.toBe('');
});
},
);
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16701,6 +16701,7 @@ __metadata:
pg: "npm:^8.11.3"
supertest: "npm:^7.0.0"
winston: "npm:^3.2.1"
yaml: "npm:^2.2.2"
languageName: unknown
linkType: soft

Expand Down
Loading