Skip to content

Conversation

@tsullivan
Copy link
Member

Summary

#53898

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

@tsullivan tsullivan added 0sp zDeprecated Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0 and removed 0.5sp labels Jan 28, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-reporting-services (Team:Reporting Services)

@tsullivan tsullivan requested review from a team, joelgriffith, pgayvallet and rudolf January 28, 2020 18:48
@tsullivan tsullivan mentioned this pull request Jan 29, 2020
19 tasks
@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

@tsullivan
Copy link
Member Author

Ready for review :)

@pgayvallet
Copy link
Contributor

Ack: will review tomorrow

@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@joelgriffith joelgriffith left a comment

Choose a reason for hiding this comment

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

LGTM, reviewed code only

Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

Some NITs regarding test mocks, overall LGTM

Comment on lines +51 to +56
const mockElasticsearch = {
dataClient: {
asScoped: () => ({ callAsCurrentUser: jest.fn() }),
},
};

Copy link
Contributor

Choose a reason for hiding this comment

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

It's recommended to use the provided mocks when mocking core services. (multiple occurences, will comment only once)

import { elasticsearchServiceMock } from '[..]/src/core/server/mocks';

const mockElasticsearch = elasticsearchServiceMock.createSetupContractMock()

Comment on lines 7 to 9
import * as Rx from 'rxjs';
import { ElasticsearchServiceSetup } from 'kibana/server';
import { catchError, map, mergeMap, takeUntil } from 'rxjs/operators';
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: kibana/server import should probably be after node modules imports

Comment on lines +95 to +99
await plugin.setup(coreSetup, {
elasticsearch: coreSetup.elasticsearch,
security: server.newPlatform.setup.plugins.security as SecurityPluginSetup,
usageCollection: server.newPlatform.setup.plugins.usageCollection,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Redundant parameters: elasticsearch is already provided by coreSetup, elasticsearch: coreSetup.elasticsearch, seems unnecessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

The params are forced to fit the ReportingStartDeps interface, which is used all over the place to pull the ES service. Unfortunately it seems to make better sense to keep it this way, but I could see it changing later on.

Comment on lines +53 to +55
getMockServer(),
{} as ElasticsearchServiceSetup,
getMockLogger(),
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: cf. previous comment, using core mocks is preferable to force-casting

@tsullivan tsullivan merged commit c2a6e75 into elastic:master Jan 31, 2020
@tsullivan tsullivan deleted the reporting/np-server-upgrade-elasticsearch-dep branch January 31, 2020 19:50
@tsullivan
Copy link
Member Author

@pgayvallet regarding the need for using mocks from core: I agree ultimately that would be a good refactoring improvement to the tests. This particular area of code feels pretty short-lived though, soon @joelgriffith and I will be heavily changing the queuing systems to replace with ESQueue, and further on I really think we can remove the abstraction of "export types" from Reporting if we're able to make the Reporting plugin have complete focus on capturing screenshots. Right now it juggles both screenshotting a Kibana URL and exporting CSV from a saved search.

tsullivan added a commit to tsullivan/kibana that referenced this pull request Feb 3, 2020
* [Reporting] Use ES plugin from NP

* fix elasticsearchErrors reference

* fix mocha test

* convert to jest

* fix the code and tests

* cosmetics

* fix mocha tests

* fix imports

* fix mocha tests

* fix jest

* simplify

Co-authored-by: Elastic Machine <[email protected]>
tsullivan added a commit that referenced this pull request Feb 5, 2020
* [Reporting] Use ES plugin from NP (#56209)

* [Reporting] Use ES plugin from NP

* fix elasticsearchErrors reference

* fix mocha test

* convert to jest

* fix the code and tests

* cosmetics

* fix mocha tests

* fix imports

* fix mocha tests

* fix jest

* simplify

Co-authored-by: Elastic Machine <[email protected]>

* fix eslint

* fix missing import

* fix the backport

* fix mocha test

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0 zDeprecated Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants