Skip to content
Snippets Groups Projects

Use t.Cleanup for startWorkhorseServerWithConfig startWorkhorseServer

Merged Gavin Hinfey requested to merge 433440-replace-cleanup-in-main-test into master

What does this MR do and why?

Replace cleanup with t.Cleanup in workhorse tests.

In many places we return a cleanup function and defer its execution in order to cleanup after tests. This MR refactors it to use T.Cleanup as it has been added to Go.

Checks

  • (startWorkhorseServerWithConfig, startWorkhorseServer) -- main_test.go -- these two functions can accept *testing.T and internally cleanup: it will save us from calling defer ws.Close() everytime

  • (startWebsocketServer) -- channel_test.go -- this function can accept *testing.T and internally cleanup: it will save us from calling defer ws.Close() everytime

  • (wireupChannel) -- channel_test.go -- contains calls to testAuthServer, startWorkhorseServer, startWebsocketServer: when these functions are refactored, wireupChannel don't need to explicitly cleanup anything

Checkboxes of #433440 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Passing workhorse tests should be sufficient.

Pulled from Replace cleanup with t.Cleanup in workhorse tests (!141855 - closed) to reduce MR size.
Related to #433440 (closed)

Edited by Gavin Hinfey

Merge request reports

Merged results pipeline #1157139674 passed

Pipeline: E2E GDK

#1157148443

    Merged results pipeline passed for d1e51a99

    Test coverage 68.80% from 4 jobs

    Merged by Igor DrozdovIgor Drozdov 1 year ago (Jan 30, 2024 9:01am UTC)

    Loading

    Pipeline #1157205261 passed

    Pipeline passed for 472baf59 on master

    Test coverage 68.80% from 4 jobs
    10 environments impacted.

    Activity

    Filter activity
    • Approvals
    • Assignees & reviewers
    • Comments (from bots)
    • Comments (from users)
    • Commits & branches
    • Edits
    • Labels
    • Lock status
    • Mentions
    • Merge request status
    • Tracking
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    • Loading
    Please register or sign in to reply
    Loading