Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into 2019-11-25-ru…
Browse files Browse the repository at this point in the history
…n-demos-shortcuts
  • Loading branch information
stacey-gammon committed Dec 4, 2019
2 parents f3c54d4 + 085a2af commit f0b78de
Show file tree
Hide file tree
Showing 192 changed files with 4,882 additions and 3,706 deletions.
76 changes: 39 additions & 37 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,45 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
timeout(time: 120, unit: 'MINUTES') {
timestamps {
ansiColor('xterm') {
catchError {
parallel([
'kibana-intake-agent': kibanaPipeline.legacyJobRunner('kibana-intake'),
'x-pack-intake-agent': kibanaPipeline.legacyJobRunner('x-pack-intake'),
'kibana-oss-agent': kibanaPipeline.withWorkers('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
'oss-firefoxSmoke': kibanaPipeline.getPostBuildWorker('firefoxSmoke', { runbld('./test/scripts/jenkins_firefox_smoke.sh', 'Execute kibana-firefoxSmoke') }),
'oss-ciGroup1': kibanaPipeline.getOssCiGroupWorker(1),
'oss-ciGroup2': kibanaPipeline.getOssCiGroupWorker(2),
'oss-ciGroup3': kibanaPipeline.getOssCiGroupWorker(3),
'oss-ciGroup4': kibanaPipeline.getOssCiGroupWorker(4),
'oss-ciGroup5': kibanaPipeline.getOssCiGroupWorker(5),
'oss-ciGroup6': kibanaPipeline.getOssCiGroupWorker(6),
'oss-ciGroup7': kibanaPipeline.getOssCiGroupWorker(7),
'oss-ciGroup8': kibanaPipeline.getOssCiGroupWorker(8),
'oss-ciGroup9': kibanaPipeline.getOssCiGroupWorker(9),
'oss-ciGroup10': kibanaPipeline.getOssCiGroupWorker(10),
'oss-ciGroup11': kibanaPipeline.getOssCiGroupWorker(11),
'oss-ciGroup12': kibanaPipeline.getOssCiGroupWorker(12),
'oss-accessibility': kibanaPipeline.getPostBuildWorker('accessibility', { runbld('./test/scripts/jenkins_accessibility.sh', 'Execute kibana-accessibility') }),
// 'oss-visualRegression': kibanaPipeline.getPostBuildWorker('visualRegression', { runbld('./test/scripts/jenkins_visual_regression.sh', 'Execute kibana-visualRegression') }),
]),
'kibana-xpack-agent': kibanaPipeline.withWorkers('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
'xpack-firefoxSmoke': kibanaPipeline.getPostBuildWorker('xpack-firefoxSmoke', { runbld('./test/scripts/jenkins_xpack_firefox_smoke.sh', 'Execute xpack-firefoxSmoke') }),
'xpack-ciGroup1': kibanaPipeline.getXpackCiGroupWorker(1),
'xpack-ciGroup2': kibanaPipeline.getXpackCiGroupWorker(2),
'xpack-ciGroup3': kibanaPipeline.getXpackCiGroupWorker(3),
'xpack-ciGroup4': kibanaPipeline.getXpackCiGroupWorker(4),
'xpack-ciGroup5': kibanaPipeline.getXpackCiGroupWorker(5),
'xpack-ciGroup6': kibanaPipeline.getXpackCiGroupWorker(6),
'xpack-ciGroup7': kibanaPipeline.getXpackCiGroupWorker(7),
'xpack-ciGroup8': kibanaPipeline.getXpackCiGroupWorker(8),
'xpack-ciGroup9': kibanaPipeline.getXpackCiGroupWorker(9),
'xpack-ciGroup10': kibanaPipeline.getXpackCiGroupWorker(10),
'xpack-accessibility': kibanaPipeline.getPostBuildWorker('xpack-accessibility', { runbld('./test/scripts/jenkins_xpack_accessibility.sh', 'Execute xpack-accessibility') }),
// 'xpack-visualRegression': kibanaPipeline.getPostBuildWorker('xpack-visualRegression', { runbld('./test/scripts/jenkins_xpack_visual_regression.sh', 'Execute xpack-visualRegression') }),
]),
])
githubPr.withDefaultPrComments {
catchError {
parallel([
'kibana-intake-agent': kibanaPipeline.legacyJobRunner('kibana-intake'),
'x-pack-intake-agent': kibanaPipeline.legacyJobRunner('x-pack-intake'),
'kibana-oss-agent': kibanaPipeline.withWorkers('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
'oss-firefoxSmoke': kibanaPipeline.getPostBuildWorker('firefoxSmoke', { runbld('./test/scripts/jenkins_firefox_smoke.sh', 'Execute kibana-firefoxSmoke') }),
'oss-ciGroup1': kibanaPipeline.getOssCiGroupWorker(1),
'oss-ciGroup2': kibanaPipeline.getOssCiGroupWorker(2),
'oss-ciGroup3': kibanaPipeline.getOssCiGroupWorker(3),
'oss-ciGroup4': kibanaPipeline.getOssCiGroupWorker(4),
'oss-ciGroup5': kibanaPipeline.getOssCiGroupWorker(5),
'oss-ciGroup6': kibanaPipeline.getOssCiGroupWorker(6),
'oss-ciGroup7': kibanaPipeline.getOssCiGroupWorker(7),
'oss-ciGroup8': kibanaPipeline.getOssCiGroupWorker(8),
'oss-ciGroup9': kibanaPipeline.getOssCiGroupWorker(9),
'oss-ciGroup10': kibanaPipeline.getOssCiGroupWorker(10),
'oss-ciGroup11': kibanaPipeline.getOssCiGroupWorker(11),
'oss-ciGroup12': kibanaPipeline.getOssCiGroupWorker(12),
'oss-accessibility': kibanaPipeline.getPostBuildWorker('accessibility', { runbld('./test/scripts/jenkins_accessibility.sh', 'Execute kibana-accessibility') }),
// 'oss-visualRegression': kibanaPipeline.getPostBuildWorker('visualRegression', { runbld('./test/scripts/jenkins_visual_regression.sh', 'Execute kibana-visualRegression') }),
]),
'kibana-xpack-agent': kibanaPipeline.withWorkers('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
'xpack-firefoxSmoke': kibanaPipeline.getPostBuildWorker('xpack-firefoxSmoke', { runbld('./test/scripts/jenkins_xpack_firefox_smoke.sh', 'Execute xpack-firefoxSmoke') }),
'xpack-ciGroup1': kibanaPipeline.getXpackCiGroupWorker(1),
'xpack-ciGroup2': kibanaPipeline.getXpackCiGroupWorker(2),
'xpack-ciGroup3': kibanaPipeline.getXpackCiGroupWorker(3),
'xpack-ciGroup4': kibanaPipeline.getXpackCiGroupWorker(4),
'xpack-ciGroup5': kibanaPipeline.getXpackCiGroupWorker(5),
'xpack-ciGroup6': kibanaPipeline.getXpackCiGroupWorker(6),
'xpack-ciGroup7': kibanaPipeline.getXpackCiGroupWorker(7),
'xpack-ciGroup8': kibanaPipeline.getXpackCiGroupWorker(8),
'xpack-ciGroup9': kibanaPipeline.getXpackCiGroupWorker(9),
'xpack-ciGroup10': kibanaPipeline.getXpackCiGroupWorker(10),
'xpack-accessibility': kibanaPipeline.getPostBuildWorker('xpack-accessibility', { runbld('./test/scripts/jenkins_xpack_accessibility.sh', 'Execute xpack-accessibility') }),
// 'xpack-visualRegression': kibanaPipeline.getPostBuildWorker('xpack-visualRegression', { runbld('./test/scripts/jenkins_xpack_visual_regression.sh', 'Execute xpack-visualRegression') }),
]),
])
}
}
kibanaPipeline.sendMail()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

