Skip to content

Commit

Permalink
Merge branch 'master' into vislib-pie-replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jun 3, 2021
2 parents 6facbb5 + 2ea4d57 commit b8355e8
Show file tree
Hide file tree
Showing 218 changed files with 3,381 additions and 2,033 deletions.
8 changes: 3 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@ Delete any items that are not applicable to this PR.

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature release.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how
they may potentially impact the change:
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |
|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. |
| Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. |
| Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. |
| [See more potential risk examples](../RISK_MATRIX.mdx) |
| [See more potential risk examples](https://github.com/elastic/kibana/blob/master/RISK_MATRIX.mdx) |


### For maintainers
Expand Down
9 changes: 7 additions & 2 deletions docs/developer/getting-started/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ In order to support Windows development we currently require you to use one of t

As well as installing https://www.microsoft.com/en-us/download/details.aspx?id=48145[Visual C++ Redistributable for Visual Studio 2015].

In addition we also require you to do the following:

- Install https://www.microsoft.com/en-us/download/details.aspx?id=48145[Visual C++ Redistributable for Visual Studio 2015]
- Enable the https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development[Windows Developer Mode]
- Enable https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/fsutil-8dot3name[8.3 filename support] by running the following command in a windows command prompt with admin rights `fsutil 8dot3name set 0`

Before running the steps listed below, please make sure you have installed everything
that we require and listed above and that you are running the mentioned commands
through Git bash or WSL.
that we require and listed above and that you are running all the commands from now on through Git bash or WSL.

[discrete]
[[get-kibana-code]]
Expand Down
4 changes: 1 addition & 3 deletions docs/setup/install/brew.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ brew tap elastic/tap
-------------------------

Once you've tapped the Elastic Homebrew repo, you can use `brew install` to
install the default distribution of {kib}:
install the **latest version** of {kib}:

[source,sh]
-------------------------
brew install elastic/tap/kibana-full
-------------------------

This installs the most recently released distribution of {kib}.

[[brew-layout]]
==== Directory layout for Homebrew installs

Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-ui-shared-deps/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export const Theme = require('./theme.ts');
export const Lodash = require('lodash');
export const LodashFp = require('lodash/fp');

export const Fflate = require('fflate/esm/browser');
import { unzlibSync, strFromU8 } from 'fflate';
export const Fflate = { unzlibSync, strFromU8 };

// runtime deps which don't need to be copied across all bundles
export const TsLib = require('tslib');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ const setup = () => {
};
};

