github.com/sym3tri/etcd@v0.2.1-0.20140422215517-a563d82f95d6/tests/functional/cluster_config_test.go (about) 1 package test 2 3 import ( 4 "bytes" 5 "os" 6 "testing" 7 "time" 8 9 "github.com/coreos/etcd/tests" 10 "github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert" 11 ) 12 13 // Ensure that the cluster configuration can be updated. 14 func TestClusterConfig(t *testing.T) { 15 _, etcds, err := CreateCluster(3, &os.ProcAttr{Files: []*os.File{nil, os.Stdout, os.Stderr}}, false) 16 assert.NoError(t, err) 17 defer DestroyCluster(etcds) 18 19 resp, _ := tests.Put("http://localhost:7001/v2/admin/config", "application/json", bytes.NewBufferString(`{"activeSize":3, "promoteDelay":60}`)) 20 assert.Equal(t, resp.StatusCode, 200) 21 22 time.Sleep(1 * time.Second) 23 24 resp, _ = tests.Get("http://localhost:7002/v2/admin/config") 25 body := tests.ReadBodyJSON(resp) 26 assert.Equal(t, resp.StatusCode, 200) 27 assert.Equal(t, body["activeSize"], 3) 28 assert.Equal(t, body["promoteDelay"], 60) 29 }