mirror of https://github.com/status-im/consul.git
add wait to TestSnapshot
This commit is contained in:
parent
e999e404da
commit
dc200daf21
|
@ -9,14 +9,16 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/consul/acl"
|
"github.com/hashicorp/consul/acl"
|
||||||
|
"github.com/hashicorp/consul/testrpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSnapshot(t *testing.T) {
|
func TestSnapshot(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
var snap io.Reader
|
var snap io.Reader
|
||||||
t.Run("", func(t *testing.T) {
|
t.Run("create snapshot", func(t *testing.T) {
|
||||||
a := NewTestAgent(t, t.Name(), "")
|
a := NewTestAgent(t, t.Name(), "")
|
||||||
defer a.Shutdown()
|
defer a.Shutdown()
|
||||||
|
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
|
||||||
|
|
||||||
body := bytes.NewBuffer(nil)
|
body := bytes.NewBuffer(nil)
|
||||||
req, _ := http.NewRequest("GET", "/v1/snapshot?token=root", body)
|
req, _ := http.NewRequest("GET", "/v1/snapshot?token=root", body)
|
||||||
|
@ -40,9 +42,10 @@ func TestSnapshot(t *testing.T) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("", func(t *testing.T) {
|
t.Run("restore snapshot", func(t *testing.T) {
|
||||||
a := NewTestAgent(t, t.Name(), "")
|
a := NewTestAgent(t, t.Name(), "")
|
||||||
defer a.Shutdown()
|
defer a.Shutdown()
|
||||||
|
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
|
||||||
|
|
||||||
req, _ := http.NewRequest("PUT", "/v1/snapshot?token=root", snap)
|
req, _ := http.NewRequest("PUT", "/v1/snapshot?token=root", snap)
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
|
|
Loading…
Reference in New Issue