plugins,packages: replace usages of ConfigReader.from
This commit is contained in:
@@ -20,12 +20,9 @@ import { ConfigClusterLocator } from './ConfigClusterLocator';
|
||||
|
||||
describe('ConfigClusterLocator', () => {
|
||||
it('empty clusters returns empty cluster details', async () => {
|
||||
const config: Config = new ConfigReader(
|
||||
{
|
||||
clusters: [],
|
||||
},
|
||||
'ctx',
|
||||
);
|
||||
const config: Config = new ConfigReader({
|
||||
clusters: [],
|
||||
});
|
||||
|
||||
const sut = ConfigClusterLocator.fromConfig(
|
||||
config.getConfigArray('clusters'),
|
||||
@@ -37,18 +34,15 @@ describe('ConfigClusterLocator', () => {
|
||||
});
|
||||
|
||||
it('one clusters returns one cluster details', async () => {
|
||||
const config: Config = new ConfigReader(
|
||||
{
|
||||
clusters: [
|
||||
{
|
||||
name: 'cluster1',
|
||||
url: 'http://localhost:8080',
|
||||
authProvider: 'serviceAccount',
|
||||
},
|
||||
],
|
||||
},
|
||||
'ctx',
|
||||
);
|
||||
const config: Config = new ConfigReader({
|
||||
clusters: [
|
||||
{
|
||||
name: 'cluster1',
|
||||
url: 'http://localhost:8080',
|
||||
authProvider: 'serviceAccount',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const sut = ConfigClusterLocator.fromConfig(
|
||||
config.getConfigArray('clusters'),
|
||||
@@ -67,24 +61,21 @@ describe('ConfigClusterLocator', () => {
|
||||
});
|
||||
|
||||
it('two clusters returns two cluster details', async () => {
|
||||
const config: Config = new ConfigReader(
|
||||
{
|
||||
clusters: [
|
||||
{
|
||||
name: 'cluster1',
|
||||
serviceAccountToken: 'token',
|
||||
url: 'http://localhost:8080',
|
||||
authProvider: 'serviceAccount',
|
||||
},
|
||||
{
|
||||
name: 'cluster2',
|
||||
url: 'http://localhost:8081',
|
||||
authProvider: 'google',
|
||||
},
|
||||
],
|
||||
},
|
||||
'ctx',
|
||||
);
|
||||
const config: Config = new ConfigReader({
|
||||
clusters: [
|
||||
{
|
||||
name: 'cluster1',
|
||||
serviceAccountToken: 'token',
|
||||
url: 'http://localhost:8080',
|
||||
authProvider: 'serviceAccount',
|
||||
},
|
||||
{
|
||||
name: 'cluster2',
|
||||
url: 'http://localhost:8081',
|
||||
authProvider: 'google',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const sut = ConfigClusterLocator.fromConfig(
|
||||
config.getConfigArray('clusters'),
|
||||
|
||||
@@ -60,7 +60,7 @@ describe('getCombinedClusterDetails', () => {
|
||||
|
||||
it('throws an error when using an unsupported cluster locator', async () => {
|
||||
await expect(
|
||||
getCombinedClusterDetails(['magic' as any], new ConfigReader({}, 'ctx')),
|
||||
getCombinedClusterDetails(['magic' as any], new ConfigReader({})),
|
||||
).rejects.toStrictEqual(
|
||||
new Error('Unsupported kubernetes.clusterLocatorMethods: "magic"'),
|
||||
);
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function createStandaloneApplication(
|
||||
options: ApplicationOptions,
|
||||
): Promise<express.Application> {
|
||||
const { enableCors, logger } = options;
|
||||
const config = ConfigReader.fromConfigs([]);
|
||||
const config = new ConfigReader({});
|
||||
const app = express();
|
||||
|
||||
app.use(helmet());
|
||||
|
||||
Reference in New Issue
Block a user