Skip to content

Commit

Permalink
Merge branch 'master' into feat/esaggs-args
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Dec 9, 2020
2 parents d4037ed + e8a8f20 commit 35a6923
Show file tree
Hide file tree
Showing 384 changed files with 23,571 additions and 5,289 deletions.
3 changes: 2 additions & 1 deletion .ci/teamcity/checks/doc_api_changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:checkDocApiChanges
checks-reporter-with-killswitch "Check Doc API Changes" \
node scripts/check_published_api_changes
8 changes: 8 additions & 0 deletions .ci/teamcity/checks/eslint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

checks-reporter-with-killswitch "Lint: eslint" \
node scripts/eslint --no-cache
3 changes: 2 additions & 1 deletion .ci/teamcity/checks/file_casing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:checkFileCasing
checks-reporter-with-killswitch "Check File Casing" \
node scripts/check_file_casing --quiet
3 changes: 2 additions & 1 deletion .ci/teamcity/checks/i18n.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:i18nCheck
checks-reporter-with-killswitch "Check i18n" \
node scripts/i18n_check --ignore-missing
3 changes: 2 additions & 1 deletion .ci/teamcity/checks/licenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:licenses
checks-reporter-with-killswitch "Check Licenses" \
node scripts/check_licenses --dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:verifyDependencyVersions
checks-reporter-with-killswitch "Lint: sasslint" \
node scripts/sasslint
3 changes: 2 additions & 1 deletion .ci/teamcity/checks/telemetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:telemetryCheck
checks-reporter-with-killswitch "Check Telemetry Schema" \
node scripts/telemetry_check
3 changes: 2 additions & 1 deletion .ci/teamcity/checks/test_hardening.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:test_hardening
checks-reporter-with-killswitch "Test Hardening" \
node scripts/test_hardening
3 changes: 2 additions & 1 deletion .ci/teamcity/checks/ts_projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:checkTsProjects
checks-reporter-with-killswitch "Check TypeScript Projects" \
node scripts/check_ts_projects
3 changes: 2 additions & 1 deletion .ci/teamcity/checks/type_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:typeCheck
checks-reporter-with-killswitch "Check Types" \
node scripts/type_check
3 changes: 2 additions & 1 deletion .ci/teamcity/checks/verify_notice.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:verifyNotice
checks-reporter-with-killswitch "Verify NOTICE" \
node scripts/notice --validate
12 changes: 12 additions & 0 deletions .ci/teamcity/default/jest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

export JOB=kibana-default-jest

cd "$XPACK_DIR"

checks-reporter-with-killswitch "Jest Unit Tests" \
node scripts/jest --bail --debug
10 changes: 10 additions & 0 deletions .ci/teamcity/oss/api_integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

export JOB=kibana-oss-api-integration

checks-reporter-with-killswitch "API Integration Tests" \
node scripts/functional_tests --config test/api_integration/config.js --bail --debug
10 changes: 10 additions & 0 deletions .ci/teamcity/oss/jest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

export JOB=kibana-oss-jest

checks-reporter-with-killswitch "OSS Jest Unit Tests" \
node scripts/jest --ci --verbose
10 changes: 10 additions & 0 deletions .ci/teamcity/oss/jest_integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

export JOB=kibana-oss-jest-integration

checks-reporter-with-killswitch "OSS Jest Integration Tests" \
node scripts/jest_integration --verbose
6 changes: 3 additions & 3 deletions .ci/teamcity/oss/plugin_functional.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ if [[ ! -d "target" ]]; then
fi
cd -

yarn run grunt run:pluginFunctionalTestsRelease --from=source
yarn run grunt run:exampleFunctionalTestsRelease --from=source
yarn run grunt run:interpreterFunctionalTestsRelease
./test/scripts/test/plugin_functional.sh
./test/scripts/test/example_functional.sh
./test/scripts/test/interpreter_functional.sh
19 changes: 19 additions & 0 deletions .ci/teamcity/oss/server_integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

export JOB=kibana-oss-server-integration
export KIBANA_INSTALL_DIR="$PARENT_DIR/build/kibana-build-oss"

checks-reporter-with-killswitch "Server integration tests" \
node scripts/functional_tests \
--config test/server_integration/http/ssl/config.js \
--config test/server_integration/http/ssl_redirect/config.js \
--config test/server_integration/http/platform/config.ts \
--config test/server_integration/http/ssl_with_p12/config.js \
--config test/server_integration/http/ssl_with_p12_intermediate/config.js \
--bail \
--debug \
--kibana-install-dir $KIBANA_INSTALL_DIR
3 changes: 2 additions & 1 deletion .ci/teamcity/tests/mocha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:mocha
checks-reporter-with-killswitch "Mocha Tests" \
node scripts/mocha
7 changes: 0 additions & 7 deletions .ci/teamcity/tests/test_hardening.sh

This file was deleted.

3 changes: 2 additions & 1 deletion .ci/teamcity/tests/test_projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:test_projects
checks-reporter-with-killswitch "Test Projects" \
yarn kbn run test --exclude kibana --oss --skip-kibana-plugins
4 changes: 2 additions & 2 deletions .teamcity/src/builds/Lint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object Lint : BuildType({
scriptContent =
"""
#!/bin/bash
yarn run grunt run:sasslint
./.ci/teamcity/checks/sasslint.sh
""".trimIndent()
}

Expand All @@ -26,7 +26,7 @@ object Lint : BuildType({
scriptContent =
"""
#!/bin/bash
yarn run grunt run:eslint
./.ci/teamcity/checks/eslint.sh
""".trimIndent()
}
}
Expand Down
4 changes: 2 additions & 2 deletions .teamcity/src/builds/test/ApiServerIntegration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ object ApiServerIntegration : BuildType({
description = "Executes API and Server Integration Tests"

steps {
runbld("API Integration", "yarn run grunt run:apiIntegrationTests")
runbld("Server Integration", "yarn run grunt run:serverIntegrationTests")
runbld("API Integration", "./.ci/teamcity/oss/api_integration.sh")
runbld("Server Integration", "./.ci/teamcity/oss/server_integration.sh")
}

addTestSettings()
Expand Down
2 changes: 1 addition & 1 deletion .teamcity/src/builds/test/Jest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object Jest : BuildType({
kibanaAgent(8)

steps {
runbld("Jest Unit", "yarn run grunt run:test_jest")
runbld("Jest Unit", "./.ci/teamcity/oss/jest.sh")
}

addTestSettings()
Expand Down
2 changes: 1 addition & 1 deletion .teamcity/src/builds/test/JestIntegration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object JestIntegration : BuildType({
description = "Executes Jest Integration Tests"

steps {
runbld("Jest Integration", "yarn run grunt run:test_jest_integration")
runbld("Jest Integration", "./.ci/teamcity/oss/jest_integration.sh")
}

addTestSettings()
Expand Down
2 changes: 1 addition & 1 deletion .teamcity/src/builds/test/QuickTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object QuickTests : BuildType({
kibanaAgent(2)

val testScripts = mapOf(
"Test Hardening" to ".ci/teamcity/tests/test_hardening.sh",
"Test Hardening" to ".ci/teamcity/checkes/test_hardening.sh",
"Test Projects" to ".ci/teamcity/tests/test_projects.sh",
"Mocha Tests" to ".ci/teamcity/tests/mocha.sh"
)
Expand Down
5 changes: 1 addition & 4 deletions .teamcity/src/builds/test/XPackJest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ object XPackJest : BuildType({
kibanaAgent(16)

steps {
runbld("X-Pack Jest Unit", """
cd x-pack
node --max-old-space-size=6144 scripts/jest --ci --verbose --maxWorkers=6
""".trimIndent())
runbld("X-Pack Jest Unit", "./.ci/teamcity/default/jest.sh")
}

addTestSettings()
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"test:jest": "node scripts/jest",
"test:jest_integration": "node scripts/jest_integration",
"test:mocha": "node scripts/mocha",
"test:mocha:coverage": "grunt test:mochaCoverage",
"test:ftr": "node scripts/functional_tests",
"test:ftr:server": "node scripts/functional_tests_server",
"test:ftr:runner": "node scripts/functional_test_runner",
Expand Down Expand Up @@ -674,7 +673,6 @@
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-peg": "^2.0.1",
"grunt-run": "0.8.1",
"gulp": "4.0.2",
"gulp-babel": "^8.0.0",
"gulp-sourcemaps": "2.6.5",
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-spec-to-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"lib": "lib"
},
"scripts": {
"test": "../../node_modules/.bin/jest",
"format": "../../node_modules/.bin/prettier **/*.js --write"
},
"author": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

import Chance from 'chance';

import { getUpgradeableConfigMock } from './get_upgradeable_config.test.mock';
import { SavedObjectsErrorHelpers } from '../../saved_objects';
import { savedObjectsClientMock } from '../../saved_objects/service/saved_objects_client.mock';
import { loggingSystemMock } from '../../logging/logging_system.mock';
import { getUpgradeableConfigMock } from './get_upgradeable_config.test.mock';

import { createOrUpgradeSavedConfig } from './create_or_upgrade_saved_config';

Expand Down
2 changes: 1 addition & 1 deletion src/dev/code_coverage/shell_scripts/extract_archives.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ EXTRACT_DIR=/tmp/extracted_coverage
mkdir -p $EXTRACT_DIR

echo "### Extracting downloaded artifacts"
for x in kibana-intake x-pack-intake kibana-oss-tests kibana-xpack-tests; do
for x in kibana-intake kibana-oss-tests kibana-xpack-tests; do #x-pack-intake skipping due to failures
tar -xzf $DOWNLOAD_DIR/coverage/${x}/kibana-coverage.tar.gz -C $EXTRACT_DIR || echo "### Error 'tarring': ${x}"
done

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TEAM_ASSIGN_PATH=$5
# Build team assignments dat file
node scripts/generate_team_assignments.js --verbose --src .github/CODEOWNERS --dest $TEAM_ASSIGN_PATH

for x in jest functional; do
for x in functional; do #jest skip due to failures
echo "### Ingesting coverage for ${x}"

COVERAGE_SUMMARY_FILE=target/kibana-coverage/${x}-combined/coverage-summary.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ COVERAGE_TEMP_DIR=/tmp/extracted_coverage/target/kibana-coverage/
export COVERAGE_TEMP_DIR

echo "### Merge coverage reports"
for x in jest functional; do
for x in functional; do # jest skip due to failures
yarn nyc report --nycrc-path src/dev/code_coverage/nyc_config/nyc.${x}.config.js
done

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ test('renders empty page in before initial fetch to avoid flickering', () => {
getViewUrl={() => {}}
listingLimit={1000}
hideWriteControls={false}
initialPageSize={10}
core={{ notifications: { toasts: {} }, uiSettings: { get: jest.fn(() => 10) } }}
/>
);
Expand Down
15 changes: 15 additions & 0 deletions src/plugins/data/common/search/search_source/search_source.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,21 @@ describe('SearchSource', () => {
const request = await searchSource.getSearchRequestBody();
expect(request.script_fields).toEqual({ hello: {} });
});

test('returns all scripted fields when one fields entry is *', async () => {
searchSource.setField('index', ({
...indexPattern,
getComputedFields: () => ({
storedFields: [],
scriptFields: { hello: {}, world: {} },
docvalueFields: [],
}),
} as unknown) as IndexPattern);
searchSource.setField('fields', ['timestamp', '*']);

const request = await searchSource.getSearchRequestBody();
expect(request.script_fields).toEqual({ hello: {}, world: {} });
});
});

describe('handling for when specific fields are provided', () => {
Expand Down
19 changes: 13 additions & 6 deletions src/plugins/data/common/search/search_source/search_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,12 @@ export class SearchSource {
case 'query':
return addToRoot(key, (data[key] || []).concat(val));
case 'fields':
// uses new Fields API
// This will pass the passed in parameters to the new fields API.
// Also if will only return scripted fields that are part of the specified
// array of fields. If you specify the wildcard `*` as an array element
// the fields API will return all fields, and all scripted fields will be returned.
// NOTE: While the fields API supports wildcards within names, e.g. `user.*`
// scripted fields won't be considered for this.
return addToBody('fields', val);
case 'fieldsFromSource':
// preserves legacy behavior
Expand Down Expand Up @@ -518,11 +523,13 @@ export class SearchSource {
);
const uniqFieldNames = [...new Set([...bodyFieldNames, ...fieldsFromSource])];

// filter down script_fields to only include items specified
body.script_fields = pick(
body.script_fields,
Object.keys(body.script_fields).filter((f) => uniqFieldNames.includes(f))
);
if (!uniqFieldNames.includes('*')) {
// filter down script_fields to only include items specified
body.script_fields = pick(
body.script_fields,
Object.keys(body.script_fields).filter((f) => uniqFieldNames.includes(f))
);
}

// request the remaining fields from stored_fields just in case, since the
// fields API does not handle stored fields
Expand Down
6 changes: 4 additions & 2 deletions src/plugins/data/server/search/search_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
private readonly searchSourceService = new SearchSourceService();
private defaultSearchStrategyName: string = ES_SEARCH_STRATEGY;
private searchStrategies: StrategyMap = {};
private sessionService: ISessionService;
private coreStart?: CoreStart;
private sessionService: ISessionService = new SessionService();

constructor(
private initializerContext: PluginInitializerContext<ConfigSchema>,
private readonly logger: Logger
) {}
) {
this.sessionService = new SessionService();
}

public setup(
core: CoreSetup<{}, DataPluginStart>,
Expand Down
Loading

0 comments on commit 35a6923

Please sign in to comment.