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

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

Merged

Conversation

justinkambic
Copy link
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 <[email protected]>
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@andrewvc andrewvc left a comment

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
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
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
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.

@@ -9,11 +9,15 @@ import { get, set } from 'lodash';
export const getFilteredQuery = (
dateRangeStart: string,
dateRangeEnd: string,
filters?: string | null
filters?: string | null | any
Copy link
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
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
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
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
Contributor Author

jenkins test this

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@justinkambic justinkambic merged commit 505873e into elastic:master Jan 31, 2019
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