Move all endpoints on v1 to be under apps

This commit is contained in:
James
2017-07-26 11:39:35 -07:00
parent 8ade75b868
commit 6ee7619b40
9 changed files with 119 additions and 86 deletions

View File

@@ -15,12 +15,12 @@ func TestCalls(t *testing.T) {
t.Run("list-calls-for-missing-app", func(t *testing.T) {
t.Parallel()
s := SetupDefaultSuite()
cfg := &call.GetAppsAppCallsRouteParams{
cfg := &call.GetAppsAppCallsParams{
App: s.AppName,
Route: s.RoutePath,
Route: &s.RoutePath,
Context: s.Context,
}
_, err := s.Client.Call.GetAppsAppCallsRoute(cfg)
_, err := s.Client.Call.GetAppsAppCalls(cfg)
if err == nil {
t.Errorf("Must fail with missing app error, but got %s", err)
}
@@ -31,12 +31,12 @@ func TestCalls(t *testing.T) {
s := SetupDefaultSuite()
CreateApp(t, s.Context, s.Client, s.AppName, map[string]string{})
cfg := &call.GetAppsAppCallsRouteParams{
cfg := &call.GetAppsAppCallsParams{
App: s.AppName,
Route: s.RoutePath,
Route: &s.RoutePath,
Context: s.Context,
}
_, err := s.Client.Call.GetAppsAppCallsRoute(cfg)
_, err := s.Client.Call.GetAppsAppCalls(cfg)
if err == nil {
t.Errorf("Must fail with missing route error, but got %s", err)
}
@@ -51,12 +51,13 @@ func TestCalls(t *testing.T) {
CreateRoute(t, s.Context, s.Client, s.AppName, s.RoutePath, s.Image, s.RouteType,
s.RouteConfig, s.RouteHeaders)
cfg := &call.GetCallsCallParams{
cfg := &call.GetAppsAppCallsCallParams{
Call: "dummy",
App: s.AppName,
Context: s.Context,
}
cfg.WithTimeout(time.Second * 60)
_, err := s.Client.Call.GetCallsCall(cfg)
_, err := s.Client.Call.GetAppsAppCallsCall(cfg)
if err == nil {
t.Error("Must fail because `dummy` call does not exist.")
}
@@ -85,7 +86,10 @@ func TestCalls(t *testing.T) {
Context: s.Context,
}
cfg.WithTimeout(time.Second * 60)
_, err := s.Client.Call.GetCallsCall(cfg)
_, err := s.Client.Call.GetAppsAppCalls(&call.GetAppsAppCallsParams{
App: s.AppName,
Route: &s.RoutePath,
})
if err != nil {
switch err.(type) {
case *call.GetCallsCallNotFound:
@@ -113,17 +117,18 @@ func TestCalls(t *testing.T) {
CallAsync(t, u, &bytes.Buffer{})
time.Sleep(time.Second * 8)
cfg := &call.GetAppsAppCallsRouteParams{
cfg := &call.GetAppsAppCallsParams{
App: s.AppName,
Route: s.RoutePath,
Route: &s.RoutePath,
Context: s.Context,
}
calls, err := s.Client.Call.GetAppsAppCallsRoute(cfg)
calls, err := s.Client.Call.GetAppsAppCalls(cfg)
if err != nil {
t.Errorf("Unexpected error: %s", err)
}
if len(calls.Payload.Calls) == 0 {
if calls == nil || calls.Payload == nil || calls.Payload.Calls == nil || len(calls.Payload.Calls) == 0 {
t.Errorf("Must fail. There should be at least one call to `%v` route.", s.RoutePath)
return
}
for _, c := range calls.Payload.Calls {
if c.Path != s.RoutePath {

View File

@@ -159,12 +159,13 @@ func TestRouteExecutions(t *testing.T) {
callID := CallAsync(t, u, &bytes.Buffer{})
time.Sleep(time.Second * 10)
cfg := &call.GetCallsCallParams{
cfg := &call.GetAppsAppCallsCallParams{
Call: callID,
App: s.AppName,
Context: s.Context,
}
cfg.WithTimeout(time.Second * 60)
callResponse, err := s.Client.Call.GetCallsCall(cfg)
callResponse, err := s.Client.Call.GetAppsAppCallsCall(cfg)
if err != nil {
switch err.(type) {
case *call.GetCallsCallNotFound:
@@ -224,12 +225,13 @@ func TestRouteExecutions(t *testing.T) {
json.NewDecoder(output).Decode(tB)
cfg := &call.GetCallsCallParams{
cfg := &call.GetAppsAppCallsCallParams{
Call: tB.CallID,
App: s.AppName,
Context: s.Context,
}
cfg.WithTimeout(time.Second * 60)
callObj, err := s.Client.Call.GetCallsCall(cfg)
callObj, err := s.Client.Call.GetAppsAppCallsCall(cfg)
if err != nil {
t.Errorf("Unexpected error: %s", err)
}
@@ -262,12 +264,13 @@ func TestRouteExecutions(t *testing.T) {
callID := CallAsync(t, u, &bytes.Buffer{})
time.Sleep(15 * time.Second)
cfg := &operations.GetCallsCallLogParams{
cfg := &operations.GetAppsAppCallsCallLogParams{
Call: callID,
App: s.AppName,
Context: s.Context,
}
logObj, err := s.Client.Operations.GetCallsCallLog(cfg)
logObj, err := s.Client.Operations.GetAppsAppCallsCallLog(cfg)
if err != nil {
t.Errorf("Unexpected error: %s", err)
}
@@ -312,7 +315,7 @@ func TestRouteExecutions(t *testing.T) {
res := output.String()
if !strings.Contains("application/xml, application/json; q=0.2", res) {
t.Errorf("HEADER_ACCEPT='application/xml, application/json; q=0.2' "+
"should be in output, have:\n%", res)
"should be in output, have:%s\n", res)
}
DeleteRoute(t, s.Context, s.Client, s.AppName, routePath)
DeleteApp(t, s.Context, s.Client, s.AppName)
@@ -342,12 +345,13 @@ func TestRouteExecutions(t *testing.T) {
callID := CallAsync(t, u, content)
time.Sleep(10 * time.Second)
cfg := &operations.GetCallsCallLogParams{
cfg := &operations.GetAppsAppCallsCallLogParams{
Call: callID,
App: s.AppName,
Context: s.Context,
}
_, err := s.Client.Operations.GetCallsCallLog(cfg)
_, err := s.Client.Operations.GetAppsAppCallsCallLog(cfg)
if err != nil {
t.Errorf("Unexpected error: %s", err)
@@ -359,7 +363,7 @@ func TestRouteExecutions(t *testing.T) {
t.Run("exec-oversized-log-test", func(t *testing.T) {
t.Parallel()
t.Skip("Skipped until fix for https://github.com/fnproject/fn/issues/86.")
t.Skip("Skipped until fix for https://gitlab-odx.oracle.com/odx/functions/issues/86.")
s := SetupDefaultSuite()
routePath := "/log"
@@ -384,12 +388,13 @@ func TestRouteExecutions(t *testing.T) {
callID := CallAsync(t, u, content)
time.Sleep(5 * time.Second)
cfg := &operations.GetCallsCallLogParams{
cfg := &operations.GetAppsAppCallsCallLogParams{
Call: callID,
App: s.AppName,
Context: s.Context,
}
logObj, err := s.Client.Operations.GetCallsCallLog(cfg)
logObj, err := s.Client.Operations.GetAppsAppCallsCallLog(cfg)
if err != nil {
t.Errorf("Unexpected error: %s", err)
}