Skip to content

Do not allocate resources within test constructor#15937

Merged
arhimondr merged 1 commit intoprestodb:masterfrom
v-jizhang:abstract_smoke_test
May 13, 2021
Merged

Do not allocate resources within test constructor#15937
arhimondr merged 1 commit intoprestodb:masterfrom
v-jizhang:abstract_smoke_test

Conversation

@v-jizhang
Copy link
Contributor

@v-jizhang v-jizhang commented Apr 13, 2021

Cherry-pick of trinodb/trino#2412

Co-authored-by: Piotr Findeisen findepi@users.noreply.github.com

Test plan - Make sure all CI tests pass.

Depends on https://github.com/facebookexternal/presto-facebook/pull/1542

== RELEASE NOTES ==
General Changes
* Do not allocate resources within test constructor for a cleaner code.

@findepi
Copy link
Contributor

findepi commented Apr 16, 2021

Co-authored-by: Piotr Findeisen findepi@users.noreply.github.com

this is the deprcated form of noreply GH emails
please copy my email from original commit, or at least use the current form (with a dash and number)

@v-jizhang
Copy link
Contributor Author

v-jizhang commented Apr 26, 2021

Sure. Thanks

@aweisberg aweisberg self-requested a review April 26, 2021 16:39
@v-jizhang v-jizhang force-pushed the abstract_smoke_test branch from 41d56be to 232855a Compare April 26, 2021 21:03
@aweisberg aweisberg force-pushed the abstract_smoke_test branch from 232855a to 36519db Compare May 3, 2021 16:09
Copy link
Contributor

@aweisberg aweisberg left a comment

Choose a reason for hiding this comment

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

This doesn't make use of closeAfterClass which is a nice refactor, but lets say that is for later. This also still has some constructors that allocate resources/things which is avoided in several instances in Trino.

Still I wouldn't block on that since it is forward progress and the PR is already broken because it hasn't landed. Would like to get the API change in.

I don't understand why this is necessary both in and of itself (is it just for cleanliness and safe constructors?) and specifically as a dependency.

Since I rebased it doesn't build on some tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still creating a resource in the constructor. It also happens in 2-3 places above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll move it to @BeforeVlass

Copy link
Contributor Author

@v-jizhang v-jizhang May 4, 2021

Choose a reason for hiding this comment

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

That won't work because the resource is required in createdQueryRunner and it is called before @BeforeClass. I think the resource created in constructor is Ok here, we don't pass it to super class.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unintended indentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original indentation was wrong.

@aweisberg aweisberg force-pushed the abstract_smoke_test branch 2 times, most recently from 8a03411 to d8895d5 Compare May 3, 2021 17:46
@v-jizhang
Copy link
Contributor Author

This doesn't make use of closeAfterClass which is a nice refactor, but lets say that is for later. This also still has some constructors that allocate resources/things which is avoided in several instances in Trino.

Still I wouldn't block on that since it is forward progress and the PR is already broken because it hasn't landed. Would like to get the API change in.

I don't understand why this is necessary both in and of itself (is it just for cleanliness and safe constructors?) and specifically as a dependency.

Since I rebased it doesn't build on some tests.

It's not just for cleanliness and safe constructor, it's a dependency because super class of TestElasticsearchIntegrationSmokeTest needs a QueryRunner created by EmbeddedElasticsearchNode. We can adapt it but I think it's better to remove the resource from constructors.

Cherry-pick of trinodb/trino#2412

Co-authored-by: Piotr Findeisen <piotr.findeisen@gmail.com>
@aweisberg aweisberg force-pushed the abstract_smoke_test branch from d97f339 to 001bc1b Compare May 12, 2021 19:06
Copy link
Contributor

@aweisberg aweisberg left a comment

Choose a reason for hiding this comment

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

LGTM, TY!

@aweisberg aweisberg requested review from arhimondr and rschlussel May 13, 2021 14:17
@arhimondr arhimondr merged commit aa59a8d into prestodb:master May 13, 2021
@sujay-jain sujay-jain mentioned this pull request May 21, 2021
10 tasks
@v-jizhang v-jizhang deleted the abstract_smoke_test branch June 3, 2021 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants