本文整理匯總了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();
});