Skip to content

Commit

Permalink
Merge branch '7.16' into backport/7.16/pr-117124
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Nov 9, 2021
2 parents 7d8be69 + a3dd583 commit 2be79de
Show file tree
Hide file tree
Showing 130 changed files with 1,807 additions and 962 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"@elastic/apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace",
"@elastic/apm-rum": "^5.9.1",
"@elastic/apm-rum-react": "^1.3.1",
"@elastic/charts": "38.0.2",
"@elastic/charts": "38.0.3",
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^7.16.0-canary.7",
"@elastic/ems-client": "7.16.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export async function cleanWriteTargets({
index: targets,
allow_no_indices: true,
conflicts: 'proceed',
refresh: true,
body: {
query: {
match_all: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,33 @@ export class FunctionalTestRunner {
// replace the function of custom service providers so that they return
// promise-like objects which never resolve, essentially disabling them
// allowing us to load the test files and populate the mocha suites
const readStubbedProviderSpec = (type: string, providers: any) =>
const readStubbedProviderSpec = (type: string, providers: any, skip: string[]) =>
readProviderSpec(type, providers).map((p) => ({
...p,
fn: () => ({
then: () => {},
}),
fn: skip.includes(p.name)
? (...args: unknown[]) => {
const result = p.fn(...args);
if ('then' in result) {
throw new Error(
`Provider [${p.name}] returns a promise so it can't loaded during test analysis`
);
}

return result;
}
: () => ({
then: () => {},
}),
}));

const providers = new ProviderCollection(this.log, [
...coreProviders,
...readStubbedProviderSpec('Service', config.get('services')),
...readStubbedProviderSpec('PageObject', config.get('pageObjects')),
...readStubbedProviderSpec(
'Service',
config.get('services'),
config.get('servicesRequiredForTestAnalysis')
),
...readStubbedProviderSpec('PageObject', config.get('pageObjects'), []),
]);

const mocha = await setupMocha(this.lifecycle, this.log, config, providers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const schema = Joi.object()
})
.default(),

servicesRequiredForTestAnalysis: Joi.array().items(Joi.string()).default([]),
services: Joi.object().pattern(ID_PATTERN, Joi.func().required()).default(),

pageObjects: Joi.object().pattern(ID_PATTERN, Joi.func().required()).default(),
Expand Down
2 changes: 1 addition & 1 deletion scripts/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/

require('../src/setup_node_env');
require('../src/docs/cli');
require('../src/dev/run_build_docs_cli').runBuildDocsCli();
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ export const cloneIndex = ({
// If the cluster state was updated and all shards ackd we're done
return TaskEither.right(res);
} else {
// Otherwise, wait until the target index has a 'green' status.
// Otherwise, wait until the target index has a 'yellow' status.
return pipe(
waitForIndexStatusYellow({ client, index: target, timeout }),
TaskEither.map((value) => {
/** When the index status is 'green' we know that all shards were started */
/** When the index status is 'yellow' we know that all shards were started */
return { acknowledged: true, shardsAcknowledged: true };
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,15 @@ describe('migration actions', () => {
timeout: '0s',
})();

await expect(cloneIndexPromise).resolves.toMatchObject({
_tag: 'Left',
left: {
error: expect.any(ResponseError),
message: expect.stringMatching(/\"timed_out\":true/),
type: 'retryable_es_client_error',
},
});
await expect(cloneIndexPromise).resolves.toMatchInlineSnapshot(`
Object {
"_tag": "Left",
"left": Object {
"message": "Timeout waiting for the status of the [clone_red_index] index to become 'yellow'",
"type": "retryable_es_client_error",
},
}
`);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,20 @@ export const waitForIndexStatusYellow =
}: WaitForIndexStatusYellowParams): TaskEither.TaskEither<RetryableEsClientError, {}> =>
() => {
return client.cluster
.health({ index, wait_for_status: 'yellow', timeout })
.then(() => {
.health({
index,
wait_for_status: 'yellow',
timeout,
// @ts-expect-error
return_200_for_cluster_health_timeout: true, // opt-in to the 8.0 breaking behaviour to prevent a deprecation log
})
.then((res) => {
if (res.body.timed_out === true) {
return Either.left({
type: 'retryable_es_client_error' as const,
message: `Timeout waiting for the status of the [${index}] index to become 'yellow'`,
});
}
return Either.right({});
})
.catch(catchRetryableEsClientErrors);
Expand Down
64 changes: 64 additions & 0 deletions src/dev/run_build_docs_cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import Path from 'path';

import dedent from 'dedent';
import { run, REPO_ROOT, createFailError } from '@kbn/dev-utils';

const DEFAULT_DOC_REPO_PATH = Path.resolve(REPO_ROOT, '..', 'docs');

const rel = (path: string) => Path.relative(process.cwd(), path);

export function runBuildDocsCli() {
run(
async ({ flags, procRunner }) => {
const docRepoPath =
typeof flags.docrepo === 'string' && flags.docrepo
? Path.resolve(process.cwd(), flags.docrepo)
: DEFAULT_DOC_REPO_PATH;

try {
await procRunner.run('build_docs', {
cmd: rel(Path.resolve(docRepoPath, 'build_docs')),
args: [
['--doc', rel(Path.resolve(REPO_ROOT, 'docs/index.asciidoc'))],
['--chunk', '1'],
flags.open ? ['--open'] : [],
].flat(),
cwd: REPO_ROOT,
wait: true,
});
} catch (error) {
if (error.code === 'ENOENT') {
throw createFailError(dedent`
Unable to run "build_docs" script from docs repo.
Does it exist at [${rel(docRepoPath)}]?
Do you need to pass --docrepo to specify the correct path or clone it there?
`);
}

throw error;
}
},
{
description: 'Build the docs and serve them from a docker container',
flags: {
string: ['docrepo'],
boolean: ['open'],
default: {
docrepo: DEFAULT_DOC_REPO_PATH,
},
help: `
--docrepo [path] Path to the doc repo, defaults to ${rel(DEFAULT_DOC_REPO_PATH)}
--open Automatically open the built docs in your default browser after building
`,
},
}
);
}
30 changes: 0 additions & 30 deletions src/docs/cli.js

This file was deleted.

28 changes: 0 additions & 28 deletions src/docs/docs_repo.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/plugins/ui_actions/README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,3 @@ action to execute.

https://github.com/elastic/kibana/blob/main/examples/ui_action_examples/README.md[ui_action examples]

=== API Docs

==== Server API
https://github.com/elastic/kibana/blob/main/docs/development/plugins/ui_actions/server/kibana-plugin-plugins-ui_actions-server.uiactionssetup.md[Browser Setup contract]
https://github.com/elastic/kibana/blob/main/docs/development/plugins/ui_actions/server/kibana-plugin-plugins-ui_actions-server.uiactionsstart.md[Browser Start contract]

==== Browser API
https://github.com/elastic/kibana/blob/main/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionssetup.md[Browser Setup contract]
https://github.com/elastic/kibana/blob/main/docs/development/plugins/ui_actions/public/kibana-plugin-plugins-ui_actions-public.uiactionsstart.md[Browser Start contract]

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React from 'react';
import { EuiLoadingChart } from '@elastic/eui';

export const TimeseriesLoading = () => (
<div className="visChart__spinner">
<EuiLoadingChart mono size="l" />
</div>
);
Loading

0 comments on commit 2be79de

Please sign in to comment.