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

[TECHDEBT] [Persistence] Fix Persistence Module TODOs - Golang Test Cleanup & Teardown #208

Closed
7 tasks
jessicadaugherty opened this issue Sep 12, 2022 · 2 comments
Assignees
Labels
code health Nice to have code improvement core starter task Good for newcomers, but aimed at core team members though still open for everyone core Core infrastructure - protocol related persistence Persistence specific changes

Comments

@jessicadaugherty
Copy link
Contributor

jessicadaugherty commented Sep 12, 2022

Objective

A general cleanup issue is needed to tackle TODO's and ensure the persistence module is usable/readable by refactoring golang-specific Golang test cleanup & teardown as part of #172 and #149.

Origin Document

Should follow issue-#128, issue-#105, issue-#147 and issue-#148 the persistence module is messier and more difficult to understand than the developers would want for organic external contribution.

Goals / Deliverables

  • Implement golang-specific Golang test cleanup & teardown.
    For example, the usage of:
func CleanupTest() {
	PostgresDB.Tx.Rollback(context.TODO())
	PersistenceModule.Stop()
}

Can be refactored to something like this:

func NewTestingUtilityContext(t *testing.T, height int64) utility.UtilityContext {   
   ... 
   t.Cleanup(func() {
        ctx.Context.Release() // TODO (team) need a golang specific solution for teardown
        PostgresDB.Tx.Rollback(context.TODO())
        PersistenceModule.Stop()
   })
  ...
  return &UtilityContext{...

General issue checklist

  • Update the appropriate CHANGELOG
  • Update the README
  • If applicable, update the source code tree explanation
  • If applicable, add or update a state, sequence or flowchart diagram using mermaid
  • Update any relevant global documentation & references
  • Document small issues / TODOs along the way

Creator: @andrewnguyen22
Co-creator: @Olshansk

@jessicadaugherty jessicadaugherty moved this to Backlog in V1 Dashboard Sep 12, 2022
@jessicadaugherty jessicadaugherty moved this from Backlog to Up Next in V1 Dashboard Sep 12, 2022
@Olshansk Olshansk self-assigned this Sep 12, 2022
@Olshansk Olshansk added the persistence Persistence specific changes label Sep 12, 2022
@Olshansk Olshansk added code health Nice to have code improvement core Core infrastructure - protocol related priority:medium labels Sep 12, 2022
@jessicadaugherty jessicadaugherty moved this from Up Next to Backlog in V1 Dashboard Oct 5, 2022
@jessicadaugherty jessicadaugherty changed the title [Persistence] Fix Persistence Module TODOs - Golang Test Cleanup & Teardown [TECHDEBT] [Persistence] Fix Persistence Module TODOs - Golang Test Cleanup & Teardown Oct 6, 2022
@Olshansk Olshansk assigned Jasonyou1995 and unassigned Olshansk Oct 24, 2022
@Olshansk
Copy link
Member

@Jasonyou1995 I assigned this task to you since you've been digging into the persistence module. No need to tackle it right away (we can figure that part out) but the main goal here is to move our proprietary testing setup & teardown to the standard libraries use in Go.

This is a good article as a starting point to learn more: https://medium.com/nerd-for-tech/setup-and-teardown-unit-test-in-go-bd6fa1b785cd

The tl;dr is to remove all instance of test_artifacts.CleanupTest(ctx) which are spread across the utility, persistence and runtime modules in favor of using Go's t.Cleanup

@Olshansk Olshansk added the core starter task Good for newcomers, but aimed at core team members though still open for everyone label Nov 9, 2022
@Olshansk Olshansk moved this from Backlog to Up Next in V1 Dashboard Dec 15, 2022
@Olshansk
Copy link
Member

Olshansk commented Mar 8, 2023

Resolved as part of #550.

@Olshansk Olshansk closed this as completed Mar 8, 2023
@github-project-automation github-project-automation bot moved this from Up Next to Done in V1 Dashboard Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Nice to have code improvement core starter task Good for newcomers, but aimed at core team members though still open for everyone core Core infrastructure - protocol related persistence Persistence specific changes
Projects
Status: Done
Development

No branches or pull requests

4 participants