mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
check legacy service setup before start
This commit is contained in:
parent
62a67242c5
commit
255d3c3abc
3 changed files with 13 additions and 6 deletions
|
@ -36,7 +36,7 @@ Array [
|
|||
"debug": [MockFunction] {
|
||||
"calls": Array [
|
||||
Array [
|
||||
"setting up legacy service",
|
||||
"starting legacy service",
|
||||
],
|
||||
],
|
||||
"results": Array [
|
||||
|
|
|
@ -414,3 +414,9 @@ describe('once LegacyService is set up in `devClusterMaster` mode', () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
test('Cannot start without setup phase', async () => {
|
||||
await expect(legacyService.start(startDeps)).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Legacy service is not setup yet."`
|
||||
);
|
||||
});
|
||||
|
|
|
@ -62,7 +62,11 @@ export class LegacyService implements CoreService {
|
|||
this.setupDeps = setupDeps;
|
||||
}
|
||||
public async start(startDeps: CoreStart) {
|
||||
this.log.debug('setting up legacy service');
|
||||
const { setupDeps } = this;
|
||||
if (!setupDeps) {
|
||||
throw new Error('Legacy service is not setup yet.');
|
||||
}
|
||||
this.log.debug('starting legacy service');
|
||||
|
||||
const update$ = this.coreContext.configService.getConfig$().pipe(
|
||||
tap(config => {
|
||||
|
@ -85,10 +89,7 @@ export class LegacyService implements CoreService {
|
|||
await this.createClusterManager(config);
|
||||
return;
|
||||
}
|
||||
if (!this.setupDeps) {
|
||||
throw new Error('Core setup contract is not defined');
|
||||
}
|
||||
return await this.createKbnServer(config, this.setupDeps, startDeps);
|
||||
return await this.createKbnServer(config, setupDeps, startDeps);
|
||||
})
|
||||
)
|
||||
.toPromise();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue