linuxboot / contest

Run continuous and on-demand system testing for real and virtual hardware
MIT License
17 stars 17 forks source link

Migrating the whole project from xcontext to go-belt. #164

Closed xaionaro closed 1 year ago

xaionaro commented 1 year ago

What

Here I do substitution of xcontext to go-belt and signallers. The APIs are mostly compatible, so this was a pretty mechanistic stupid job (could mostly be done with sed).

Caveats:


Why

TLDR: xcontext is succeeded by go-belt. xcontext existed for some time, there was gathered the feedback and in result go-belt is a better version of similar ideas.

More details

The previous design had few very serious problems:

There were also other known (less serious) problems, and in go-belt all that is solved.


How

The PR consists of 4 commits:

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 66.07% and project coverage change: -1.58 :warning:

Comparison is base (57569d4) 63.37% compared to head (ab3087b) 61.79%.

:exclamation: Current head ab3087b differs from pull request most recent head c13b022. Consider uploading reports for the commit c13b022 to get more accurate results

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #164 +/- ## =========================================== - Coverage 63.37% 61.79% -1.58% =========================================== Files 165 130 -35 Lines 10587 9196 -1391 =========================================== - Hits 6709 5683 -1026 + Misses 3134 2842 -292 + Partials 744 671 -73 ``` | Flag | Coverage Δ | | |---|---|---| | e2e | `49.52% <54.57%> (+1.00%)` | :arrow_up: | | integration | `56.85% <63.51%> (+2.30%)` | :arrow_up: | | unittests | `45.65% <46.68%> (-3.93%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [cmds/admin\_server/server/server.go](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y21kcy9hZG1pbl9zZXJ2ZXIvc2VydmVyL3NlcnZlci5nbw==) | `0.00% <0.00%> (ø)` | | | [cmds/admin\_server/storage/mongo/mongo.go](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y21kcy9hZG1pbl9zZXJ2ZXIvc3RvcmFnZS9tb25nby9tb25nby5nbw==) | `8.56% <0.00%> (+0.37%)` | :arrow_up: | | [pkg/api/event.go](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cGtnL2FwaS9ldmVudC5nbw==) | `77.77% <ø> (ø)` | | | [pkg/cerrors/cerrors.go](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cGtnL2NlcnJvcnMvY2Vycm9ycy5nbw==) | `12.50% <ø> (ø)` | | | [pkg/event/frameworkevent/framework.go](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cGtnL2V2ZW50L2ZyYW1ld29ya2V2ZW50L2ZyYW1ld29yay5nbw==) | `75.00% <ø> (ø)` | | | [pkg/event/testevent/test.go](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cGtnL2V2ZW50L3Rlc3RldmVudC90ZXN0Lmdv) | `100.00% <ø> (ø)` | | | [pkg/job/reporting.go](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cGtnL2pvYi9yZXBvcnRpbmcuZ28=) | `100.00% <ø> (ø)` | | | [pkg/jobmanager/stop.go](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cGtnL2pvYm1hbmFnZXIvc3RvcC5nbw==) | `83.33% <0.00%> (ø)` | | | [pkg/loggerhook/httphook.go](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cGtnL2xvZ2dlcmhvb2svaHR0cGhvb2suZ28=) | `0.00% <0.00%> (ø)` | | | [pkg/target/locker.go](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cGtnL3RhcmdldC9sb2NrZXIuZ28=) | `100.00% <ø> (ø)` | | | ... and [78 more](https://app.codecov.io/gh/linuxboot/contest/pull/164?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

mimir-d commented 1 year ago

this is gonna take a while to review, but i know what it is about

xaionaro commented 1 year ago

I've switched the base from main to develop, since the PR contains API-breaking changes.

mimir-d commented 1 year ago

since this touches state resume in a lot of places, id like to see a test with that. maybe a step with sleep 30, sigint the server and resume

that would also show if there's any changes in the log output

xaionaro commented 1 year ago

I've started to redesign signaling: there was a known and shameful problem I had no time to fix in xcontext, and it correlates with some of the feedback. So I guess I finally need to find time to redesign the thing and fix that :)

Will publish today-tomorrow.


UPDATE: Done. But now integration tests are failing. Looking into it...

xaionaro commented 1 year ago

since this touches state resume in a lot of places, id like to see a test with that. maybe a step with sleep 30, sigint the server and resume

I thought we have integration tests, which check this. No?

xaionaro commented 1 year ago

Commit "[pkg/signaling] Add a package to handle Pause signal" was rewritten from scratch and requires a full review. In other commits the changes are isolated to minimalistically address the provided feedback.

mimir-d commented 1 year ago

very nice job in refactoring the signaling part

mimir-d commented 1 year ago

I thought we have integration tests, which check this. No?

yeah, that's fair. we'll also see if it breaks on internal usage

xaionaro commented 1 year ago

Pushed a new version of the PR. Overall:

  1. "Add a package to handle Pause signal" updated the IsSignaledWith signature.
  2. "Provide shorthands for go-belt Logger" -- a new commit, requires review from scratch.
  3. "Migrate from xcontext to go-belt and signaller" uses the simplified syntax for the logger, rebased to new develop and adapted to new IsSignaledWith function signature.
  4. "Delete xcontext" has basically no change (just rebasing / conflict solving)
  5. "Add verbosity to diagnose mis-signaling" now uses the simplified syntax for the logger.
mimir-d commented 1 year ago

thanks for addressing all of the review items; merging