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

80% unit test coverage #1467

Closed
bcwaldon opened this issue Oct 28, 2014 · 1 comment
Closed

80% unit test coverage #1467

bcwaldon opened this issue Oct 28, 2014 · 1 comment
Labels
Milestone

Comments

@bcwaldon
Copy link
Contributor

@bcwaldon bcwaldon commented Oct 28, 2014

Before we ship v0.5.0, etcd must be well-tested. While there are many different levels of testing necessary, having the majority of the codebase covered with unit tests is a reasonable goal. Many of our packages are already well-tested, but as of b6b5081, many are still not well-tested:

ok      _/Users/bcwaldon/src/etcd   0.029s  coverage: 21.4% of statements
ok      _/Users/bcwaldon/src/etcd/client    0.025s  coverage: 50.0% of statements
ok      _/Users/bcwaldon/src/etcd/discovery 0.030s  coverage: 71.7% of statements
?       _/Users/bcwaldon/src/etcd/error [no test files]
?       _/Users/bcwaldon/src/etcd/etcdctl   [no test files]
ok      _/Users/bcwaldon/src/etcd/etcdctl/command   0.025s  coverage: 2.2% of statements
ok      _/Users/bcwaldon/src/etcd/etcdserver    0.331s  coverage: 62.7% of statements
ok      _/Users/bcwaldon/src/etcd/etcdserver/etcdhttp   0.022s  coverage: 92.6% of statements
ok      _/Users/bcwaldon/src/etcd/etcdserver/etcdhttp/httptypes 0.022s  coverage: 27.8% of statements
?       _/Users/bcwaldon/src/etcd/etcdserver/etcdserverpb   [no test files]
?       _/Users/bcwaldon/src/etcd/etcdserver/stats  [no test files]
ok      _/Users/bcwaldon/src/etcd/integration   0.304s  coverage: 0.0% of statements
?       _/Users/bcwaldon/src/etcd/pkg/cors  [no test files]
?       _/Users/bcwaldon/src/etcd/pkg/crc   [no test files]
ok      _/Users/bcwaldon/src/etcd/pkg/fileutil  0.007s  coverage: 100.0% of statements
ok      _/Users/bcwaldon/src/etcd/pkg/flags 0.023s  coverage: 77.1% of statements
?       _/Users/bcwaldon/src/etcd/pkg/pbutil    [no test files]
ok      _/Users/bcwaldon/src/etcd/pkg/strutil   0.008s  coverage: 100.0% of statements
?       _/Users/bcwaldon/src/etcd/pkg/testutil  [no test files]
ok      _/Users/bcwaldon/src/etcd/pkg/transport 0.016s  coverage: 69.7% of statements
?       _/Users/bcwaldon/src/etcd/pkg/types [no test files]
ok      _/Users/bcwaldon/src/etcd/proxy 0.021s  coverage: 87.8% of statements
ok      _/Users/bcwaldon/src/etcd/raft  0.032s  coverage: 89.1% of statements
?       _/Users/bcwaldon/src/etcd/raft/raftpb   [no test files]
ok      _/Users/bcwaldon/src/etcd/snap  0.013s  coverage: 80.6% of statements
?       _/Users/bcwaldon/src/etcd/snap/snappb   [no test files]
ok      _/Users/bcwaldon/src/etcd/store 0.038s  coverage: 89.1% of statements
?       _/Users/bcwaldon/src/etcd/version   [no test files]
ok      _/Users/bcwaldon/src/etcd/wait  0.007s  coverage: 100.0% of statements
ok      _/Users/bcwaldon/src/etcd/wal   0.026s  coverage: 80.1% of statements
?       _/Users/bcwaldon/src/etcd/wal/walpb [no test files]

There are a few packages here that we can omit from this requirement, such as the *pb and integration packages.

I'm proposing we aim for 80% code coverage (yes it's arbitrary, and higher is better) before we cut the release. This is a reasonable goal to aim for, and I guarantee that we will find bugs because of it.

@yichengq

This comment has been minimized.

Copy link
Contributor

@yichengq yichengq commented Jan 15, 2015

?       github.com/coreos/etcd  [no test files]
ok      github.com/coreos/etcd/client   0.011s  coverage: 55.8% of statements
ok      github.com/coreos/etcd/discovery    0.022s  coverage: 66.1% of statements
ok      github.com/coreos/etcd/error    0.010s  coverage: 84.6% of statements
?       github.com/coreos/etcd/etcdctl  [no test files]
ok      github.com/coreos/etcd/etcdctl/command  0.010s  coverage: 1.5% of statements
ok      github.com/coreos/etcd/etcdmain 0.013s  coverage: 34.9% of statements
ok      github.com/coreos/etcd/etcdserver   0.035s  coverage: 61.1% of statements
ok      github.com/coreos/etcd/etcdserver/etcdhttp  0.016s  coverage: 95.1% of statements
ok      github.com/coreos/etcd/etcdserver/etcdhttp/httptypes    0.009s  coverage: 77.4% of statements
?       github.com/coreos/etcd/etcdserver/etcdserverpb  [no test files]
?       github.com/coreos/etcd/etcdserver/stats [no test files]
ok      github.com/coreos/etcd/integration  26.139s coverage: 0.0% of statements
ok      github.com/coreos/etcd/migrate  0.011s  coverage: 17.0% of statements
?       github.com/coreos/etcd/migrate/cmd/etcd-dump-logs   [no test files]
?       github.com/coreos/etcd/migrate/etcd4pb  [no test files]
ok      github.com/coreos/etcd/pkg/cors 0.009s  coverage: 92.6% of statements
ok      github.com/coreos/etcd/pkg/crc  0.005s  coverage: 100.0% of statements
ok      github.com/coreos/etcd/pkg/fileutil 0.045s  coverage: 80.6% of statements
ok      github.com/coreos/etcd/pkg/flags    0.008s  coverage: 87.9% of statements
ok      github.com/coreos/etcd/pkg/idutil   0.005s  coverage: 100.0% of statements
ok      github.com/coreos/etcd/pkg/ioutils  0.004s  coverage: 100.0% of statements
ok      github.com/coreos/etcd/pkg/netutil  0.008s  coverage: 94.1% of statements
ok      github.com/coreos/etcd/pkg/pbutil   0.007s  coverage: 100.0% of statements
?       github.com/coreos/etcd/pkg/testutil [no test files]
ok      github.com/coreos/etcd/pkg/timeutil 0.007s  coverage: 100.0% of statements
ok      github.com/coreos/etcd/pkg/transport    0.059s  coverage: 81.2% of statements
ok      github.com/coreos/etcd/pkg/types    0.008s  coverage: 100.0% of statements
ok      github.com/coreos/etcd/pkg/wait 0.006s  coverage: 100.0% of statements
ok      github.com/coreos/etcd/proxy    0.008s  coverage: 88.2% of statements
ok      github.com/coreos/etcd/raft 0.121s  coverage: 88.3% of statements
?       github.com/coreos/etcd/raft/raftpb  [no test files]
ok      github.com/coreos/etcd/rafthttp 0.106s  coverage: 38.5% of statements
ok      github.com/coreos/etcd/snap 0.013s  coverage: 82.1% of statements
?       github.com/coreos/etcd/snap/snappb  [no test files]
ok      github.com/coreos/etcd/store    0.023s  coverage: 89.4% of statements
?       github.com/coreos/etcd/tools/etcd-dump-logs [no test files]
?       github.com/coreos/etcd/tools/etcd-migrate   [no test files]
?       github.com/coreos/etcd/version  [no test files]
ok      github.com/coreos/etcd/wal  0.029s  coverage: 80.8% of statements
?       github.com/coreos/etcd/wal/walpb    [no test files]

Most packages reach the 80% test coverage. Here are some details about the ones that doesn't make that:

  • client, rafthttp package is actively developing now
  • discovery, etcdserver package is covered by integration tests, which is not counted in.
  • etcdctl, etcdserver/stats needs to be refactor
  • etcdmain, migrate needs more thoughts about how to test efficiently
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.