Commit graph

29 commits

Author SHA1 Message Date
spalger b294626153 Revert "[6.7] Fix esArchiver timeout (#31322) (#31344)"
This reverts commit bc5e1a81e5.
2019-02-17 03:39:41 -08:00
Spencer bc5e1a81e5
[6.7] Fix esArchiver timeout (#31322) (#31344)
Backports the following commits to 6.7:
 - Fix esArchiver timeout  (#31322)
2019-02-15 20:05:00 -08:00
Chris Davies 91fa01a173
[6.7] Allow for compatibility with ES 7.x (#30636)
Make Kibana 6.7 compatible with 7.0, at least enough to unblock manual testing.
2019-02-12 14:29:16 -05:00
Spencer 2464f73b26
[esArchiver/unload/kibana] delete all object but the default space (#27412) (#27641)
* [esArchiver/unload/kibana] delete all object but the default space

* [esArchiver/unload/kibanaIndex] run delete_by_query through .kibana alias
2019-01-14 12:43:10 -08:00
Tim Sullivan 7bbda9b867
Core task manager (#24356) (#28052)
* Core task manager (#23555)

* Initial stab at core task manager logic

* Update task_manager readme

* Update task manager readme

* Add cancelable helper package, OSS, and general purpose, but
will be useful for writing cancelable x-pack tasks.

* Make the cancellable package promise-compliant

* Update task manager readme w/ reference to cancellable

* Change pool from lazy to eager, add support for sub-pools per task type.

* Move cancellable to task_manager, and typescriptify it.

* Working proof of concept for task manager. Still have lots to do:
clean up, tests, comments, validations, assertions, etc.

* Add pagination support to task manager fetch

* Move task manager to OSS

* Remove task manager reference from x-pack

* Make task_manager a valid core plugin

* Modify how task resource allocation works

* Remove the special case 'max' workers occupied value

* Remove x-pack package.json changes

* Make taskDefinitions a part of uiExports

* Make task docs saved-object compliant.

* Add kbnServer to the task context.

* Allow tasks to have a void / undefined return type

* revert x-pack change

* move cancellable to src/utils

* move to src/server

* use afterPluginsInit hook

* task_manager.ts rename

* add a wrapper with a setClient method

* Add tests for task runner

* Break task_pool into smaller, testable pieces

* return raw task doc fields for calling code

* remove todo comment

* helper module for default client
 - setClient takes a callback fn

* fix misidentified field name

* fix rest args warning

* flatten task_pool

* remove cancellable

* return raw task doc fields for calling code

* remove todo comment

* helper module for default client
 - setClient takes a callback fn

* fix rest args warning

* typescript fixes

* roll back setClient takes a callback

* createTaskRunner returns an object with run/cancel functions

* Test task store, tweak task poller tests

* Rename num_workers to max_workers

* Tweak task pool method names

* Fix cancellable test, and ts errors

* Rename doc to _doc

* Fix the doc type in the task manager index mappings

* Make task costs configurable in kibana.yml

* fix a tslint warning

* TaskManager.afterPluginsInit replaces circuitous stuff

* addMiddleware, implement beforeSave

* wip

* comment

* run context stuff

* pretty fix

* comments

* lint/pretty fixes

* safeties in case they don't define both beforeRun and beforeSave

* task runner test constructor opts fix

* Add task_manager integration tests

* FIx readme mistakes, fix schedule signature

* Fix integration tests

* Add blurb about middleware

* make a libs directory for the small things

* test for extractTaskDefinitions

* unit test for middleware

* Comment, refactor, and test task_manager

* Touch up comments

* Make task store throw error if given an unknown task type

* Fix sample task definition in readme

* Make task manager toggle on / off based on Elasticsearch connectivity

* Prevent task manager from crashing Kibana if
elasticsearch plugin is disabled

* Fix task manager signature

* Move the task manager into the task manager mixin,
fix tests. It's an uber integration object anyway, so
it seemed to make sense to keep it in one place.

* Fix task manager integration tests

* Update the task manager index creation to use auto_expand_replicas

* Fix task manager integration tests

* Fix task manager integration tests

* Fix the overzealous deletion of .kibana during tests

* Core task manager

* Allow hardcoded ID passed in

* comments

* don't deconstruct type and task for payload

* remove uiExport support

* move task_manager to x-pack/plugins

* expose as client on the plugin namespace

* fix tests

* move plugin api integration tests

* roll back readme sample task definition example

* fix sample plugin link

* server.taskManager

* sanitizeTaskDefinitions

* fix integration tests

* sanitize rename

* assert unintialized and check for duplicates in registerTaskDefinitions

* Remove unnecessary defaults from task_manager.test.ts

* Remove task manager from OSS

* Remove task manager from src

* Tidy up task_manager unit tests around elasticsearch status changes

* Integration test for specifying ID in scheduling

* Task_manager init -> preInit to allow other plugins to consume
taskManager in their init.

* Remove task manager integration tests from OSS

* spelling

* readme fix

* fix test code impacted by hapi upgrade

* Task Manager index creation changes (#24542)

* Uses putTemplate for task manager mappings and index settings.

* Removes create option.

* Opposite day, the test catches up to the code changes.

* Ignores index unavailable during searches.

* Improve taskRunner's processResult (#24880)

* Set task state to idle after run, and add failed state

* fix tests

* Test alerting demo (#25136)

* Ensures that task store init gets called before schedule.

* Removes unused option for debugging purposes.

* Fix unit tests because a second callCluster was made.

* Task manager starts sanely.

Does not preInit
Will not allow definitions after initialization
Creates store immediately.
Modifies store after all plugins have initialized
Adds static tasks that will be defined by plugins.

* Task manager should not allow operations before initialization.

* Attempts to fix runner tests.

* Fixes unit test contract with APIs.

* Removes unused type definitions.

* Removes unused package json.

* Removes unused import type.

* Removes unnecessary async applied to a function.

* Returns diferently if task store has already initialized.

* Explains how to add static task instances to task definitions. (#25880)

* Tasks cannot be scheduled until task manager is initialized.

* Adds task manager api integration tests to ci group4.

* Context of describe test must be the test framework object.

* Update src/es_archiver/lib/indices/kibana_index.js

regex update to actually disallow non-kibana system indices

Co-Authored-By: tsullivan <tsullivan@users.noreply.github.com>

* verify fillPool exception passing

* readme update about max_workers/numWorkers

* change forEach to reduce

* use public interfaces in internal method

* replace getMaxAttempts with public readonly maxAttempts

* Update x-pack/plugins/task_manager/task_store.ts

`throw new Error` and initializattion spell fix

Co-Authored-By: tsullivan <tsullivan@users.noreply.github.com>

* min = 1 for max_workers

Co-Authored-By: tsullivan <tsullivan@users.noreply.github.com>

* timeOut => timeout

* min 1

* scope as an array

* no retries

Co-Authored-By: tsullivan <tsullivan@users.noreply.github.com>

* ConcreteTaskInstance is a TaskInstance

* remove guard per joi logic

* more return types for functions

* more comments around incremental back-off

Co-Authored-By: tsullivan <tsullivan@users.noreply.github.com>

* throw error instead of return undefined

* poll_interval min 1000

* avoid handling err.stack directly

* break up processResult

* fix a few runtime issues

* only fetch idle tasks

* remove check for status idle

* always return a state, and when there is an error return the state we had at beforeRun

* check isStarted before attemptWork

Co-Authored-By: tsullivan <tsullivan@users.noreply.github.com>

* ts fix
2019-01-04 17:09:46 -07:00
Mike Côté 324ab5da75
Fix es_archiver rebuild_all action to support nested directories (#27592) (#27676)
* Fix es_archiver rebuild_all action to support nested directories

* Merge two functions into one
2018-12-21 09:06:33 -05:00
Tim Roes b02581aa15
Add rest_total_hits_as_int into kibana platform (#26432) (#26615)
* Add rest_total_hits_as_int into Kibana platform

* Add missing returns statement in repository.test.js
2018-12-04 11:49:53 +01:00
Aleh Zasypkin e56759c4de [common] fix paths. 2018-12-03 21:57:24 +01:00
Spencer 219bc53591
[esArchiver] auto-create the default space object when necessary (#24953) (#24999)
* [esArchiver] auto-create the default space object when necessary

* [esArchiver] check for spaces plugin to create default space
2018-11-01 14:50:59 -07:00
Brandon Kobel 08d0fb916d
Make saved object client await migrations prior to calling Elasticsearch (#23709) (#23795)
* Make saved object client error while Kibana index is migrating

* Tidy up a bit, and refactor the way the `isMigrated` check is accessed

* Remove unused interface declaration

* Remove default migrator from saved objects repository constructor

* Fix repository migrator isComplete check

* Wrap callCluster and delay it until migrations have completed...

* Fix inaccurate comment

* Ensure migrations wait for elasticsearch to go green prior to running

* Add tests for callCluster being wrapped in the repository, fix
the es_archiver's call to migrate index.

* Fix es_archiver's kbnServer mock
2018-10-03 16:09:22 -07:00
Chris Davies c67791803f
[6.x] Add saved object index migrations (#20243) (#23262) 2018-09-18 09:46:58 -04:00
Spencer 138f45698c
[accessibility] implement no-animation mode, auto enable for functional tests (#21629) (#22203) 2018-08-22 14:53:58 -07:00
Spencer 8faacedc17
[6.x] [devUtils/toolingLog] give tooling log configurable writers (#22110) (#22241)
Backports the following commits to 6.x:
 - [devUtils/toolingLog] give tooling log configurable writers  (#22110)
2018-08-21 21:29:44 -07:00
Spencer 928e6f0898
[esArchiver] replace windows line-endings on parse (#21111) (#21180)
* [esArchiver] replace windows line-endings on parse

* [esArchiver/parse/tests] feed a little extra data so replaceStream buffer is flushed
2018-07-24 19:43:33 -07:00
Spencer 020d7a30a3
[esArchiver/test] use different lengths for random to ensure unique values (#20857) (#20861)
fixes #20741

Rather than just generate random words with the default length of 2, generate a random 5 letter word for the type to filter by and 10 letter words for the other types, so there will never be more than 3 records with `type1`.
2018-07-17 02:30:46 -07:00
CJ Cenizal c6be289f21
Fix misspellings (#19981) (#20284) 2018-06-27 20:50:06 -07:00
Spencer 4f29b323bf
Backport/19383/6.x (#19487)
* [eslint][tslint] require Apache 2.0 license headers

(cherry picked from commit 337fea30b9)

* [kbn-eslint-plugin-license-header] don't try to fix files with hashbangs

(cherry picked from commit db79f1501e)

* [eslint][tslint] autofix license headers
2018-05-28 20:24:23 -07:00
Spencer 7d153525e6
[6.x] [esArchiver/deleteIndex] wait and retry if snapshot in progress (#18624) (#18934)
* [esArchiver/deleteIndex] wait and retry if snapshot in progress

* [esArchiver/deleteIndex] use recursion for retry

* [esArchiver/waitForSnapshot] invert status check

* [esArchiver] share delete-with-retry with create stream

* [esArchiver/stats] include index name in message

* [esArchiver/indexDelete] wait for snapshot completion up to three times

* [esArchiver] log status of snapshot during checks
2018-05-08 16:03:35 -07:00
Spencer 66d1d3c1ce [esArchiver] fix esArchiver.loadIfNeeded (#18621)
* [utils/jsonParseStream] ensure only callback once

* [utils/streams] add util for piping many streams in series

* [esArchiver/load] combine record streams to fix skipExisting functionality

(cherry picked from commit 21d6dd2cba)
2018-05-02 12:56:29 -07:00
Spencer 5dd87e54db
[npm] upgrade elasticsearch/elasticsearch-browser packages (#17119) (#17165)
* [npm] upgrade elasticsearch/elasticsearch-browser packages

* [es/patchKibanaIndex] update tests to expect indices.getMapping

* [npm] use ^ version range for elasticsearch(-browser) packages

* [es/patchKibanaIndex/tests] expand assertion
2018-03-14 17:07:49 -07:00
Spencer 09e582f82d
[6.x] [precommit hook] add dev script (#14890) (#15065)
* [precommitHook] move to dev script

* [eslint] fix lint error

* [dev/eslint] do simply boolean checks first

* [dev] use shared REPO_ROOT constant

* [dev/File] precompute relative/ext of path

* [dev/eslint] fix relative import

* [dev/eslint] fix typos

* [grunt] remove unused run:eslintStaged config

* [dev/run] only create log if we are going to use it

* [dev/run/isFailError] ensure return value is Boolean

* [dev/precommitHook] use less intermediate vars
2017-11-20 17:00:37 -07:00
CJ Cenizal 7cda1aae09 [eslint-config-kibana] Apply AirBnB spacing rules (#14522) (#14590)
* Add AirBnB key-spacing rule.
* Add AirBnB comma-spacing rule.
2017-10-25 15:19:19 -07:00
Jonathan Budzenski 6c298efc0b [es archiver] fix error causes when requesting multiple index features, replace with filter path (#12473) 2017-06-22 16:06:12 -05:00
Spencer d3ba428796 [ftr] make room for more projects (#11848)
Squashed commit of the following:

commit 659ea986fdeb9a5ff2ca1fa5360cccb01c671ede
Author: spalger <spalger@users.noreply.github.com>
Date:   Wed May 17 09:19:22 2017 -0700

    [test/*/fixtures] rename es_archives to es_archiver

commit d3667457c78e88e2d6974f3c38dd0fe61b846b91
Author: spalger <spalger@users.noreply.github.com>
Date:   Wed May 17 08:22:03 2017 -0700

    [ftr/config] fix default directory value functions

commit 9a6a2cc0b295e2281e83da04fcea40e9d6f00781
Author: spalger <spalger@users.noreply.github.com>
Date:   Wed May 17 07:30:52 2017 -0700

    fix import paths

commit fcb65a877d54b5b1d36b8c81f1264b36845e826e
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 21:39:57 2017 -0700

    [grunt/ftr] use named exports for configs

commit 7d7f38c7615cdbf8eb0119efc0f2a5188bca8792
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 18:50:04 2017 -0700

    [test] remove unnecessary directory definitions

commit 0c28984669768482f0a2ee7fc2800d5bcaf49025
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 18:46:29 2017 -0700

    [ftr/config] make default directories relative to config path

commit cd2f33612624cacffec138797f3fc0f4ecb46cca
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 18:32:12 2017 -0700

    [test/common] put server config into common

commit 7851ed811a236576c63bd20850b3ef2099be2a4e
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 18:18:20 2017 -0700

    [grunt] "deprecate" test:api:runner task

commit b2ac4c26593a1947c94f0168191fe8123ff74122
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 18:15:41 2017 -0700

    [ftr] accept the project name as an unnamed arg

commit 47e292894fc70c0a04883403c50c5d2ae0738d76
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 17:56:34 2017 -0700

    [ftr/grunt] convert ftr task to multi-task with config

commit 83375855f88e5e7b3fa8b6a1c5d24a9f54766ce5
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 17:54:54 2017 -0700

    [test/functional] move fixtures into test/functional project

commit 05994e9c92cf134c58f831c285b3b522a801acbc
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 17:02:51 2017 -0700

    [src/test_utils] merge with test/utils directory

commit c77ee5ed36b8b7eadf876cb6d9482a49dfc92b66
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 16:53:00 2017 -0700

    [test/api_integration] migrate api tests to functional test runner

commit ca328c34648dd7e07f70e1844e07cfc392e41103
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 16:50:12 2017 -0700

    [esArchiver] refresh modified indices after load

commit cde74a540850fd97578f441d6dccaefd1444e656
Author: spalger <spalger@users.noreply.github.com>
Date:   Tue May 16 16:46:48 2017 -0700

    [test/functional] move shared services into test/common

commit 0ea2646aea5817f6d1595e6ae0d356c426f138f0
Author: spalger <spalger@users.noreply.github.com>
Date:   Mon May 15 22:51:23 2017 -0700

    [scripts/mocha] run _mocha script when debugging

commit 1cc80600d90e318d4738920aa557d124075a4570
Author: spalger <spalger@users.noreply.github.com>
Date:   Mon May 15 22:48:12 2017 -0700

    [ftr/config] allow child config files to have no testFiles config

commit 2bb6c957443b18cebc419baa6f9db301c8f4dc4f
Author: spalger <spalger@users.noreply.github.com>
Date:   Mon May 15 21:52:26 2017 -0700

    [ftr] move screenshots into test/functional
2017-05-17 18:53:45 -07:00
archana 4c3f39e949 [Typo] Change all indicies to indices (#11564) 2017-05-09 20:52:54 -05:00
Spencer 811ed5b5f5 Cleanup some FunctionalTestRunner tidbits (#11211)
* [esArchiver] match functionalTestRunner --config default

* [functionalTestRunner] expose readConfigFile function

* [functionalTestRunner/mocha reporter] define undefined variable

* [functionalTests/services/remote] log tunnel output in verbose mode
2017-04-13 12:15:01 -07:00
Spencer 90434765c0 [functionalTestRunner] replace intern (#10910)
* [functional_test_runner] replace functional testing tools with custom/pluggable solution

* [functional_test_runner] Convert unit tests to commonjs format

* [functional_test_runner] Fix dashboard test in wrong mode

* [functional_test_runner] Add dashboardLandingPage test subject

* [functional_test_runner] Get Visualize page object

* [functional_test_runner] Fix outdated references

* [functional_test_runner] Fix more outdated refs

* [functional_test_runner] Remove duplicate tests

* [functional_test_runner] Improve test readability

* [functional_test_runner] 😞 So many duplicate methods

* [functional_test_runner] Move mgmt `before` outside toplevel describe

* [functional_test_runner] Settings page obj missing methods

* [functional_test_runner] Add improvements from @gammon

* [functional_test_runner] Fix return statements in async funcs

* [functional_test_runner] Move before() to correct scope

* [functional_test_runner] Add after() hooks to remove index patterns

* [functional_test_runner] Attempt to fix vertical bar chart tests

* [functional_test_runner] Clean up

* [functional_test_runner] Reinstate unit tests

* [functional_test_runner] Set default loglevel back to info

* [functional_test_runner] Replace `context`s with `describe`s

* [functional_test_runner] Better error handling

* [functional_test_runner] Add in new Tile Map tests

* Incorporate changes from master

* [functional_test_runner] validate that every test file has a single top-level suite

* Update contributing doc with link to full doc

* [docs] Spelling and grammar fixes

* docs: writing and running functional tests

* [docs] Move plugin doc to plugin area

* [docs] Housekeeping. Doc in wrong place

* [docs] Remove dup doc file

* [grunt] Only run mocha_setup when running tests, not every grunt task
2017-04-11 17:01:06 -05:00
Kim Joar Bekkelund 76c0b01c9d [test] Move from 'context' to 'describe' (#10991) 2017-04-03 20:59:00 -04:00
Spencer e67790037a [esArchiver] combine elasticDump and ScenarioManager (#10359)
* As a part of bringing functional testing to plugins, esArchiver gives these plugins a way to capture and reload es indexes without needing to write a bunch of custom code. It works similarly to the elasticDump and ScenarioManager tools that it replaces.

Differences:
  - Streaming implementation allows for much larger archives
  - CLI for creating and using archives
  - Configurable archive location
  - Stores the data in gzipped files (better for source control, searching, large archives)
  - Automatically identifies and upgrades Kibana config documents

Methods:
  - `#load(name)`: import an archive
  - `#loadIfNeeded(name)`: import an archive, but skip the documents what belong to any existing index
  - `#unload(name)`: delete the indexes stored in an archive

CLI operations:
  - `./bin/es_archiver save <name> [index patterns...]`: save the mapping and documents in one or more indexes that match the wild-card patterns into an the `<name>` archive
  - `./bin/es_archiver load <name>`: load the mapping and documents from the `<name>` archive

* [functional_tests/common/nagivate] check for statusPage

* [es_archiver] move bins into new scripts dir

* [functional_tests/apps/context] use esArchiver

* [esArchiver] general improvements after showing to a few folks

 - remove auto-upgrading config doc logic (until we have better access to kibana version info)
 - export unload command
 - remove preemptive checks in favor of reacting to errors
 - use type "doc" vs "hit" for doc records (consistency)
 - wrote a bunch of pending tests to think though and plan

* [esArchiver] make log a stream that writes to itself

* [esArchiver] fill in stats and archive format tests

* [esArchiver] splitup action logic

* [esArchiver/cli] fix cli --help output and comment

* [esArchiver] remove type-based param coercion

* [esArchiver/log] use strings for log levels

* [esArchvier] remove unused var

* [esArchiver/indexDocRecordsStream] add tests

* [esArchive] fill in remaining tests

* [esArchiver] fix dem tests

* [eslint] remove unused vars

* [esArchiver/loadIfNeeded] fix call to load()

* [esArchiver] remove loadDumpData helpers
2017-03-27 15:29:14 -04:00