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

refactor: Node config #2296

Merged
merged 5 commits into from
Feb 9, 2024
Merged

Conversation

nasdf
Copy link
Member

@nasdf nasdf commented Feb 8, 2024

Relevant issue(s)

Resolves #2295

Description

This PR refactors the node setup logic into a new node package.

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

make test

Specify the platform(s) on which this was tested:

  • MacOS

Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

Production code looks nicer :), but I am uncertain as to the value provided by the new tests.

err = node.Start(ctx)
require.NoError(t, err)

<-time.After(5 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

question: How much value do you think this test provides? Is it not covering something that is covered by pretty much every integration test we have, but with a 5 second cost?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to have something similar to the start-binary workflow. I think it would be valuable to catch those errors before that workflow is run.


"github.com/stretchr/testify/require"
)

Copy link
Contributor

Choose a reason for hiding this comment

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

question: These tests do not appear to actually test their config works, only that it does not error - they (the WithFoo funcs) could be empty funcs for all these tests care. Do you think they are worth keeping and maintaining?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated the tests. They should make more sense now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cheers, looks good :)

Copy link

codecov bot commented Feb 8, 2024

Codecov Report

Attention: 109 lines in your changes are missing coverage. Please review.

Comparison is base (e28ea26) 74.00% compared to head (795358b) 74.12%.

❗ Current head 795358b differs from pull request most recent head 9d63f97. Consider uploading reports for the commit 9d63f97 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2296      +/-   ##
===========================================
+ Coverage    74.00%   74.12%   +0.13%     
===========================================
  Files          256      258       +2     
  Lines        25602    25641      +39     
===========================================
+ Hits         18945    19006      +61     
+ Misses        5342     5307      -35     
- Partials      1315     1328      +13     
Flag Coverage Δ
all-tests 74.12% <48.10%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
config/config.go 72.33% <ø> (ø)
node/store.go 100.00% <100.00%> (ø)
cli/utils.go 41.89% <0.00%> (-2.39%) ⬇️
cli/server_dump.go 19.23% <0.00%> (-6.35%) ⬇️
node/node.go 71.88% <71.88%> (ø)
cli/start.go 35.63% <0.00%> (+9.25%) ⬆️

... and 11 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e28ea26...9d63f97. Read the comment docs.

@fredcarle fredcarle added the area/config Related to configuration label Feb 8, 2024
@fredcarle fredcarle added this to the DefraDB v0.10 milestone Feb 8, 2024
@nasdf nasdf merged commit 86610d7 into sourcenetwork:develop Feb 9, 2024
27 of 29 checks passed
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
## Relevant issue(s)

Resolves sourcenetwork#2295 

## Description

This PR refactors the node setup logic into a new `node` package.

## Tasks

- [x] I made sure the code is well commented, particularly
hard-to-understand areas.
- [x] I made sure the repository-held documentation is changed
accordingly.
- [x] I made sure the pull request title adheres to the conventional
commit style (the subset used in the project can be found in
[tools/configs/chglog/config.yml](tools/configs/chglog/config.yml)).
- [x] I made sure to discuss its limitations such as threats to
validity, vulnerability to mistake and misuse, robustness to
invalidation of assumptions, resource requirements, ...

## How has this been tested?

make test

Specify the platform(s) on which this was tested:
- MacOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config Related to configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node config refactor
3 participants