add wait to TestSnapshot

This commit is contained in:
Alvin Huang 2019-02-20 12:36:14 -05:00
parent e9919a5d00
commit 0cbd8406cc
1 changed files with 5 additions and 2 deletions

View File

@ -9,14 +9,16 @@ import (
"testing"
"github.com/hashicorp/consul/acl"
"github.com/hashicorp/consul/testrpc"
)
func TestSnapshot(t *testing.T) {
t.Parallel()
var snap io.Reader
t.Run("", func(t *testing.T) {
t.Run("create snapshot", func(t *testing.T) {
a := NewTestAgent(t, t.Name(), "")
defer a.Shutdown()
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
body := bytes.NewBuffer(nil)
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(), "")
defer a.Shutdown()
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
req, _ := http.NewRequest("PUT", "/v1/snapshot?token=root", snap)
resp := httptest.NewRecorder()