Skip to content

Replace shutdownEnvironment with t.Cleanup() #2491

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

Merged
merged 15 commits into from
Jan 19, 2024
Merged

Conversation

dhrubabasu
Copy link
Contributor

Why this should be merged

We currently require consumers of newEnvironment to call shutdownEnvironment. We can use t.Cleanup() to do this more robustly and save on LoC.

How this works

Deletes shutdownEnvironment and moves it to a t.Cleanup call

How this was tested

CI

@dhrubabasu dhrubabasu added testing This primarily focuses on testing cleanup Code quality improvement labels Dec 15, 2023
@dhrubabasu dhrubabasu added this to the v1.10.18 milestone Dec 15, 2023
@dhrubabasu dhrubabasu self-assigned this Dec 15, 2023
@dhrubabasu dhrubabasu changed the title Use t.Cleanup() Replace shutdownEnvironment with t.Cleanup() Dec 15, 2023
Copy link
Contributor

@abi87 abi87 left a comment

Choose a reason for hiding this comment

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

I'd suggest to move these changes after we cleaned up the UTs framework.
As you know there is quite some code duplication currently and a few PRs have been open for a few months now to address this. You can find them in #2453. You know I welcome your review on those.
Merging these PRs will result in a larger reduction of LOC than any ad-hoc attempt like this one. It would also definitely reduce the work needed to maintain those PRs up to date

@dhrubabasu
Copy link
Contributor Author

dhrubabasu commented Dec 18, 2023

I'd suggest to move these changes after we cleaned up the UTs framework. As you know there is quite some code duplication currently and a few PRs have been open for a few months now to address this. You can find them in #2453. You know I welcome your review on those. Merging these PRs will result in a larger reduction of LOC than any ad-hoc attempt like this one. It would also definitely reduce the work needed to maintain those PRs up to date

Where does this PR overlap with the UT framework PRs? I'd be happy to update those PRs if that unblocks this minor cleanup PR (or minimize the diff here if it reduces conflicts)

@dhrubabasu dhrubabasu requested a review from abi87 December 18, 2023 19:08
@abi87
Copy link
Contributor

abi87 commented Dec 18, 2023

I'd suggest to move these changes after we cleaned up the UTs framework. As you know there is quite some code duplication currently and a few PRs have been open for a few months now to address this. You can find them in #2453. You know I welcome your review on those. Merging these PRs will result in a larger reduction of LOC than any ad-hoc attempt like this one. It would also definitely reduce the work needed to maintain those PRs up to date

Where does this PR overlap with the UT framework PRs? I'd be happy to update those PRs if that unblocks this minor cleanup PR (or minimize the diff here if it reduces conflicts)

It's not so much the effort of rebasing the PRs in #2453, but to do it daily in order to keep them up to date. Same actually applies to all the outstanding P-chain PRs.
This PR helps maintanability of P-chain UTs, which is not great at the moment. The whole #2453 thread does, and it tries to tackle:

  • removal of code duplication across packages
  • bittle handling of fork times and ordering

I am suggesting to prioritize these PRs by impact and to merge PRs in #2453 before this ones

@StephenButtolph StephenButtolph modified the milestones: v1.10.18, v1.10.19 Jan 16, 2024
@dhrubabasu dhrubabasu changed the base branch from dev to master January 19, 2024 17:31
@dhrubabasu dhrubabasu changed the title Replace shutdownEnvironment with t.Cleanup() Replace shutdownEnvironment with t.Cleanup Jan 19, 2024
@dhrubabasu dhrubabasu changed the title Replace shutdownEnvironment with t.Cleanup Replace shutdownEnvironment with t.Cleanup() Jan 19, 2024
@StephenButtolph StephenButtolph added this pull request to the merge queue Jan 19, 2024
Merged via the queue into master with commit a054afd Jan 19, 2024
@StephenButtolph StephenButtolph deleted the t-cleanup branch January 19, 2024 21:15
tedim52 pushed a commit to tedim52/avalanchego that referenced this pull request Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code quality improvement testing This primarily focuses on testing
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants