Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for importing dashboards #3370

Closed
andrewkroh opened this issue Jan 13, 2017 · 2 comments
Closed

Add tests for importing dashboards #3370

andrewkroh opened this issue Jan 13, 2017 · 2 comments

Comments

@andrewkroh
Copy link
Member

The import_dashboard tests were broken because they tested the exit code which was always 0.

In #3252 we fixed the exit code, but the tests are broken because they are part of libbeat where they depend on the index patterns in each of the beats which are not generated when the test runs. The beats may depend on libbeat, but libbeat may not depend any beat.

So one solution is to test the dashboards in each of the beats' test. We could have some kind of dummy data in libbeat to test the import_dashboards tool without creating a dependency on a beat.

andrewkroh pushed a commit that referenced this issue Jan 13, 2017
* Always set exit status of 1 on error

Previously, a failure in ImportKibana or ImportArchive methods would print an
error, but the exit status would be set to 0.

In addition, the ImportDir method would return nil instead of an error when
asked to import a directory which did not exist. This would end up printing
several error messages to the console but ultimately causing an exit status of
0.

* Fix English grammar in errors with s/fail/failed/

Most of the error messages were things like "fail to" which reads better as
"failed to".

* Use assertEqual to check the return code from import_dashboards

The test failure message now includes the stdout & stderr output from the
script for easier debugging.

* Look for Kibana index in _meta/kibana, not etc/kibana

* Fix spelling of "visualization" in status message

* Make ImportKibana and ImportDir smarter about missing dirs

If someone passes a -dir that doesn't exist at all, that's an error. If the
dir does exist but it does not have either an index-pattern or dashboard
subdir, that is also an error.

Similarly, if they request -only-index or --only-dashboards and the
corresponding subdir doesn't exist that's an error.

We check all of this in ImportKibana, so we no longer pass non-existent
subdirs to ImportDir, meaning it can assume that the dir exists.

* Standardize error message casing and use of periods

I also added a little more detail to a few error messages and tweaked the
grammar in a few spots.

* Send all error output to os.stderr

* Add a -quiet option to to suppress all status messages

* Skip the dashboard import test entirely for now (see #3370)
@andrewkroh
Copy link
Member Author

andrewkroh commented Mar 16, 2018

@ruflin has been adding tests for dashboards.

@kvch
Copy link
Contributor

kvch commented Jan 3, 2020

import_dashboards tool has been removed. Closing.

@kvch kvch closed this as completed Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants