mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Fix unit tests due to missing mock MQ
This commit is contained in:
@@ -8,10 +8,12 @@ import (
|
||||
|
||||
"github.com/iron-io/functions/api/datastore"
|
||||
"github.com/iron-io/functions/api/models"
|
||||
"github.com/iron-io/functions/api/mqs"
|
||||
)
|
||||
|
||||
func TestAppCreate(t *testing.T) {
|
||||
New(&datastore.Mock{}, testRunner(t))
|
||||
|
||||
New(&datastore.Mock{}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
@@ -52,7 +54,7 @@ func TestAppCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAppDelete(t *testing.T) {
|
||||
New(&datastore.Mock{}, testRunner(t))
|
||||
New(&datastore.Mock{}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
@@ -83,7 +85,7 @@ func TestAppDelete(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAppList(t *testing.T) {
|
||||
New(&datastore.Mock{}, testRunner(t))
|
||||
New(&datastore.Mock{}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
@@ -113,7 +115,7 @@ func TestAppList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAppGet(t *testing.T) {
|
||||
New(&datastore.Mock{}, testRunner(t))
|
||||
New(&datastore.Mock{}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
@@ -143,7 +145,7 @@ func TestAppGet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAppUpdate(t *testing.T) {
|
||||
New(&datastore.Mock{}, testRunner(t))
|
||||
New(&datastore.Mock{}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
|
||||
@@ -8,10 +8,11 @@ import (
|
||||
|
||||
"github.com/iron-io/functions/api/datastore"
|
||||
"github.com/iron-io/functions/api/models"
|
||||
"github.com/iron-io/functions/api/mqs"
|
||||
)
|
||||
|
||||
func TestRouteCreate(t *testing.T) {
|
||||
New(&datastore.Mock{}, testRunner(t))
|
||||
New(&datastore.Mock{}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
@@ -52,7 +53,7 @@ func TestRouteCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRouteDelete(t *testing.T) {
|
||||
New(&datastore.Mock{}, testRunner(t))
|
||||
New(&datastore.Mock{}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
@@ -83,7 +84,7 @@ func TestRouteDelete(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRouteList(t *testing.T) {
|
||||
New(&datastore.Mock{}, testRunner(t))
|
||||
New(&datastore.Mock{}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
@@ -113,7 +114,7 @@ func TestRouteList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRouteGet(t *testing.T) {
|
||||
New(&datastore.Mock{}, testRunner(t))
|
||||
New(&datastore.Mock{}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
@@ -143,7 +144,7 @@ func TestRouteGet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRouteUpdate(t *testing.T) {
|
||||
New(&datastore.Mock{}, testRunner(t))
|
||||
New(&datastore.Mock{}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/iron-io/functions/api/datastore"
|
||||
"github.com/iron-io/functions/api/models"
|
||||
"github.com/iron-io/functions/api/mqs"
|
||||
)
|
||||
|
||||
func TestRouteRunnerGet(t *testing.T) {
|
||||
@@ -16,7 +17,7 @@ func TestRouteRunnerGet(t *testing.T) {
|
||||
FakeApps: []*models.App{
|
||||
{Name: "myapp", Config: models.Config{}},
|
||||
},
|
||||
}, testRunner(t))
|
||||
}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
@@ -54,7 +55,7 @@ func TestRouteRunnerPost(t *testing.T) {
|
||||
FakeApps: []*models.App{
|
||||
{Name: "myapp", Config: models.Config{}},
|
||||
},
|
||||
}, testRunner(t))
|
||||
}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
@@ -99,7 +100,7 @@ func TestRouteRunnerExecution(t *testing.T) {
|
||||
{Path: "/myroute", AppName: "myapp", Image: "iron/hello", Headers: map[string][]string{"X-Function": []string{"Test"}}},
|
||||
{Path: "/myerror", AppName: "myapp", Image: "iron/error", Headers: map[string][]string{"X-Function": []string{"Test"}}},
|
||||
},
|
||||
}, testRunner(t))
|
||||
}, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/iron-io/functions/api/datastore"
|
||||
"github.com/iron-io/functions/api/models"
|
||||
"github.com/iron-io/functions/api/mqs"
|
||||
)
|
||||
|
||||
var tmpBolt = "/tmp/func_test_bolt.db"
|
||||
@@ -26,7 +27,7 @@ func TestFullStack(t *testing.T) {
|
||||
ds, close := prepareBolt(t)
|
||||
defer close()
|
||||
|
||||
New(ds, testRunner(t))
|
||||
New(ds, &mqs.Mock{}, testRunner(t))
|
||||
router := testRouter()
|
||||
|
||||
for i, test := range []struct {
|
||||
|
||||
Reference in New Issue
Block a user