// FLAKY: https://github.com/elastic/kibana/issues/101126
describe.skip('createStreamingBatchedFunction()', () => {
describe('createStreamingBatchedFunction()', () => {
beforeAll(() => {
jest.useFakeTimers();
});

afterAll(() => {
jest.useRealTimers();
});
test('returns a function', () => {
const { fetchStreaming } = setup();
const fn = createStreamingBatchedFunction({
Expand Down Expand Up @@ -87,8 +93,8 @@ describe.skip('createStreamingBatchedFunction()', () => {
expect(fetchStreaming).toHaveBeenCalledTimes(0);
fn({ baz: 'quix' });
expect(fetchStreaming).toHaveBeenCalledTimes(0);
jest.advanceTimersByTime(6);

await new Promise((r) => setTimeout(r, 6));
expect(fetchStreaming).toHaveBeenCalledTimes(1);
});

Expand All @@ -103,7 +109,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
});

expect(fetchStreaming).toHaveBeenCalledTimes(0);
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);
expect(fetchStreaming).toHaveBeenCalledTimes(0);
});

Expand All @@ -118,7 +124,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
});

fn({ foo: 'bar' });
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

expect(fetchStreaming.mock.calls[0][0]).toMatchObject({
url: '/test',
Expand All @@ -139,7 +145,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
fn({ foo: 'bar' });
fn({ baz: 'quix' });

await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);
const { body } = fetchStreaming.mock.calls[0][0];
expect(JSON.parse(body)).toEqual({
batch: [{ foo: 'bar' }, { baz: 'quix' }],
Expand All @@ -160,13 +166,10 @@ describe.skip('createStreamingBatchedFunction()', () => {

expect(fetchStreaming).toHaveBeenCalledTimes(0);
fn({ foo: 'bar' });
await flushPromises();
expect(fetchStreaming).toHaveBeenCalledTimes(0);
fn({ baz: 'quix' });
await flushPromises();
expect(fetchStreaming).toHaveBeenCalledTimes(0);
fn({ full: 'yep' });
await flushPromises();
expect(fetchStreaming).toHaveBeenCalledTimes(1);
});

Expand All @@ -186,7 +189,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
of(fn({ foo: 'bar' }, abortController.signal));
fn({ baz: 'quix' });

await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);
const { body } = fetchStreaming.mock.calls[0][0];
expect(JSON.parse(body)).toEqual({
batch: [{ baz: 'quix' }],
Expand All @@ -206,7 +209,6 @@ describe.skip('createStreamingBatchedFunction()', () => {
fn({ a: '1' });
fn({ b: '2' });
fn({ c: '3' });
await flushPromises();

expect(fetchStreaming.mock.calls[0][0]).toMatchObject({
url: '/test',
Expand All @@ -231,11 +233,9 @@ describe.skip('createStreamingBatchedFunction()', () => {
fn({ a: '1' });
fn({ b: '2' });
fn({ c: '3' });
await flushPromises();
expect(fetchStreaming).toHaveBeenCalledTimes(1);
fn({ d: '4' });
await flushPromises();
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);
expect(fetchStreaming).toHaveBeenCalledTimes(2);
});
});
Expand All @@ -253,7 +253,7 @@ describe.skip('createStreamingBatchedFunction()', () => {

const promise1 = fn({ a: '1' });
const promise2 = fn({ b: '2' });
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

expect(await isPending(promise1)).toBe(true);
expect(await isPending(promise2)).toBe(true);
Expand All @@ -274,7 +274,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
const promise1 = fn({ a: '1' });
const promise2 = fn({ b: '2' });
const promise3 = fn({ c: '3' });
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

expect(await isPending(promise1)).toBe(true);
expect(await isPending(promise2)).toBe(true);
Expand Down Expand Up @@ -316,7 +316,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
const promise1 = fn({ a: '1' });
const promise2 = fn({ b: '2' });
const promise3 = fn({ c: '3' });
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

stream.next(
JSON.stringify({
Expand Down Expand Up @@ -365,7 +365,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
const promise1 = fn({ a: '1' });
const promise2 = fn({ b: '2' });
const promise3 = fn({ c: '3' });
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

stream.next(
JSON.stringify({
Expand Down Expand Up @@ -405,7 +405,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
});

const promise = fn({ a: '1' });
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

expect(await isPending(promise)).toBe(true);

Expand Down Expand Up @@ -437,7 +437,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
const promise2 = of(fn({ a: '2' }));
const promise3 = of(fn({ a: '3' }));

await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

stream.next(
JSON.stringify({
Expand All @@ -446,7 +446,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
}) + '\n'
);

await new Promise((r) => setTimeout(r, 1));
jest.advanceTimersByTime(1);

stream.next(
JSON.stringify({
Expand All @@ -455,7 +455,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
}) + '\n'
);

await new Promise((r) => setTimeout(r, 1));
jest.advanceTimersByTime(1);

stream.next(
JSON.stringify({
Expand All @@ -464,7 +464,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
}) + '\n'
);

await new Promise((r) => setTimeout(r, 1));
jest.advanceTimersByTime(1);

const [result1] = await promise1;
const [, error2] = await promise2;
Expand All @@ -489,13 +489,14 @@ describe.skip('createStreamingBatchedFunction()', () => {
const abortController = new AbortController();
const promise = fn({ a: '1' }, abortController.signal);
const promise2 = fn({ a: '2' }, abortController.signal);
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

expect(await isPending(promise)).toBe(true);
expect(await isPending(promise2)).toBe(true);

abortController.abort();
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);
await flushPromises();

expect(await isPending(promise)).toBe(false);
expect(await isPending(promise2)).toBe(false);
Expand All @@ -519,12 +520,13 @@ describe.skip('createStreamingBatchedFunction()', () => {
const abortController = new AbortController();
const promise = fn({ a: '1' }, abortController.signal);
const promise2 = fn({ a: '2' });
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

expect(await isPending(promise)).toBe(true);

abortController.abort();
await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);
await flushPromises();

expect(await isPending(promise)).toBe(false);
const [, error] = await of(promise);
Expand All @@ -537,7 +539,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
}) + '\n'
);

await new Promise((r) => setTimeout(r, 1));
jest.advanceTimersByTime(1);

const [result2] = await of(promise2);
expect(result2).toEqual({ b: '2' });
Expand All @@ -558,11 +560,11 @@ describe.skip('createStreamingBatchedFunction()', () => {
const promise1 = of(fn({ a: '1' }));
const promise2 = of(fn({ a: '2' }));

await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

stream.complete();

await new Promise((r) => setTimeout(r, 1));
jest.advanceTimersByTime(1);

const [, error1] = await promise1;
const [, error2] = await promise2;
Expand All @@ -589,7 +591,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
const promise1 = of(fn({ a: '1' }));
const promise2 = of(fn({ a: '2' }));

await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

stream.next(
JSON.stringify({
Expand All @@ -599,7 +601,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
);
stream.complete();

await new Promise((r) => setTimeout(r, 1));
jest.advanceTimersByTime(1);

const [, error1] = await promise1;
const [result1] = await promise2;
Expand Down Expand Up @@ -627,13 +629,13 @@ describe.skip('createStreamingBatchedFunction()', () => {
const promise1 = of(fn({ a: '1' }));
const promise2 = of(fn({ a: '2' }));

await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

stream.error({
message: 'something went wrong',
});

await new Promise((r) => setTimeout(r, 1));
jest.advanceTimersByTime(1);

const [, error1] = await promise1;
const [, error2] = await promise2;
Expand All @@ -660,7 +662,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
const promise1 = of(fn({ a: '1' }));
const promise2 = of(fn({ a: '2' }));

await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

stream.next(
JSON.stringify({
Expand All @@ -670,7 +672,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
);
stream.error('oops');

await new Promise((r) => setTimeout(r, 1));
jest.advanceTimersByTime(1);

const [, error1] = await promise1;
const [result1] = await promise2;
Expand Down Expand Up @@ -698,7 +700,7 @@ describe.skip('createStreamingBatchedFunction()', () => {
const promise1 = of(fn({ a: '1' }));
const promise2 = of(fn({ a: '2' }));

await new Promise((r) => setTimeout(r, 6));
jest.advanceTimersByTime(6);

stream.next(
JSON.stringify({
Expand All @@ -709,7 +711,7 @@ describe.skip('createStreamingBatchedFunction()', () => {

stream.next('Not a JSON\n');

await new Promise((r) => setTimeout(r, 1));
jest.advanceTimersByTime(1);

const [, error1] = await promise1;
const [result1] = await promise2;
Expand Down
Loading

0 comments on commit b8355e8

Please sign in to comment.