etcd/etcdserver/cluster_state_test.go
Brandon Philips e2d8037ded main: use initial-cluster and initial-cluster-state flags
In preperation for adding the ability to join a machine to an existing
cluster force the user to specify whether they expect this to me a new
cluster or an active one.

The error for not specifying the initial-cluster-state is:
```
etcd: initial cluster state unset and no wal found
```
2014-10-06 14:59:25 -07:00

28 lines
417 B
Go

package etcdserver
import (
"testing"
)
func TestClusterStateSet(t *testing.T) {
tests := []struct {
val string
pass bool
}{
// known values
{"new", true},
// unrecognized values
{"foo", false},
{"", false},
}
for i, tt := range tests {
pf := new(ClusterState)
err := pf.Set(tt.val)
if tt.pass != (err == nil) {
t.Errorf("#%d: want pass=%t, but got err=%v", i, tt.pass, err)
}
}
}