Reject async requests in case if MQ is not reachable

This commit is contained in:
Denis Makogon
2017-07-25 10:03:04 -07:00
committed by Reed Allman
parent 565f61fe6f
commit 97b0b97bd8
5 changed files with 64 additions and 18 deletions

View File

@@ -24,7 +24,7 @@ type routeTestCase struct {
func (test *routeTestCase) run(t *testing.T, i int, buf *bytes.Buffer) {
rnr, cancel := testRunner(t)
srv := testServer(test.ds, &mqs.Mock{}, test.logDB, rnr)
srv := testServer(test.ds, &mqs.Mock{}, test.logDB, rnr, DefaultEnqueue)
body := bytes.NewBuffer([]byte(test.body))
_, rec := routerRequest(t, srv.Router, test.method, test.path, body)
@@ -131,7 +131,7 @@ func TestRouteDelete(t *testing.T) {
), logs.NewMock(), "/v1/apps/a/routes/myroute", "", http.StatusOK, nil},
} {
rnr, cancel := testRunner(t)
srv := testServer(test.ds, &mqs.Mock{}, test.logDB, rnr)
srv := testServer(test.ds, &mqs.Mock{}, test.logDB, rnr, DefaultEnqueue)
_, rec := routerRequest(t, srv.Router, "DELETE", test.path, nil)
if rec.Code != test.expectedCode {
@@ -162,7 +162,7 @@ func TestRouteList(t *testing.T) {
ds := datastore.NewMock()
fnl := logs.NewMock()
srv := testServer(ds, &mqs.Mock{}, fnl, rnr)
srv := testServer(ds, &mqs.Mock{}, fnl, rnr, DefaultEnqueue)
for i, test := range []struct {
path string
@@ -201,7 +201,7 @@ func TestRouteGet(t *testing.T) {
ds := datastore.NewMock()
fnl := logs.NewMock()
srv := testServer(ds, &mqs.Mock{}, fnl, rnr)
srv := testServer(ds, &mqs.Mock{}, fnl, rnr, DefaultEnqueue)
for i, test := range []struct {
path string