本文整理汇总了TypeScript中src/core/server/root.Root类的典型用法代码示例。如果您正苦于以下问题:TypeScript Root类的具体用法?TypeScript Root怎么用?TypeScript Root使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Root类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: startNonCodeNodeKibana
async function startNonCodeNodeKibana() {
const setting = {
server: {
port: nonCodePort,
uuid: nonodeNodeUuid,
},
plugins: { paths: [pluginPaths] },
xpack: {
...xpackOption,
code: { codeNodeUrl: `http://localhost:${codePort}` },
},
};
nonCodeNode = createRootWithCorePlugins(setting);
await nonCodeNode.setup();
await nonCodeNode.start();
}
示例2: async
before: async () => {
await es.start();
rootServer = kbnTestServer.createRootWithCorePlugins({
server: { maxPayloadBytes: 100 },
});
await rootServer.start();
legacyServer = kbnTestServer.getKbnServer(rootServer);
return await legacyServer.plugins.elasticsearch.waitUntilReady();
},
示例3: describe
describe('code in multiple nodes', () => {
const codeNodeUuid = 'c4add484-0cba-4e05-86fe-4baa112d9e53';
const nonodeNodeUuid = '22b75e04-0e50-4647-9643-6b1b1d88beaf';
let codePort: number;
let nonCodePort: number;
let nonCodeNode: Root;
let servers: any;
const pluginPaths = resolve(__dirname, '../../../../../x-pack');
async function startServers() {
servers = await startTestServers({
adjustTimeout: t => {
// @ts-ignore
this.timeout(t);
},
settings: {
kbn: {
server: {
uuid: codeNodeUuid,
port: codePort,
},
plugins: { paths: [pluginPaths] },
xpack: xpackOption,
},
},
});
await getKbnServer(servers.root).server.plugins.elasticsearch.waitUntilReady();
}
async function startNonCodeNodeKibana() {
const setting = {
server: {
port: nonCodePort,
uuid: nonodeNodeUuid,
},
plugins: { paths: [pluginPaths] },
xpack: {
...xpackOption,
code: { codeNodeUrl: `http://localhost:${codePort}` },
},
};
nonCodeNode = createRootWithCorePlugins(setting);
await nonCodeNode.setup();
await nonCodeNode.start();
}
// @ts-ignore
before(async function() {
nonCodePort = await getPort();
codePort = await getPort();
// @ts-ignore
await startServers.bind(this)();
await startNonCodeNodeKibana();
});
// @ts-ignore
after(async function() {
await nonCodeNode.shutdown();
await servers.stop();
});
it('Code node setup should be ok', async () => {
await request.get(servers.root, '/api/code/setup').expect(200);
});
it('Non-code node setup should be ok', async () => {
await request.get(nonCodeNode, '/api/code/setup').expect(200);
});
it('Non-code node setup should fail if code node is shutdown', async () => {
await servers.root.shutdown();
await request.get(nonCodeNode, '/api/code/setup').expect(502);
// TODO restart root clearly is hard to do during platform migration
// A clear way is to createEsCluster individually and not reuse the
// same root
// @ts-ignore
}).timeout(20000);
});
示例4: after
after(async function() {
await nonCodeNode.shutdown();
await servers.stop();
});