## SavedObjectsRepository class


<b>Signature:</b>

```typescript
Expand All @@ -25,7 +26,3 @@ export declare class SavedObjectsRepository
| [incrementCounter(type, id, counterFieldName, options)](./kibana-plugin-server.savedobjectsrepository.incrementcounter.md) | | Increases a counter field by one. Creates the document if one doesn't exist for the given id. |
| [update(type, id, attributes, options)](./kibana-plugin-server.savedobjectsrepository.update.md) | | Updates an object |

## Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SavedObjectsRepository` class.

Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,13 @@ Wait timed out after 10055ms
</system-out>
<skipped/>
</testcase>
<testcase name="machine learning anomaly detection saved search with lucene query job creation opens the advanced section" classname="Firefox XPack UI Functional Tests.x-pack/test/functional/apps/machine_learning/anomaly_detection/saved_search_job·ts" time="6.040">
<system-out><![CDATA[[00:21:57] └-: machine learning...]]></system-out>
<failure><![CDATA[{ NoSuchSessionError: Tried to run command without establishing a connection
at Object.throwDecodedError (/dev/shm/workspace/kibana/node_modules/selenium-webdriver/lib/error.js:550:15)
at parseHttpResponse (/dev/shm/workspace/kibana/node_modules/selenium-webdriver/lib/http.js:563:13)
at Executor.execute (/dev/shm/workspace/kibana/node_modules/selenium-webdriver/lib/http.js:489:26)
at process._tickCallback (internal/process/next_tick.js:68:7) name: 'NoSuchSessionError', remoteStacktrace: '' }]]></failure>
</testcase>
</testsuite>
</testsuites>
3 changes: 2 additions & 1 deletion packages/kbn-test/src/failed_tests_reporter/get_failures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ const getFailureText = (failure: NonNullable<TestCase['failure']>) => {

const isLikelyIrrelevant = ({ name, failure }: TestFailure) => {
if (
failure.includes('NoSuchSessionError: This driver instance does not have a valid session ID')
failure.includes('NoSuchSessionError: This driver instance does not have a valid session ID') ||
failure.includes('NoSuchSessionError: Tried to run command without establishing a connection')
) {
return true;
}
Expand Down
5 changes: 2 additions & 3 deletions src/core/server/saved_objects/saved_objects_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ import { migrationsRetryCallCluster } from '../elasticsearch/retry_call_cluster'
import { SavedObjectsConfigType } from './saved_objects_config';
import { KibanaRequest } from '../http';
import { SavedObjectsClientContract } from './types';
import { ISavedObjectsRepository } from './service/lib/repository';
import { ISavedObjectsRepository, SavedObjectsRepository } from './service/lib/repository';
import {
SavedObjectsClientFactory,
SavedObjectsClientWrapperFactory,
} from './service/lib/scoped_client_provider';
import { createRepository } from './service/lib/create_repository';
import { Logger } from '..';

/**
Expand Down Expand Up @@ -237,7 +236,7 @@ export class SavedObjectsService
}));

const createSORepository = (callCluster: APICaller, extraTypes: string[] = []) => {
return createRepository(
return SavedObjectsRepository.createRepository(
migrator,
savedObjectSchemas,
setupDeps.legacyPlugins.pluginExtendedConfig,
Expand Down
61 changes: 0 additions & 61 deletions src/core/server/saved_objects/service/lib/create_repository.ts

This file was deleted.

6 changes: 1 addition & 5 deletions src/core/server/saved_objects/service/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
* under the License.
*/

export {
ISavedObjectsRepository,
SavedObjectsRepository,
SavedObjectsRepositoryOptions,
} from './repository';
export { ISavedObjectsRepository, SavedObjectsRepository } from './repository';

export {
SavedObjectsClientWrapperFactory,
Expand Down
47 changes: 45 additions & 2 deletions src/core/server/saved_objects/service/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { omit } from 'lodash';
import { retryCallCluster } from '../../../elasticsearch/retry_call_cluster';
import { APICaller } from '../../../elasticsearch/';

import { getRootPropertiesObjects, IndexMapping } from '../../mappings';
Expand Down Expand Up @@ -124,8 +125,50 @@ export class SavedObjectsRepository {
private _unwrappedCallCluster: APICaller;
private _serializer: SavedObjectsSerializer;

/** @internal */
constructor(options: SavedObjectsRepositoryOptions) {
/**
* A factory function for creating SavedObjectRepository instances.
*
* @internalRemarks
* Tests are located in ./repository_create_repository.test.ts
*
* @internal
*/
public static createRepository(
migrator: KibanaMigrator,
schema: SavedObjectsSchema,
config: LegacyConfig,
indexName: string,
callCluster: APICaller,
extraTypes: string[] = [],
injectedConstructor: any = SavedObjectsRepository
) {
const mappings = migrator.getActiveMappings();
const allTypes = Object.keys(getRootPropertiesObjects(mappings));
const serializer = new SavedObjectsSerializer(schema);
const visibleTypes = allTypes.filter(type => !schema.isHiddenType(type));

const missingTypeMappings = extraTypes.filter(type => !allTypes.includes(type));
if (missingTypeMappings.length > 0) {
throw new Error(
`Missing mappings for saved objects types: '${missingTypeMappings.join(', ')}'`
);
}

const allowedTypes = [...new Set(visibleTypes.concat(extraTypes))];

return new injectedConstructor({
index: indexName,
config,
migrator,
mappings,
schema,
serializer,
allowedTypes,
callCluster: retryCallCluster(callCluster),
});
}

private constructor(options: SavedObjectsRepositoryOptions) {
const {
index,
config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ import { SavedObjectsRepository } from './repository';
import { mockKibanaMigrator } from '../../migrations/kibana/kibana_migrator.mock';
import { SavedObjectsSchema } from '../../schema';
import { KibanaMigrator } from '../../migrations';
import { createRepository } from './create_repository';
import { LegacyConfig } from '../../../legacy/config';
jest.mock('./repository');

describe('#createRepository', () => {
const { SavedObjectsRepository: originalRepository } = jest.requireActual('./repository');

describe('SavedObjectsRepository#createRepository', () => {
const callAdminCluster = jest.fn();
const schema = new SavedObjectsSchema({
nsAgnosticType: { isNamespaceAgnostic: true },
Expand Down Expand Up @@ -64,7 +65,7 @@ describe('#createRepository', () => {

it('should not allow a repository with an undefined type', () => {
try {
createRepository(
originalRepository.createRepository(
(migrator as unknown) as KibanaMigrator,
schema,
{} as LegacyConfig,
Expand All @@ -80,12 +81,14 @@ describe('#createRepository', () => {
});

it('should create a repository without hidden types', () => {
const repository = createRepository(
const repository = originalRepository.createRepository(
(migrator as unknown) as KibanaMigrator,
schema,
{} as LegacyConfig,
'.kibana-test',
callAdminCluster
callAdminCluster,
[],
SavedObjectsRepository
);
expect(repository).toBeDefined();
expect(RepositoryConstructor.mock.calls[0][0].allowedTypes).toMatchInlineSnapshot(`
Expand All @@ -98,13 +101,14 @@ describe('#createRepository', () => {
});

it('should create a repository with a unique list of hidden types', () => {
const repository = createRepository(
const repository = originalRepository.createRepository(
(migrator as unknown) as KibanaMigrator,
schema,
{} as LegacyConfig,
'.kibana-test',
callAdminCluster,
['hiddenType', 'hiddenType', 'hiddenType']
['hiddenType', 'hiddenType', 'hiddenType'],
SavedObjectsRepository
);
expect(repository).toBeDefined();
expect(RepositoryConstructor.mock.calls[0][0].allowedTypes).toMatchInlineSnapshot(`
Expand Down
Loading

0 comments on commit f0b78de

Please sign in to comment.