Remove iron...

This commit is contained in:
Travis Reeder
2017-05-18 18:59:34 +00:00
committed by Reed Allman
parent 521df8c1ff
commit 9cc12b4b12
146 changed files with 406 additions and 1050 deletions

View File

@@ -29,12 +29,12 @@ func TestRouteCreate(t *testing.T) {
{datastore.NewMock(), "/v1/apps/a/routes", `{ "path": "/myroute" }`, http.StatusBadRequest, models.ErrRoutesMissingNew},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { } }`, http.StatusBadRequest, models.ErrRoutesValidationMissingPath},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "path": "/myroute" } }`, http.StatusBadRequest, models.ErrRoutesValidationMissingImage},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "iron/hello" } }`, http.StatusBadRequest, models.ErrRoutesValidationMissingPath},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "iron/hello", "path": "myroute" } }`, http.StatusBadRequest, models.ErrRoutesValidationInvalidPath},
{datastore.NewMock(), "/v1/apps/$/routes", `{ "route": { "image": "iron/hello", "path": "/myroute" } }`, http.StatusInternalServerError, models.ErrAppsValidationInvalidName},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "treeder/hello" } }`, http.StatusBadRequest, models.ErrRoutesValidationMissingPath},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "treeder/hello", "path": "myroute" } }`, http.StatusBadRequest, models.ErrRoutesValidationInvalidPath},
{datastore.NewMock(), "/v1/apps/$/routes", `{ "route": { "image": "treeder/hello", "path": "/myroute" } }`, http.StatusInternalServerError, models.ErrAppsValidationInvalidName},
// success
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "iron/hello", "path": "/myroute" } }`, http.StatusOK, nil},
{datastore.NewMock(), "/v1/apps/a/routes", `{ "route": { "image": "treeder/hello", "path": "/myroute" } }`, http.StatusOK, nil},
} {
rnr, cancel := testRunner(t)
srv := testServer(test.mock, &mqs.Mock{}, rnr, tasks)
@@ -207,7 +207,7 @@ func TestRouteUpdate(t *testing.T) {
Path: "/myroute/do",
},
},
), "/v1/apps/a/routes/myroute/do", `{ "route": { "image": "iron/hello" } }`, http.StatusOK, nil},
), "/v1/apps/a/routes/myroute/do", `{ "route": { "image": "treeder/hello" } }`, http.StatusOK, nil},
// Addresses #381
{datastore.NewMockInit(nil,

View File

@@ -45,9 +45,9 @@ func TestRouteRunnerAsyncExecution(t *testing.T) {
{Name: "myapp", Config: map[string]string{"app": "true"}},
},
[]*models.Route{
{Type: "async", Path: "/myroute", AppName: "myapp", Image: "iron/hello", Config: map[string]string{"test": "true"}},
{Type: "async", Path: "/myerror", AppName: "myapp", Image: "iron/error", Config: map[string]string{"test": "true"}},
{Type: "async", Path: "/myroute/:param", AppName: "myapp", Image: "iron/hello", Config: map[string]string{"test": "true"}},
{Type: "async", Path: "/myroute", AppName: "myapp", Image: "treeder/hello", Config: map[string]string{"test": "true"}},
{Type: "async", Path: "/myerror", AppName: "myapp", Image: "funcy/error", Config: map[string]string{"test": "true"}},
{Type: "async", Path: "/myroute/:param", AppName: "myapp", Image: "treeder/hello", Config: map[string]string{"test": "true"}},
},
)
mq := &mqs.Mock{}

View File

@@ -128,8 +128,8 @@ func TestRouteRunnerExecution(t *testing.T) {
{Name: "myapp", Config: models.Config{}},
},
[]*models.Route{
{Path: "/myroute", AppName: "myapp", Image: "iron/hello", Headers: map[string][]string{"X-Function": {"Test"}}},
{Path: "/myerror", AppName: "myapp", Image: "iron/error", Headers: map[string][]string{"X-Function": {"Test"}}},
{Path: "/myroute", AppName: "myapp", Image: "treeder/hello", Headers: map[string][]string{"X-Function": {"Test"}}},
{Path: "/myerror", AppName: "myapp", Image: "funcy/error", Headers: map[string][]string{"X-Function": {"Test"}}},
},
), &mqs.Mock{}, rnr, tasks)
@@ -186,7 +186,7 @@ func TestRouteRunnerTimeout(t *testing.T) {
{Name: "myapp", Config: models.Config{}},
},
[]*models.Route{
{Path: "/sleeper", AppName: "myapp", Image: "iron/sleeper", Timeout: 1},
{Path: "/sleeper", AppName: "myapp", Image: "funcy/sleeper", Timeout: 1},
},
), &mqs.Mock{}, rnr, tasks)

View File

@@ -14,15 +14,15 @@ import (
"github.com/Sirupsen/logrus"
"github.com/ccirello/supervisor"
"github.com/gin-gonic/gin"
"github.com/spf13/viper"
"gitlab.oracledx.com/odx/functions/api"
"gitlab.oracledx.com/odx/functions/api/datastore"
"gitlab.oracledx.com/odx/functions/api/models"
"gitlab.oracledx.com/odx/functions/api/mqs"
"gitlab.oracledx.com/odx/functions/api/runner"
"gitlab.oracledx.com/odx/functions/api/runner/common"
"gitlab.oracledx.com/odx/functions/api/runner/task"
"gitlab.oracledx.com/odx/functions/api/server/internal/routecache"
"gitlab.oracledx.com/odx/functions/api/runner/common"
"github.com/spf13/viper"
)
const (
@@ -55,7 +55,7 @@ type Server struct {
const cacheSize = 1024
// NewFromEnv creates a new IronFunctions server based on env vars.
// NewFromEnv creates a new Functions server based on env vars.
func NewFromEnv(ctx context.Context) *Server {
ds, err := datastore.New(viper.GetString(EnvDBURL))
if err != nil {
@@ -72,7 +72,7 @@ func NewFromEnv(ctx context.Context) *Server {
return New(ctx, ds, mq, apiURL)
}
// New creates a new IronFunctions server with the passed in datastore, message queue and API URL
// New creates a new Functions server with the passed in datastore, message queue and API URL
func New(ctx context.Context, ds models.Datastore, mq models.MessageQueue, apiURL string, opts ...ServerOption) *Server {
metricLogger := runner.NewMetricLogger()
funcLogger := runner.NewFuncLogger()

View File

@@ -120,8 +120,8 @@ func TestFullStack(t *testing.T) {
{"create my app", "POST", "/v1/apps", `{ "app": { "name": "myapp" } }`, http.StatusOK, 0},
{"list apps", "GET", "/v1/apps", ``, http.StatusOK, 0},
{"get app", "GET", "/v1/apps/myapp", ``, http.StatusOK, 0},
{"add myroute", "POST", "/v1/apps/myapp/routes", `{ "route": { "name": "myroute", "path": "/myroute", "image": "iron/hello" } }`, http.StatusOK, 1},
{"add myroute2", "POST", "/v1/apps/myapp/routes", `{ "route": { "name": "myroute2", "path": "/myroute2", "image": "iron/error" } }`, http.StatusOK, 2},
{"add myroute", "POST", "/v1/apps/myapp/routes", `{ "route": { "name": "myroute", "path": "/myroute", "image": "treeder/hello" } }`, http.StatusOK, 1},
{"add myroute2", "POST", "/v1/apps/myapp/routes", `{ "route": { "name": "myroute2", "path": "/myroute2", "image": "funcy/error" } }`, http.StatusOK, 2},
{"get myroute", "GET", "/v1/apps/myapp/routes/myroute", ``, http.StatusOK, 2},
{"get myroute2", "GET", "/v1/apps/myapp/routes/myroute2", ``, http.StatusOK, 2},
{"get all routes", "GET", "/v1/apps/myapp/routes", ``, http.StatusOK, 2},

View File

@@ -30,7 +30,7 @@ func TestSpecialHandlerSet(t *testing.T) {
// {Name: "test"},
// },
// Routes: []*models.Route{
// {Path: "/test", Image: "iron/hello", AppName: "test"},
// {Path: "/test", Image: "treeder/hello", AppName: "test"},
// },
// },
// MQ: &mqs.Mock{},