Skip to content

[Uptime] Port functional tests to 7.x - #29398

Merged
justinkambic merged 53 commits into
elastic:masterfrom
justinkambic:uptime_port-func-tests-to-7.x
Jan 31, 2019
Merged

justinkambic merged 53 commits into
elastic:masterfrom
justinkambic:uptime_port-func-tests-to-7.x

Conversation

@justinkambic

Copy link
Copy Markdown
Contributor

Summary

We added functional tests for 6.x in #29128. This is a port of those tests. We can't use the same tests for each because of breaking HB doc changes between 6.x and 7.x.

justinkambic and others added 30 commits January 25, 2019 13:58
* Add API functional tests for uptime graphQL.

* Remove obsolete code.

* Add CI group for UI functional tests.

* Delete obsolete code, rename heartbeat es archive.

* Refactor adapter methods.

* Refactor adapter methods.

* Attempt to fix ci-group tag error.

* Skip functional app tests until later PR.

* Remove unused code.

* Optimize test runs.

* Add uptime to api test index.

* Fix formatting.
…ch_monitors_adapter.ts


Implement PR feedback.

Co-Authored-By: justinkambic <justin.kambic@elastic.co>
@elasticmachine

Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@andrewvc andrewvc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I left one optional suggestion, but it's not really necessary

return latestMonitors;

// @ts-ignore undefined entries are filtered out
return latestMonitors.filter(monitor => monitor !== undefined);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thought, instead of assigning latestMonitors, just chain the filter there directly, and avoid the messiness of the Array<LatestMonitor | undefined> type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's funny - that's how I originally wrote it, but my IDE's linter kept complaining. I went back and re-introduced it like you suggested and it has no problem with it now. Glad you commented here, it's much cleaner now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 8856be8.

dateRangeStart: string,
dateRangeEnd: string,
filters?: string | null
filters?: string | null | any

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm missing something here for typescript, but what's the point of keeping the string | null if we have any?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels to me like the real fix here (that can happen in a subsequent PR), is to remove filters as a query param, and create a tighter API definition.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm - I don't know that we actually need any defined there. Good find. I will look into it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do need any (or a more specific type at least, because the function handles multiple object types) for now, but like you say, we will eventually be able to refactor and delete this code. When we implement #29745 we won't need any.. anymore. When we update the GQL schema, we can use the type we generate from that.

@justinkambic

Copy link
Copy Markdown
Contributor Author

jenkins test this

@elasticmachine

Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine

Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine

Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@justinkambic
justinkambic merged commit 505873e into elastic:master Jan 31, 2019
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
* Refactor es queries and associated components/endpoints.

* Add unit tests, repair broken tests.

* [Uptime] Add API functional tests for uptime graphQL (elastic#29128)

* Add API functional tests for uptime graphQL.

* Remove obsolete code.

* Add CI group for UI functional tests.

* Delete obsolete code, rename heartbeat es archive.

* Refactor adapter methods.

* Refactor adapter methods.

* Attempt to fix ci-group tag error.

* Skip functional app tests until later PR.

* Remove unused code.

* Optimize test runs.

* Add uptime to api test index.

* Fix formatting.

* Add HB 7.0 data for API tests.

* Configure first error_list test to work with 7.x data.

* Configure error_list filtered by id to work with 7.x data.

* Configure error_list functional tests to work with 7.x data.

* Update snapshot test to work with 7.x data.

* Update snapshot down filtered test to work with 7.x data.

* Configure snapshot up test to work with 7.x data.

* Configure ping list tests to work with 7.x data.

* Configure monitor list tests to work with 7.x data.

* Configure monitor status bar tests to work with 7.x data.

* Configure filterBar tests to work with 7.x data.

* Configure docCount tests to work with 7.x data.

* Simplify code based on PR feedback.

* Add loading spinner to monitor page title based on PR feedback.

* Rename GQL type based on PR feedback.

* Remove use of 'undefined' in ES query based on PR feedback.

* Simplify code based on PR feedback.

* Add definite size/shard_size for terms agg based on PR feedback.

* Simplify ES query based on PR feedback.

* Update x-pack/plugins/uptime/server/lib/adapters/monitors/elasticsearch_monitors_adapter.ts

Implement PR feedback.

Co-Authored-By: justinkambic <justin.kambic@elastic.co>

* Increase size for ES errors query based on PR feedback.

* Fix hardcoded field in terms filter based on PR feedback.

* Simplify get code for monitors function.

* Reduce unnecessarily large size for terms agg based on PR feedback.

* Pluralize filter bar props.

* Refactor filter bar query based on PR feedback.

* Update test.

* Fix busted GQL query.

* Update functional test docs to use data without buggy values.

* Update index name in HB functional api test docs.

* Update snapshot base functional test.

* Make snapshot filter tests pass, fix associated bug.

* Configure remaining snapshot e2e tests to work with 7.x data.

* Give better variable names and comments for ugly code.

* Configure ping list query tests to work with updated 7.x data.

* Rename graphql describe block.

* Update monitor status bar query tests to work with updated 7.x data.

* Update monitor list query tests to work with updated 7.x data.

* Update filter bar query to work with updated 7.x data.

* Update error list query to work with updated 7.x data.

* Update doc count fixture to work with new 7.x data.

* Address PR feedback with filter typing to clean up code.

* Add comments based on PR feedback.

* Fix bug introduced in 8856be8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability test_api v7.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants