mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
test: add govet to tests
This commit is contained in:
parent
ae4403c945
commit
341c7190d3
@ -4,6 +4,7 @@ go:
|
||||
|
||||
install:
|
||||
- go get code.google.com/p/go.tools/cmd/cover
|
||||
- go get code.google.com/p/go.tools/cmd/vet
|
||||
|
||||
script:
|
||||
- ./test
|
||||
|
@ -98,7 +98,7 @@ func TestCheckCluster(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
// self is in the size range
|
||||
client.Nodes{
|
||||
[]*client.Node{
|
||||
{Key: "/1000/_config/size", Value: "3", CreatedIndex: 1},
|
||||
{Key: self, CreatedIndex: 2},
|
||||
{Key: "/1000/2", CreatedIndex: 3},
|
||||
@ -110,7 +110,7 @@ func TestCheckCluster(t *testing.T) {
|
||||
},
|
||||
{
|
||||
// self is in the size range
|
||||
client.Nodes{
|
||||
[]*client.Node{
|
||||
{Key: "/1000/_config/size", Value: "3", CreatedIndex: 1},
|
||||
{Key: "/1000/2", CreatedIndex: 2},
|
||||
{Key: "/1000/3", CreatedIndex: 3},
|
||||
@ -122,7 +122,7 @@ func TestCheckCluster(t *testing.T) {
|
||||
},
|
||||
{
|
||||
// self is out of the size range
|
||||
client.Nodes{
|
||||
[]*client.Node{
|
||||
{Key: "/1000/_config/size", Value: "3", CreatedIndex: 1},
|
||||
{Key: "/1000/2", CreatedIndex: 2},
|
||||
{Key: "/1000/3", CreatedIndex: 3},
|
||||
@ -134,7 +134,7 @@ func TestCheckCluster(t *testing.T) {
|
||||
},
|
||||
{
|
||||
// self is not in the cluster
|
||||
client.Nodes{
|
||||
[]*client.Node{
|
||||
{Key: "/1000/_config/size", Value: "3", CreatedIndex: 1},
|
||||
{Key: "/1000/2", CreatedIndex: 2},
|
||||
{Key: "/1000/3", CreatedIndex: 3},
|
||||
@ -143,7 +143,7 @@ func TestCheckCluster(t *testing.T) {
|
||||
3,
|
||||
},
|
||||
{
|
||||
client.Nodes{
|
||||
[]*client.Node{
|
||||
{Key: "/1000/_config/size", Value: "3", CreatedIndex: 1},
|
||||
{Key: "/1000/2", CreatedIndex: 2},
|
||||
{Key: "/1000/3", CreatedIndex: 3},
|
||||
@ -154,7 +154,7 @@ func TestCheckCluster(t *testing.T) {
|
||||
},
|
||||
{
|
||||
// bad size key
|
||||
client.Nodes{
|
||||
[]*client.Node{
|
||||
{Key: "/1000/_config/size", Value: "bad", CreatedIndex: 1},
|
||||
},
|
||||
ErrBadSizeKey,
|
||||
@ -162,7 +162,7 @@ func TestCheckCluster(t *testing.T) {
|
||||
},
|
||||
{
|
||||
// no size key
|
||||
client.Nodes{},
|
||||
[]*client.Node{},
|
||||
ErrSizeNotFound,
|
||||
0,
|
||||
},
|
||||
@ -210,9 +210,9 @@ func TestCheckCluster(t *testing.T) {
|
||||
|
||||
func TestWaitNodes(t *testing.T) {
|
||||
all := client.Nodes{
|
||||
{Key: "/1000/1", CreatedIndex: 2},
|
||||
{Key: "/1000/2", CreatedIndex: 3},
|
||||
{Key: "/1000/3", CreatedIndex: 4},
|
||||
0: {Key: "/1000/1", CreatedIndex: 2},
|
||||
1: {Key: "/1000/2", CreatedIndex: 3},
|
||||
2: {Key: "/1000/3", CreatedIndex: 4},
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
@ -325,9 +325,9 @@ func TestCreateSelf(t *testing.T) {
|
||||
|
||||
func TestNodesToCluster(t *testing.T) {
|
||||
nodes := client.Nodes{
|
||||
{Key: "/1000/1", Value: "1=1.1.1.1", CreatedIndex: 1},
|
||||
{Key: "/1000/2", Value: "2=2.2.2.2", CreatedIndex: 2},
|
||||
{Key: "/1000/3", Value: "3=3.3.3.3", CreatedIndex: 3},
|
||||
0: {Key: "/1000/1", Value: "1=1.1.1.1", CreatedIndex: 1},
|
||||
1: {Key: "/1000/2", Value: "2=2.2.2.2", CreatedIndex: 2},
|
||||
2: {Key: "/1000/3", Value: "3=3.3.3.3", CreatedIndex: 3},
|
||||
}
|
||||
w := "1=1.1.1.1,2=2.2.2.2,3=3.3.3.3"
|
||||
|
||||
@ -339,10 +339,10 @@ func TestNodesToCluster(t *testing.T) {
|
||||
|
||||
func TestSortableNodes(t *testing.T) {
|
||||
ns := client.Nodes{
|
||||
{CreatedIndex: 5},
|
||||
{CreatedIndex: 1},
|
||||
{CreatedIndex: 3},
|
||||
{CreatedIndex: 4},
|
||||
0: {CreatedIndex: 5},
|
||||
1: {CreatedIndex: 1},
|
||||
2: {CreatedIndex: 3},
|
||||
3: {CreatedIndex: 4},
|
||||
}
|
||||
// add some randomness
|
||||
for i := 0; i < 10000; i++ {
|
||||
|
6
main.go
6
main.go
@ -107,11 +107,11 @@ func init() {
|
||||
fs.Var(&flagtypes.IPAddressPort{}, "peer-bind-addr", "DEPRECATED: Use -listen-peer-urls instead.")
|
||||
|
||||
for _, f := range ignored {
|
||||
fs.Var(&pkg.IgnoredFlag{f}, f, "")
|
||||
fs.Var(&pkg.IgnoredFlag{Name: f}, f, "")
|
||||
}
|
||||
|
||||
fs.Var(&pkg.DeprecatedFlag{"peers"}, "peers", "DEPRECATED: Use -initial-cluster instead")
|
||||
fs.Var(&pkg.DeprecatedFlag{"peers-file"}, "peers-file", "DEPRECATED: Use -initial-cluster instead")
|
||||
fs.Var(&pkg.DeprecatedFlag{Name: "peers"}, "peers", "DEPRECATED: Use -initial-cluster instead")
|
||||
fs.Var(&pkg.DeprecatedFlag{Name: "peers-file"}, "peers-file", "DEPRECATED: Use -initial-cluster instead")
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user