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

add upgrade unit test #1440

Merged
merged 1 commit into from
Oct 24, 2023
Merged

add upgrade unit test #1440

merged 1 commit into from
Oct 24, 2023

Conversation

hijackthe2
Copy link
Contributor

add unit test in service/src/upgrade.rs

Details

add function test_failover_policy to test FailoverPolicy::try_from

Types of changes

What types of changes does your PullRequest introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@hijackthe2 hijackthe2 requested a review from a team as a code owner October 13, 2023 09:43
@hijackthe2 hijackthe2 requested review from liubogithub, luodw and changweige and removed request for a team October 13, 2023 09:43
@codecov
Copy link

codecov bot commented Oct 13, 2023

Codecov Report

Merging #1440 (b0408fe) into master (acb689f) will increase coverage by 0.06%.
The diff coverage is 96.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1440      +/-   ##
==========================================
+ Coverage   46.26%   46.32%   +0.06%     
==========================================
  Files         123      123              
  Lines       38878    38905      +27     
  Branches    38878    38905      +27     
==========================================
+ Hits        17987    18023      +36     
+ Misses      19918    19908      -10     
- Partials      973      974       +1     
Files Coverage Δ
service/src/upgrade.rs 63.15% <96.42%> (+63.15%) ⬆️

... and 2 files with indirect coverage changes

assert!(FailoverPolicy::try_from(s).is_err());
}

let str = String::from("flush");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the test! Is it necessary to test String?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for response and suggestion! I test String type transform here to increase code coverage. Indeed, testing String type is optional.

@imeoer
Copy link
Collaborator

imeoer commented Oct 16, 2023

Also please remove the unnecessary commits.

@imeoer
Copy link
Collaborator

imeoer commented Oct 24, 2023

@hijackthe2 Let's remove the unnecessary commits and merge it, thanks!

@hijackthe2 hijackthe2 force-pushed the unit-test branch 4 times, most recently from 3130df6 to ea15402 Compare October 24, 2023 09:15
test type transformation between struct FailoverPolicy and String/&str
@imeoer imeoer merged commit 3bb124b into dragonflyoss:master Oct 24, 2023
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants