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

Increase freelist.releaseRange unit test coverage. #36

Merged
merged 1 commit into from
Sep 8, 2017

Conversation

jpbetz
Copy link
Contributor

@jpbetz jpbetz commented Sep 7, 2017

Adds a test table covering some of the boundary conditions for freelist.releaseRange.

cc @heyitsanthony

@jpbetz
Copy link
Contributor Author

jpbetz commented Sep 7, 2017

cc @mml, @cheftako

@codecov-io
Copy link

codecov-io commented Sep 7, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@3a49aac). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #36   +/-   ##
=========================================
  Coverage          ?   84.81%           
=========================================
  Files             ?        9           
  Lines             ?     1851           
  Branches          ?        0           
=========================================
  Hits              ?     1570           
  Misses            ?      167           
  Partials          ?      114

Continue to review full report at Codecov.

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

Copy link
Contributor

@heyitsanthony heyitsanthony left a comment

Choose a reason for hiding this comment

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

lgtm after fixing speling, thanks!

freelist_test.go Outdated
},
}

// Ensure that releaseRange handles boundry conditions correctly
Copy link
Contributor

Choose a reason for hiding this comment

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

s/boundry/boundary

freelist_test.go Outdated
@@ -44,6 +44,131 @@ func TestFreelist_release(t *testing.T) {
}
}

type testRange struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you define these types out of the func body? do you plan to reuse them in other tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll move them into the test function. Thanks!

freelist_test.go Outdated
},
releaseRanges: []testRange{
testRange{100, 198},
testRange{200, 199},
Copy link

Choose a reason for hiding this comment

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

Is this range supposed to be out of order? In fact should this range even be here even correctly ordered?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add a comment. This is intended to simulate the ranges db.freePages might produce.

freelist_test.go Outdated
testPage{id: 4, n: 1, allocTxn: 100, freeTxn: 125},
testPage{id: 5, n: 1, allocTxn: 125, freeTxn: 150},
testPage{id: 6, n: 1, allocTxn: 150, freeTxn: 175},
testPage{id: 7, n: 1, allocTxn: 175, freeTxn: 200},
Copy link

Choose a reason for hiding this comment

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

Can we have a testPage where the allocTxn is in the first release range and the freeTxn is in the second releaseRange? (Eg 125, 175)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Excellent. Added.

@xiang90
Copy link
Contributor

xiang90 commented Sep 8, 2017

lgtm

@xiang90 xiang90 merged commit 4ff482b into etcd-io:master Sep 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants