Merge pull request #21892 from jamieklassen/unsupported-servicelocator-message
fix error message for unsupported serviceLocator
This commit is contained in:
@@ -206,6 +206,7 @@ describe('KubernetesBuilder', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('post /services/:serviceId', () => {
|
||||
it('happy path: lists kubernetes objects without auth in request body', async () => {
|
||||
const response = await request(app).post(
|
||||
@@ -780,4 +781,24 @@ metadata:
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('fails when an unsupported serviceLocator type is specified', () => {
|
||||
return expect(() =>
|
||||
startTestBackend({
|
||||
features: [
|
||||
mockServices.rootConfig.factory({
|
||||
data: {
|
||||
kubernetes: {
|
||||
serviceLocatorMethod: { type: 'unsupported' },
|
||||
clusterLocatorMethods: [{ type: 'config', clusters: [] }],
|
||||
},
|
||||
},
|
||||
}),
|
||||
import('@backstage/plugin-kubernetes-backend/alpha'),
|
||||
],
|
||||
}),
|
||||
).rejects.toThrow(
|
||||
'Unsupported kubernetes.serviceLocatorMethod "unsupported"',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -288,7 +288,7 @@ export class KubernetesBuilder {
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
`Unsupported kubernetes.clusterLocatorMethod "${method}"`,
|
||||
`Unsupported kubernetes.serviceLocatorMethod "${method}"`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user