fix some flaky snapshot tests (#8015)
This commit is contained in:
parent
1cc5a2445d
commit
b68045e594
|
@ -15,6 +15,7 @@ import (
|
||||||
"github.com/hashicorp/consul/api"
|
"github.com/hashicorp/consul/api"
|
||||||
"github.com/hashicorp/consul/lib"
|
"github.com/hashicorp/consul/lib"
|
||||||
"github.com/hashicorp/consul/sdk/testutil"
|
"github.com/hashicorp/consul/sdk/testutil"
|
||||||
|
"github.com/hashicorp/consul/sdk/testutil/retry"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
@ -151,6 +152,13 @@ func TestSnapshotSaveCommand_TruncatedStream(t *testing.T) {
|
||||||
_, _ = w.Write(data)
|
_, _ = w.Write(data)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// Wait until the server is actually listening.
|
||||||
|
retry.Run(t, func(r *retry.R) {
|
||||||
|
resp, err := http.Get("http://" + fakeAddr + "/not-real")
|
||||||
|
require.NoError(r, err)
|
||||||
|
require.Equal(r, http.StatusNotFound, resp.StatusCode)
|
||||||
|
})
|
||||||
|
|
||||||
dir := testutil.TempDir(t, "snapshot")
|
dir := testutil.TempDir(t, "snapshot")
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue